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)
(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)
(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."
(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)
(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 ()