emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8d7d9dd42a6 3/4: log-view-modify-change-comment: Prepend Summary


From: Sean Whitton
Subject: master 8d7d9dd42a6 3/4: log-view-modify-change-comment: Prepend Summary header
Date: Thu, 17 Oct 2024 09:24:41 -0400 (EDT)

branch: master
commit 8d7d9dd42a6c2bf1f941108148d9df91bce857fa
Author: Sean Whitton <spwhitton@spwhitton.name>
Commit: Sean Whitton <spwhitton@spwhitton.name>

    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.
---
 lisp/vc/log-view.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]