emacs-diffs
[Top][All Lists]
Advanced

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

master ee265922a0d: More consistently propertize Log Edit headers as fie


From: Sean Whitton
Subject: master ee265922a0d: More consistently propertize Log Edit headers as fields
Date: Thu, 17 Oct 2024 08:11:57 -0400 (EDT)

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

    More consistently propertize Log Edit headers as fields
    
    * lisp/vc/log-edit.el (log-edit--make-header-line): Factor out
    of log-edit-insert-message-template.
    (log-edit-set-header): Call log-edit--make-header-line so that
    the Log Edit header is propertized as a field.
---
 lisp/vc/log-edit.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index d61a108b195..7ec394a263d 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -890,6 +890,14 @@ different header separator appropriate for 
`log-edit-mode'."
                     (zerop (forward-line 1))))
         (eobp))))
 
+(defun log-edit--make-header-line (header &optional value)
+  ;; Make \\`C-a' work like it does in other buffers with header names.
+  (concat (propertize (concat header ": ")
+                      'field 'header
+                      'rear-nonsticky t)
+          value
+          "\n"))
+
 (defun log-edit-insert-message-template ()
   "Insert the default VC commit log template with Summary and Author."
   (interactive)
@@ -897,11 +905,8 @@ different header separator appropriate for 
`log-edit-mode'."
             (log-edit-empty-buffer-p))
     (dolist (header (append '("Summary") (and log-edit-setup-add-author
                                               '("Author"))))
-      ;; Make `C-a' work like in other buffers with header names.
-      (insert (propertize (concat header ": ")
-                          'field 'header
-                          'rear-nonsticky t)
-              "\n"))
+
+      (insert (log-edit--make-header-line header)))
     (insert "\n")
     (message-position-point)))
 
@@ -1315,7 +1320,7 @@ If TOGGLE is non-nil, and the value of HEADER already is 
VALUE,
 clear it.  Make sure there is an empty line after the headers.
 Return t if toggled on (or TOGGLE is nil), otherwise nil."
   (let ((val t)
-        (line (concat header ": " value "\n")))
+        (line (log-edit--make-header-line header value)))
     (save-excursion
       (save-restriction
         (rfc822-goto-eoh)



reply via email to

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