]> git.eshelyaron.com Git - emacs.git/commitdiff
log-edit-insert-message-template: Reorder headers
authorSean Whitton <spwhitton@spwhitton.name>
Sat, 26 Apr 2025 12:28:23 +0000 (20:28 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 26 Apr 2025 17:36:55 +0000 (19:36 +0200)
* lisp/vc/log-edit.el (log-edit-insert-message-template): Put
Author before Summary when both are to be inserted.

(cherry picked from commit 19b6c94566c6003cb7a056fce565ced2896acd4b)

lisp/vc/log-edit.el

index 3c3288777c880d23c0d3be7bd9899f9d71ba0c15..19cf1a5ae3d406280579b1ae4fbb1b04de84e3b5 100644 (file)
@@ -914,12 +914,16 @@ different header separator appropriate for `log-edit-mode'."
   (interactive)
   (when (or (called-interactively-p 'interactive)
             (log-edit-empty-buffer-p))
-    (dolist (header (append '("Summary") (and log-edit-setup-add-author
-                                              '("Author"))))
-
-      (insert (log-edit--make-header-line header)))
-    (insert "\n")
-    (message-position-point)))
+    ;; Put Author first because then the user can immediately yank in a
+    ;; multiline log message, or use \\`C-c C-w' (probably because they
+    ;; know it will generate exactly one line), without thereby pushing
+    ;; Author out of the header and into the log message body.
+    ;; (Also note that `log-edit-set-header' inserts all other headers
+    ;; before Summary.)
+    (when log-edit-setup-add-author
+      (insert (log-edit--make-header-line "Author")))
+    (insert (log-edit--make-header-line "Summary") "\n")
+    (end-of-line -1)))
 
 (defun log-edit-insert-cvs-template ()
   "Insert the commit log template specified by the CVS administrator, if any.