From f934af3c30aafc31230107fb2ac258273ad416a0 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 6 Jul 2025 13:58:05 +0100 Subject: [PATCH] Log Edit: Don't auto-fill within the headers * 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 250bf44fa78..d4bda842063 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -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 -- 2.39.5