aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-04-28 20:45:44 +0800
committerSean Whitton2025-04-29 09:20:44 +0800
commitd44c87ceb6dc7e85ccfecf47f52f8495e34c1d0b (patch)
tree9ced91b1222168643b6cb4ead4ffe874276ef634
parent3279194bf2c859e76c95045c80a033fc54094f07 (diff)
downloademacs-d44c87ceb6dc7e85ccfecf47f52f8495e34c1d0b.tar.gz
emacs-d44c87ceb6dc7e85ccfecf47f52f8495e34c1d0b.zip
log-edit-diff-function leaves the diff-mode buffer's window selected
This reverts the following two changesets: Author: Sean Whitton <spwhitton@spwhitton.name> AuthorDate: Tue Oct 29 09:40:02 2024 +0800 Fix window selection after log-edit-show-diff Author: Sean Whitton <spwhitton@spwhitton.name> AuthorDate: Tue Apr 8 20:36:42 2025 +0800 Fix window selection after log-edit-show-diff, again This also replaces the following changeset: Author: Sean Whitton <spwhitton@spwhitton.name> AuthorDate: Tue Oct 29 12:52:20 2024 +0800 * lisp/vc/log-edit.el (log-edit-diff-function): Document. * lisp/vc/log-edit.el (log-edit-diff-function): Document that the function *should* leave the window selected when it returns. (log-edit-diff-fileset): * lisp/vc/vc.el (vc-modify-change-comment): Don't use save-selected-window (bug#77946). (vc-diff-patch-string): Call pop-to-buffer, not display-buffer (bug#77946).
-rw-r--r--lisp/vc/log-edit.el7
-rw-r--r--lisp/vc/vc.el7
2 files changed, 6 insertions, 8 deletions
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 19cf1a5ae3d..508b4e41d68 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -250,8 +250,8 @@ when this variable is set to nil.")
250 (lambda () (error "Diff functionality has not been set up")) 250 (lambda () (error "Diff functionality has not been set up"))
251 "Function to display an appropriate `diff-mode' buffer for the change. 251 "Function to display an appropriate `diff-mode' buffer for the change.
252Called by the `log-edit-show-diff' command. 252Called by the `log-edit-show-diff' command.
253Should not leave the `diff-mode' buffer's window selected; that is, the 253The function should display the buffer in a window and leave that window
254Log Edit buffer's window should be selected when the function returns.") 254selected when it returns, probably by calling `pop-to-buffer'.")
255(defvar log-edit-listfun nil) 255(defvar log-edit-listfun nil)
256 256
257(defvar log-edit-parent-buffer nil) 257(defvar log-edit-parent-buffer nil)
@@ -857,8 +857,7 @@ comment history, see `log-edit-comment-ring', and hides `log-edit-files-buf'."
857(defun log-edit-diff-fileset () 857(defun log-edit-diff-fileset ()
858 "Display diffs for the files to be committed." 858 "Display diffs for the files to be committed."
859 (interactive) 859 (interactive)
860 (save-selected-window 860 (vc-diff nil nil (list log-edit-vc-backend vc-log-fileset)))
861 (vc-diff nil nil (list log-edit-vc-backend vc-log-fileset))))
862 861
863(defun log-edit-show-diff () 862(defun log-edit-show-diff ()
864 "Show the diff for the files to be committed." 863 "Show the diff for the files to be committed."
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 0d135854d69..f58290ccd69 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2066,7 +2066,7 @@ in the output buffer."
2066 (setq-local revert-buffer-function 2066 (setq-local revert-buffer-function
2067 (lambda (_ _) (vc-diff-patch-string patch-string))) 2067 (lambda (_ _) (vc-diff-patch-string patch-string)))
2068 (setq-local vc-patch-string patch-string) 2068 (setq-local vc-patch-string patch-string)
2069 (display-buffer (current-buffer)) 2069 (pop-to-buffer (current-buffer))
2070 (vc-run-delayed (vc-diff-finish (current-buffer) nil)))) 2070 (vc-run-delayed (vc-diff-finish (current-buffer) nil))))
2071 2071
2072(defun vc-diff-internal (async vc-fileset rev1 rev2 &optional verbose buffer) 2072(defun vc-diff-internal (async vc-fileset rev1 rev2 &optional verbose buffer)
@@ -2644,9 +2644,8 @@ the variable `vc-BACKEND-header'."
2644 (prevrev 2644 (prevrev
2645 (vc-call-backend backend 2645 (vc-call-backend backend
2646 'previous-revision rootdir rev))) 2646 'previous-revision rootdir rev)))
2647 (save-selected-window 2647 (vc-diff-internal nil (list backend (list rootdir))
2648 (vc-diff-internal nil (list backend (list rootdir)) 2648 prevrev rev))))))
2649 prevrev rev)))))))
2650 2649
2651;;;###autoload 2650;;;###autoload
2652(defun vc-merge () 2651(defun vc-merge ()