From 6cbea53d8605425f6df7182c978b9c712f805c2a Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 29 Oct 2024 09:40:02 +0800 Subject: [PATCH] Fix window selection after log-edit-show-diff * 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index a3dc7239eab..40d4f418a7e 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -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 () -- 2.39.5