From: Sean Whitton Date: Thu, 17 Oct 2024 12:11:53 +0000 (+0800) Subject: More consistently propertize Log Edit headers as fields X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ee5f7731ab124d451b49f2fc2e396edb8e32a62c;p=emacs.git 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. (cherry picked from commit ee265922a0df68893f4d2b23a9190f524b745b6a) --- 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)