From: Sean Whitton Date: Thu, 17 Oct 2024 13:06:58 +0000 (+0800) Subject: log-view-modify-change-comment: Prepend Summary header X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=26f8a3793e671afcad23989f6e23bae041f47bed;p=emacs.git log-view-modify-change-comment: Prepend Summary header * lisp/vc/log-view.el (log-edit): Require. (log-view-modify-change-comment): When log-edit-hook would insert an empty Summary header, prepend one to the old comment. (cherry picked from commit 8d7d9dd42a6c2bf1f941108148d9df91bce857fa) --- diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el index 0533af62343..647a7dc569f 100644 --- a/lisp/vc/log-view.el +++ b/lisp/vc/log-view.el @@ -111,6 +111,7 @@ (require 'pcvs-util) (require 'easy-mmode) +(require 'log-edit) (autoload 'vc-find-revision "vc") (autoload 'vc-diff-internal "vc") @@ -553,6 +554,17 @@ If called interactively, visit the version at point." (vc-call-backend log-view-vc-backend 'get-change-comment files rev) (vc-not-supported (log-view-extract-comment))))) + (when (memq 'log-edit-insert-message-template log-edit-hook) + (let* ((first-newline (string-match "\n" comment)) + (summary (substring comment 0 first-newline)) + (rest (and first-newline + (substring comment (1+ first-newline))))) + (setq comment + ;; As we are part of the VC subsystem I think we are + ;; entitled to call a \\`log-edit--' function. + ;; --spwhitton + (concat (log-edit--make-header-line "Summary" summary) + (if (length> rest 0) rest "\n"))))) (vc-modify-change-comment files rev comment))) (defun log-view-annotate-version (pos)