]> git.eshelyaron.com Git - emacs.git/commitdiff
Log Edit: Don't auto-fill within the headers
authorSean Whitton <spwhitton@spwhitton.name>
Sun, 6 Jul 2025 12:58:05 +0000 (13:58 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 07:45:35 +0000 (09:45 +0200)
* lisp/vc/log-edit.el (log-edit-do-auto-fill): New function.
(log-edit-mode): Set normal-auto-fill-function to it.

(cherry picked from commit 90a0771379360882979aa13f7cc97fc1cfd4b41a)

lisp/vc/log-edit.el

index 250bf44fa78d9380cee82c38bdc78f765ac36d70..d4bda84206380b06fbca240d44cc96421ff34617 100644 (file)
@@ -398,7 +398,7 @@ automatically."
 
 (defvar log-edit-headers-alist '(("Summary" . log-edit-summary)
                                  ("Fixes") ("Author"))
-  "AList of known headers and the face to use to highlight them.")
+  "Alist of known headers and the face to use to highlight them.")
 
 (defconst log-edit-header-contents-regexp
   "[ \t]*\\(.*\\(\n[ \t].*\\)*\\)\n?"
@@ -576,6 +576,7 @@ the \\[vc-prefix-map] prefix for VC commands, for example).
   (cl-pushnew 'display-line-numbers-disable font-lock-extra-managed-props)
   (setq-local jit-lock-contextually t)  ;For the "first line is summary".
   (setq-local fill-paragraph-function #'log-edit-fill-entry)
+  (setq-local normal-auto-fill-function #'log-edit-do-auto-fill)
   (make-local-variable 'log-edit-comment-ring-index)
   (add-hook 'kill-buffer-hook 'log-edit-remember-comment nil t)
   (hack-dir-local-variables-non-file-buffer)
@@ -743,6 +744,12 @@ according to `fill-column'."
           nil)
         t))))
 
+(defun log-edit-do-auto-fill ()
+  "Like `do-auto-fill', but don't fill in Log Edit headers."
+  (unless (> (save-excursion (rfc822-goto-eoh) (point))
+             (point))
+    (do-auto-fill)))
+
 (defun log-edit-hide-buf (&optional buf where)
   (when (setq buf (get-buffer (or buf log-edit-files-buf)))
     ;; FIXME: Should use something like `quit-windows-on' here, but