diff options
| author | Eli Zaretskii | 2025-11-23 10:32:18 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2025-11-23 10:33:49 +0200 |
| commit | bb1f70c90180589564e1f831725c59e34013b02a (patch) | |
| tree | e828ec023b0876fe39ff3a90ea8d741e1dc41d65 /lisp/vc/diff.el | |
| parent | 6c30c6c87d953455e55a258685b697ab531cbd25 (diff) | |
| download | emacs-bb1f70c90180589564e1f831725c59e34013b02a.tar.gz emacs-bb1f70c90180589564e1f831725c59e34013b02a.zip | |
Fix 'd' command in 'query-replace' in buffers not visiting files
* lisp/vc/diff.el (diff-file-local-copy): Use proper coding-system
when writing a local copy of a non-file visiting buffer.
* lisp/misearch.el (coding-system--for-buffer-diff): New variable.
(multi-file-replace-as-diff): Bind it to 'utf-8-emacs'.
(multi-file-diff-no-select): Use proper coding-system when reading
output of Diff. (Bug#79761)
Diffstat (limited to 'lisp/vc/diff.el')
| -rw-r--r-- | lisp/vc/diff.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index c8a1b7c0efa..9e4a5349fef 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el | |||
| @@ -118,13 +118,17 @@ Non-interactively, OLD and NEW may each be a file or a buffer." | |||
| 118 | (display-buffer | 118 | (display-buffer |
| 119 | (diff-no-select old new switches no-async))) | 119 | (diff-no-select old new switches no-async))) |
| 120 | 120 | ||
| 121 | (defvar coding-system--for-buffer-diff) ; from misearch.el | ||
| 122 | |||
| 121 | (defun diff-file-local-copy (file-or-buf) | 123 | (defun diff-file-local-copy (file-or-buf) |
| 122 | "Like `file-local-copy' but also supports a buffer as the argument. | 124 | "Like `file-local-copy' but also supports a buffer as the argument. |
| 123 | When FILE-OR-BUF is a buffer, return the filename of a local | 125 | When FILE-OR-BUF is a buffer, return the filename of a local |
| 124 | temporary file with the buffer's contents." | 126 | temporary file with the buffer's contents." |
| 125 | (if (bufferp file-or-buf) | 127 | (if (bufferp file-or-buf) |
| 126 | (with-current-buffer file-or-buf | 128 | (with-current-buffer file-or-buf |
| 127 | (let ((tempfile (make-temp-file "buffer-content-"))) | 129 | (let ((tempfile (make-temp-file "buffer-content-")) |
| 130 | (coding-system-for-write (or coding-system--for-buffer-diff | ||
| 131 | coding-system-for-write))) | ||
| 128 | (if diff-entire-buffers | 132 | (if diff-entire-buffers |
| 129 | (write-region nil nil tempfile nil 'nomessage) | 133 | (write-region nil nil tempfile nil 'nomessage) |
| 130 | (write-region (point-min) (point-max) tempfile nil 'nomessage)) | 134 | (write-region (point-min) (point-max) tempfile nil 'nomessage)) |