GNU bug report logs -
#65854
Multi-file replacement diff
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Sun, 10 Sep 2023 17:24:01 UTC
Severity: wishlist
Tags: patch
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hi there,
Juri Linkov <juri <at> linkov.net> writes:
> +(defun multi-file-replace-as-diff (files-or-buffers from-string replacements regexp-flag delimited-flag)
> + (require 'diff)
> + (let ((inhibit-message t)
> + (diff-buffer (get-buffer-create "*replace-diff*")))
> + (with-current-buffer diff-buffer
> + (buffer-disable-undo (current-buffer))
> + (let ((inhibit-read-only t))
> + (erase-buffer))
> + (diff-mode))
> + (dolist (file-or-buffer files-or-buffers)
> + (let ((file-name (if (bufferp file-or-buffer) buffer-file-name file-or-buffer)))
> + (when file-name
> + (with-temp-buffer
> + (if (bufferp file-or-buffer)
> + (insert-buffer-substring file-or-buffer)
> + (insert-file-contents file-or-buffer))
I wonder what happens if I call `multi-file-replace-regexp-as-diff` and
select a file `foo.txt`, that I already have open and modified in a
buffer. IIUC, this will generate the diff based on the contents of the
file on disk, not the buffer, so it might not match when I subsequently
try to apply the diff to the buffer. WDYT?
Eshel
This bug report was last modified 1 year and 236 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.