aboutsummaryrefslogtreecommitdiff
path: root/lisp/git-commit.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2024-05-20 13:35:11 +0200
committerJonas Bernoulli <jonas@bernoul.li>2024-05-20 13:35:11 +0200
commit22fd8f8594202a0679ccc2f7d02bca44d48b8039 (patch)
tree989fbff5a6d497f92d45215da7bacccdd5c9999b /lisp/git-commit.el
parent9cde118744151caca08b080e15f0c903f17d0f20 (diff)
git-commit: Disable auto-filling for summary line
The coloring of the overflowing characters makes sure we notice that we have gone over the limit, and should be enough to make us consider other options. If we decide to go ahead and violate the limit anyway, we should not have to manually revert the effect of the auto-filling.
Diffstat (limited to 'lisp/git-commit.el')
-rw-r--r--lisp/git-commit.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/git-commit.el b/lisp/git-commit.el
index edbcfd1..717ea7b 100644
--- a/lisp/git-commit.el
+++ b/lisp/git-commit.el
@@ -142,6 +142,8 @@
(defvar font-lock-end)
(defvar recentf-exclude)
+(defvar git-commit-need-summary-line)
+
(define-obsolete-variable-alias
'git-commit-known-pseudo-headers
'git-commit-trailers
@@ -710,9 +712,16 @@ the input isn't tacked to the comment."
(setq-local paragraph-start (concat paragraph-start "\\|\\*\\|(")))
(defun git-commit-turn-on-auto-fill ()
- "Unconditionally turn on Auto Fill mode."
+ "Unconditionally turn on Auto Fill mode.
+Ensure auto filling happens everywhere, except in the summary line."
+ (turn-on-auto-fill)
(setq-local comment-auto-fill-only-comments nil)
- (turn-on-auto-fill))
+ (when git-commit-need-summary-line
+ (setq-local auto-fill-function #'git-commit-auto-fill-except-summary)))
+
+(defun git-commit-auto-fill-except-summary ()
+ (unless (eq (line-beginning-position) 1)
+ (do-auto-fill)))
(defun git-commit-turn-on-orglink ()
"Turn on Orglink mode if it is available.