Function: log-edit-maybe-show-diff
log-edit-maybe-show-diff is a byte-compiled function defined in
log-edit.el.gz.
Signature
(log-edit-maybe-show-diff)
Documentation
Show diff for the changes to be committed without selecting its window.
This function is intended to be added to log-edit-hook.
It does nothing in the case that the commit was initiated from a
diff-mode buffer, i.e., when you are committing a patch. This is
because in that case the existing diff-mode buffer normally remains
visible when the *vc-log* buffer pops up.
Probably introduced at or before Emacs version 31.1.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/log-edit.el.gz
(defun log-edit-maybe-show-diff ()
"Show diff for the changes to be committed without selecting its window.
This function is intended to be added to `log-edit-hook'.
It does nothing in the case that the commit was initiated from a
`diff-mode' buffer, i.e., when you are committing a patch. This is
because in that case the existing `diff-mode' buffer normally remains
visible when the *vc-log* buffer pops up."
;; No (interactive) form because our use of `vc-parent-buffer'
;; assumes we are being called during \\`C-x v v' or similar.
;; If a user wants a version of `log-edit-show-diff' which doesn't
;; select the window they can use a `post-command-select-window'
;; display buffer action alist entry on `log-edit-show-diff'.
(unless (and (bound-and-true-p vc-parent-buffer)
(with-current-buffer vc-parent-buffer
(derived-mode-p 'diff-mode)))
(save-selected-window
(let ((display-buffer-overriding-action '(nil
. ((inhibit-same-window . t)))))
(funcall log-edit-diff-function)))))