unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: emacs-devel@gnu.org
Cc: Sean Whitton <spwhitton@spwhitton.name>
Subject: [PATCH] * vc-git.el (vc-git-log-edit-mode): Font lock long summary lines.
Date: Sat,  3 Sep 2022 10:03:08 -0700	[thread overview]
Message-ID: <20220903170308.301805-1-spwhitton@spwhitton.name> (raw)

---
 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	other threads:[~2022-09-03 17:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-03 17:03 Sean Whitton [this message]
2022-09-04 10:50 ` [PATCH] * vc-git.el (vc-git-log-edit-mode): Font lock long summary lines Lars Ingebrigtsen
2022-09-04 17:27   ` Sean Whitton
2022-09-04 17:42     ` Protesilaos Stavrou
2022-09-04 18:36 ` Matthias Meulien
2022-09-04 18:41   ` Philip Kaludercic
2022-09-04 22:06     ` Sean Whitton
2022-09-04 23:22 ` [PATCH v2] Font lock long Git commit " Sean Whitton
2022-09-05 11:12   ` Lars Ingebrigtsen
2022-09-05 12:07   ` Eli Zaretskii
2022-09-05 18:14     ` Sean Whitton
2022-09-05 18:23       ` Eli Zaretskii
2022-09-06  0:39         ` Sean Whitton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220903170308.301805-1-spwhitton@spwhitton.name \
    --to=spwhitton@spwhitton.name \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).