Subject: Re: bug#73524: 29.4; bug-reference-mode matches regexp case-insensitively

From: Tassilo Horn <[email-masked]>
Date: Sat, 28 Sep 2024 18:24:16 +0200

Ulrich Mueller <[email-masked]> writes:

Hi!

>>> It will correctly highlight "bug-1234" and "Bug-5678" but also
>>> "bUg-9012" which shouldn't be matched by the regexp.
>
>> I'm not sure I see the harm in that (e.g., what if someone made a
>> mistake while typing the commit log message? these are immutable with
>> Git once pushed), but I've added Tassilo to this discussion in case
>> he has an opinion.
>
> IIUC behaviour depends on case-fold-search in the buffer. If that's
> flipped, the string will no longer match. IMHO it's better to notice
> such typos immediately, instead of being surprised by them later.
>
> If case-independent matching is desired, the regexp can explicitly
> allow it.

Indeed, the matching depends on case-fold-search.  Its value is a
personal preference, so it's advisable to write the regexp such that it
doesn't depend on that setting if you do it publically, e.g., in a
.dir-locals.el.  Bug#123 and bug#123 are both likely while buG#123 is
not.  (That said, I think I don't follow that advice myself in the
auto-setup routines...)

In the wild, bug references are almost always case-insensitive because
URLs are.  So one could say that maybe there should be a
bug-reference-case-fold-search defcustom (defaulting to t) in order to
decouple it from case-fold-search.

WDYT?

Bye,
  Tassilo