]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix window selection after log-edit-show-diff
authorSean Whitton <spwhitton@spwhitton.name>
Tue, 29 Oct 2024 01:40:02 +0000 (09:40 +0800)
committerEshel Yaron <me@eshelyaron.com>
Tue, 29 Oct 2024 09:58:27 +0000 (10:58 +0100)
* lisp/vc/vc.el (vc-diff-patch-string): Use display-buffer, not
pop-to-buffer, for consistency with log-edit-diff-fileset.
(vc-modify-change-comment): Use save-selected-window around
vc-diff-internal to avoid leaving the *vc-diff* window selected,
for consistency with log-edit-diff-fileset.

(cherry picked from commit 40cf6f9009209b8c3363d057882611cd5d56f853)

lisp/vc/vc.el

index a3dc7239eabda594fa5a9ea33cce81dfd2214d8b..40d4f418a7e752161356153d8bb1a90c8bd4b1ad 100644 (file)
@@ -1996,7 +1996,7 @@ in the output buffer."
     (setq-local revert-buffer-function
                 (lambda (_ _) (vc-diff-patch-string patch-string)))
     (setq-local vc-patch-string patch-string)
-    (pop-to-buffer (current-buffer))
+    (display-buffer (current-buffer))
     (vc-run-delayed (vc-diff-finish (current-buffer) nil))))
 
 (defun vc-diff-internal (async vc-fileset rev1 rev2 &optional verbose buffer)
@@ -2538,8 +2538,9 @@ the variable `vc-BACKEND-header'."
               (prevrev
                (vc-call-backend backend
                                 'previous-revision rootdir rev)))
-         (vc-diff-internal nil (list backend (list rootdir))
-                           prevrev rev))))))
+         (save-selected-window
+           (vc-diff-internal nil (list backend (list rootdir))
+                             prevrev rev)))))))
 
 ;;;###autoload
 (defun vc-merge ()