emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2] Font lock long Git commit summary lines


From: Eli Zaretskii
Subject: Re: [PATCH v2] Font lock long Git commit summary lines
Date: Mon, 05 Sep 2022 21:23:47 +0300

> From: Sean Whitton <spwhitton@spwhitton.name>
> Date: Mon, 05 Sep 2022 11:14:27 -0700
> 
> >> +(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.
> 
> I put calls to natnump in, but I'm not sure about it.  Is it really most
> useful to silently fail to highlight the characters if somehow something
> other than a number has ended up in the variables?  I'm new to working
> with font lock so would be grateful for more input.

In similar cases we document this, something like

  ... any other value is treated as nil.

This is IMO less fragile in the face of users doing silly things with
the value.

Thanks.



reply via email to

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