From: Eli Zaretskii <eliz@gnu.org>
To: Sean Whitton <spwhitton@spwhitton.name>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH v2] Font lock long Git commit summary lines
Date: Mon, 05 Sep 2022 15:07:49 +0300 [thread overview]
Message-ID: <8335d6koru.fsf@gnu.org> (raw)
In-Reply-To: <871qsq2096.fsf@melete.silentflame.com> (message from Sean Whitton on Sun, 04 Sep 2022 16:22:29 -0700)
> From: Sean Whitton <spwhitton@spwhitton.name>
> Date: Sun, 04 Sep 2022 16:22:29 -0700
>
> Here is v2 of my patch. Thank you for the comments.
Thanks. May I comment a bit more?
> +(defcustom vc-git-log-edit-summary-target nil
> + "Target length for Git commit summary lines.
Given the description below, "Target length" is not the best wording
here. Perhaps "Preferred maximum length" is better? And
consequently, I think a better name for the variable is
vc-git-log-edit-summary-warning-len
> +By setting this to an integer around 50, you can improve the
> +compatibility of your commit messages with Git commands that
> +print the summary line in width-constrained contexts. However,
> +many commit summaries will need to exceed this length.
I'd lose the last sentence here: it confuses the whole issue. When
you say "Preferred" or "Target", and describe what will happen beyond
that, you already in effect tell the reader that the limitation is not
a hard one, but just a guideline.
> +(defface vc-git-log-edit-summary-warning
> + '((t :inherit warning))
> + "Face for Git commit summary lines beyond the target length.")
This should mention vc-git-log-edit-summary-target. Imagine a user
who looks at the face's doc string and wonders which "target length"
does the above allude to.
> +(defcustom vc-git-log-edit-summary-max 68
I'd call this vc-git-log-edit-summary-max-len
> + "Maximum length for Git commit summary lines.
> +If non-nil, characters in summary lines beyond this length are
^^^^^^^^^^
"If a number, ..." Saying "if non-nil, ... beyond this length" is
problematic, because not all non-nil values are numbers.
> +(defface vc-git-log-edit-summary-error
> + '((t :inherit error))
> + "Face for Git commit summary lines beyond the maximum length.")
Reference the variable in the doc string.
> +(defun vc-git--log-edit-summary-check (limit)
> + (and (re-search-forward "^Summary: " limit t)
> + (when-let ((regex
> + (cond ((and vc-git-log-edit-summary-max
> + vc-git-log-edit-summary-target)
Should this test using numberp?
> + (vc-git-log-edit-summary-max
> + (format ".\\{,%d\\}\\(?2:.*\\)"
> + vc-git-log-edit-summary-max))
> + (vc-git-log-edit-summary-target
> + (format ".\\{,%d\\}\\(.*\\)"
> + vc-git-log-edit-summary-target)))))
Likewise here.
next prev parent reply other threads:[~2022-09-05 12:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-03 17:03 [PATCH] * vc-git.el (vc-git-log-edit-mode): Font lock long summary lines Sean Whitton
2022-09-04 10:50 ` 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 [this message]
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=8335d6koru.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=spwhitton@spwhitton.name \
/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).