Subject: Re: bug#72735: 31.0.50; [PATCH] Make more bug-reference variables customizeable

From: Tassilo Horn <[email-masked]>
Date: Wed, 12 Feb 2025 10:56:53 +0100

Tassilo Horn <[email-masked]> writes:

> Oh, and with bug-reference-setup-from-vc-alist there's only a
> URL-FORMAT-FN which must be a function.

I've changed that now so that URL-FORMAT-FN became URL-FORMAT which can
be string or function.  The string variant suffices in many situations
like my own below.

> And adding you company's tracker is quite easy, too.  That's what I use:
>
> --8<---------------cut here---------------start------------->8---
> (let ((shd-jira-regexp (concat "\\b\\(\\("
>                                (regexp-opt '("ARCA" "BRI" "ECOJ" "KASE" "MOBA"
>                                              "PORC" "LOWE" "SABA"))
>                                "-[0-9]\\{1,6\\}\\)\\)\\b")))
>   (add-to-list 'bug-reference-setup-from-vc-alist
>                `("srv-upsource\\.shd\\.lan"
>                  ,shd-jira-regexp
>                  ,(lambda (_)
>                     :dont-hl-value-as-docstring
>                     "http://srvjira-and.shd.lan/browse/%s")))
>
>   (add-to-list 'bug-reference-setup-from-mail-alist
>                `("SHD" nil ,shd-jira-regexp
>                  "http://srvjira-and.shd.lan/browse/%s"))
> --8<---------------cut here---------------end--------------->8---

With my latest change, the first add-to-list can now be written as

  (add-to-list 'bug-reference-setup-from-mail-alist
               `("SHD" nil ,shd-jira-regexp
                 "http://srvjira-and.shd.lan/browse/%s"))

So now all three variables bug-reference-setup-from-*-alist may contain
entries with only simple strings, none strictly requires a function
(unless you need to derive the bug URL from the VC URL).  As such, they
could become defcustoms (of course, those must allow functions where
applicable, too) that could be customized at least for the simple cases
(like my dayjob config above).  I wouldn't reject a patch in this regard
(although I'm not convinced that many users would prefer that).

As Stefan K. already said: setting up bug-reference using a
.dir-locals.el is probably the better & easier approach for many cases.

Bye,
Tassilo