From 3520e3b516980c3f543601ab2e0835f293f2cb24 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 8 Nov 2022 08:21:05 -0700 Subject: move calling log-edit-show-diff into log-edit-hook --- .emacs.d/init.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index dbf0e335..46efa01c 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -252,7 +252,7 @@ windows side-by-side in the frame." '(imenu-auto-rescan t) '(kill-read-only-ok t) '(log-edit-hook - '(log-edit-insert-message-template log-edit-insert-cvs-template log-edit-insert-changelog) nil nil "Avoid list of files window becoming the most recently used for C-x o.") + '(log-edit-insert-message-template log-edit-insert-cvs-template log-edit-insert-changelog spw/log-edit-show-diff) nil nil "Drop log-edit-show-files to avoid its window becoming most recently used for C-x o.") '(magit-define-global-key-bindings nil) '(magit-diff-refine-hunk 'all) '(magit-save-repository-buffers nil) @@ -3711,14 +3711,13 @@ mutt's review view, after exiting EDITOR." "@{1}" "@{0}" nil "*vc-reflog-diff*"))) (global-set-key "\C-cvD" #'eshell/rld) -(defun spw/vc-next-action () +(defun spw/log-edit-show-diff () "Unless directly committing a diff, immediately show what we're committing." (interactive) - (let ((diff-mode-p (derived-mode-p 'diff-mode))) - (call-interactively #'vc-next-action) - (when (and (derived-mode-p 'log-edit-mode) (not diff-mode-p)) - (log-edit-show-diff)))) -(global-set-key [remap vc-next-action] #'spw/vc-next-action) + (unless (and vc-parent-buffer + (with-current-buffer vc-parent-buffer + (derived-mode-p 'diff-mode))) + (log-edit-show-diff))) ;;; If we just add `vc-print-root-log' to `project-switch-commands', it seems ;;; to work, but if you try to expand any commits it'll try to run git(1) in -- cgit v1.2.3