1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

vc-start-logentry: Disable log-edit-hook when finishing immediately

* lisp/vc/vc-dispatcher.el (log-edit-hook): Declare.
(vc-start-logentry): Bind log-edit-hook to nil when finishing
the log edit immediately with a caller-supplied message.
This commit is contained in:
Sean Whitton 2025-11-07 12:46:55 +00:00
parent 68e337e630
commit 816830d921

View file

@ -834,6 +834,8 @@ NOT-ESSENTIAL means it is okay to continue if the user says not to save."
(set-buffer-modified-p nil) (set-buffer-modified-p nil)
(setq buffer-file-name nil)) (setq buffer-file-name nil))
(defvar log-edit-hook)
(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook backend patch-string diff-function) (defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook backend patch-string diff-function)
"Accept a comment for an operation on FILES. "Accept a comment for an operation on FILES.
If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the
@ -852,7 +854,8 @@ DIFF-FUNCTION is `log-edit-diff-function' for the Log Edit buffer."
(let ((parent (or (and (length= files 1) (let ((parent (or (and (length= files 1)
(not (vc-dispatcher-browsing)) (not (vc-dispatcher-browsing))
(get-file-buffer (car files))) (get-file-buffer (car files)))
(current-buffer)))) (current-buffer)))
(immediate (and comment (not initial-contents))))
(if (and comment (not initial-contents)) (if (and comment (not initial-contents))
(set-buffer (get-buffer-create logbuf)) (set-buffer (get-buffer-create logbuf))
(pop-to-buffer (get-buffer-create logbuf))) (pop-to-buffer (get-buffer-create logbuf)))
@ -861,7 +864,12 @@ DIFF-FUNCTION is `log-edit-diff-function' for the Log Edit buffer."
(concat " from " (buffer-name vc-parent-buffer))) (concat " from " (buffer-name vc-parent-buffer)))
(when patch-string (when patch-string
(setq-local vc-patch-string patch-string)) (setq-local vc-patch-string patch-string))
(vc-log-edit files mode backend diff-function) (let (;; `log-edit-hook' is usually for things like
;; `log-edit-show-files' and `log-edit-maybe-show-diff' which
;; don't make sense if the user is not going to do any
;; editing, and can cause unexpected window layout changes.
(log-edit-hook (and (not immediate) log-edit-hook)))
(vc-log-edit files mode backend diff-function))
(make-local-variable 'vc-log-after-operation-hook) (make-local-variable 'vc-log-after-operation-hook)
(when after-hook (when after-hook
(setq vc-log-after-operation-hook after-hook)) (setq vc-log-after-operation-hook after-hook))
@ -869,11 +877,11 @@ DIFF-FUNCTION is `log-edit-diff-function' for the Log Edit buffer."
(when comment (when comment
(erase-buffer) (erase-buffer)
(when (stringp comment) (insert comment))) (when (stringp comment) (insert comment)))
(if (or (not comment) initial-contents) (if immediate
(message (substitute-command-keys (vc-finish-logentry (eq comment t))
(message (substitute-command-keys
"%s Type \\<log-edit-mode-map>\\[log-edit-done] when done") "%s Type \\<log-edit-mode-map>\\[log-edit-done] when done")
msg) msg))))
(vc-finish-logentry (eq comment t)))))
(defvar log-edit-vc-backend) (defvar log-edit-vc-backend)
(declare-function vc-buffer-sync-fileset "vc") (declare-function vc-buffer-sync-fileset "vc")