diff options
| author | Sean Whitton | 2025-12-18 17:01:57 +0000 |
|---|---|---|
| committer | Sean Whitton | 2025-12-18 17:01:57 +0000 |
| commit | bd6bb96220e4b7acfb7cc6894c4934de7b33d4ea (patch) | |
| tree | 03194c79a8c7f6c60dc12077ee469db4ab0b72ea | |
| parent | 94aab3b60272b33f8307d07725ac655feaec91b3 (diff) | |
| download | emacs-bd6bb96220e4b7acfb7cc6894c4934de7b33d4ea.tar.gz emacs-bd6bb96220e4b7acfb7cc6894c4934de7b33d4ea.zip | |
vc-diff-internal: Call into backend with old current buffer
* lisp/vc/vc.el (vc-diff-internal): Call into the backend with
the original current buffer, not BUFFER (see bug#80005).
| -rw-r--r-- | lisp/vc/vc.el | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index cd61f433e26..63215015297 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -2794,18 +2794,25 @@ Return t if the buffer had changes, nil otherwise." | |||
| 2794 | (if async 'async 1) "diff" file | 2794 | (if async 'async 1) "diff" file |
| 2795 | (append (vc-switches nil 'diff) `(,(null-device))))))) | 2795 | (append (vc-switches nil 'diff) `(,(null-device))))))) |
| 2796 | (setq files (nreverse filtered)))) | 2796 | (setq files (nreverse filtered)))) |
| 2797 | (set-buffer buffer) | 2797 | (with-current-buffer buffer |
| 2798 | ;; Make the *vc-diff* buffer read only, the diff-mode key | 2798 | ;; Make the *vc-diff* buffer read only, the diff-mode key |
| 2799 | ;; bindings are nicer for read only buffers. pcl-cvs does the | 2799 | ;; bindings are nicer for read only buffers. pcl-cvs does the |
| 2800 | ;; same thing. | 2800 | ;; same thing. |
| 2801 | (setq buffer-read-only t) | 2801 | (setq buffer-read-only t) |
| 2802 | (diff-mode) | 2802 | ;; Set the major mode and some local variables before calling into |
| 2803 | (setq-local diff-vc-backend (car vc-fileset)) | 2803 | ;; the backend. This means that the backend can itself set local |
| 2804 | (setq-local diff-vc-revisions (list rev1 rev2)) | 2804 | ;; variables and enable minor modes in BUFFER if it wants to. |
| 2805 | (setq-local revert-buffer-function | 2805 | ;; Call into the backend with the old current buffer, though, so |
| 2806 | (lambda (_ignore-auto _noconfirm) | 2806 | ;; that its operation can be influenced by local variables in that |
| 2807 | (vc-diff-internal async vc-fileset rev1 rev2 verbose))) | 2807 | ;; buffer (some discussion in bug#80005). |
| 2808 | (diff-mode) | ||
| 2809 | (setq-local diff-vc-backend (car vc-fileset)) | ||
| 2810 | (setq-local diff-vc-revisions (list rev1 rev2)) | ||
| 2811 | (setq-local revert-buffer-function | ||
| 2812 | (lambda (_ignore-auto _noconfirm) | ||
| 2813 | (vc-diff-internal async vc-fileset rev1 rev2 verbose)))) | ||
| 2808 | (vc-call-backend (car vc-fileset) 'diff files rev1 rev2 buffer async) | 2814 | (vc-call-backend (car vc-fileset) 'diff files rev1 rev2 buffer async) |
| 2815 | (set-buffer buffer) | ||
| 2809 | (if (and (zerop (buffer-size)) | 2816 | (if (and (zerop (buffer-size)) |
| 2810 | (not (get-buffer-process (current-buffer)))) | 2817 | (not (get-buffer-process (current-buffer)))) |
| 2811 | ;; Treat this case specially so as not to pop the buffer. | 2818 | ;; Treat this case specially so as not to pop the buffer. |