emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] * vc-git.el (vc-git-log-edit-mode): Font lock long summary lines


From: Sean Whitton
Subject: [PATCH] * vc-git.el (vc-git-log-edit-mode): Font lock long summary lines.
Date: Sat, 3 Sep 2022 10:03:08 -0700

---
 lisp/vc/vc-git.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

I'd like to install this patch to highlight long summary lines when composing
git commit messages.  Comments welcome.

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 7395253745..8338bfcb26 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -913,7 +913,14 @@ vc-git-log-edit-mode-map
 
 (define-derived-mode vc-git-log-edit-mode log-edit-mode "Log-Edit/git"
   "Major mode for editing Git log messages.
-It is based on `log-edit-mode', and has Git-specific extensions.")
+It is based on `log-edit-mode', and has Git-specific extensions."
+  (setq-local
+   log-edit-font-lock-keywords
+   (append log-edit-font-lock-keywords
+           ;; Warn about going over 50 chars, warn harder about going
+           ;; over 68, per established conventions.
+           '(("\\`Summary: .\\{,50\\}\\(.\\{,18\\}\\)\\(.*\\)"
+             (1 'warning prepend t) (2 'error prepend t))))))
 
 (defvar vc-git-patch-string nil)
 
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]