]> git.eshelyaron.com Git - emacs.git/commitdiff
log-view-modify-change-comment: Prepend Summary header
authorSean Whitton <spwhitton@spwhitton.name>
Thu, 17 Oct 2024 13:06:58 +0000 (21:06 +0800)
committerEshel Yaron <me@eshelyaron.com>
Thu, 17 Oct 2024 18:52:15 +0000 (20:52 +0200)
* 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)

lisp/vc/log-view.el

index 0533af62343003d26ee95c4b52a2cbd6fc60c3d7..647a7dc569f67c9cb51eae6b3824067b7cc553db 100644 (file)
 
 (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)