]> git.eshelyaron.com Git - emacs.git/commitdiff
log-edit-diff-function leaves the diff-mode buffer's window selected
authorSean Whitton <spwhitton@spwhitton.name>
Mon, 28 Apr 2025 12:45:44 +0000 (20:45 +0800)
committerEshel Yaron <me@eshelyaron.com>
Tue, 29 Apr 2025 07:33:37 +0000 (09:33 +0200)
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).

(cherry picked from commit d44c87ceb6dc7e85ccfecf47f52f8495e34c1d0b)

lisp/vc/log-edit.el
lisp/vc/vc.el

index 19cf1a5ae3d406280579b1ae4fbb1b04de84e3b5..508b4e41d6880d29919d75038c0ed380c7724945 100644 (file)
@@ -250,8 +250,8 @@ when this variable is set to nil.")
   (lambda () (error "Diff functionality has not been set up"))
   "Function to display an appropriate `diff-mode' buffer for the change.
 Called by the `log-edit-show-diff' command.
-Should not leave the `diff-mode' buffer's window selected; that is, the
-Log Edit buffer's window should be selected when the function returns.")
+The function should display the buffer in a window and leave that window
+selected when it returns, probably by calling `pop-to-buffer'.")
 (defvar log-edit-listfun nil)
 
 (defvar log-edit-parent-buffer nil)
@@ -857,8 +857,7 @@ comment history, see `log-edit-comment-ring', and hides `log-edit-files-buf'."
 (defun log-edit-diff-fileset ()
   "Display diffs for the files to be committed."
   (interactive)
-  (save-selected-window
-    (vc-diff nil nil (list log-edit-vc-backend vc-log-fileset))))
+  (vc-diff nil nil (list log-edit-vc-backend vc-log-fileset)))
 
 (defun log-edit-show-diff ()
   "Show the diff for the files to be committed."
index bd25e94c39129f2589934c3dff5c620a33c78002..67ac17c5e4af130913d972705228f3f7309f92a3 100644 (file)
@@ -2061,7 +2061,7 @@ in the output buffer."
     (setq-local revert-buffer-function
                 (lambda (_ _) (vc-diff-patch-string patch-string)))
     (setq-local vc-patch-string patch-string)
-    (display-buffer (current-buffer))
+    (pop-to-buffer (current-buffer))
     (vc-run-delayed (vc-diff-finish (current-buffer) nil))))
 
 (defun vc-diff-internal (async vc-fileset rev1 rev2 &optional verbose buffer)
@@ -2639,9 +2639,8 @@ the variable `vc-BACKEND-header'."
               (prevrev
                (vc-call-backend backend
                                 'previous-revision rootdir rev)))
-         (save-selected-window
-           (vc-diff-internal nil (list backend (list rootdir))
-                             prevrev rev)))))))
+         (vc-diff-internal nil (list backend (list rootdir))
+                           prevrev rev))))))
 
 ;;;###autoload
 (defun vc-merge ()