[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#65883] [PATCH] .dir-locals.el: Update bug-reference configuration a
From: |
brian |
Subject: |
[bug#65883] [PATCH] .dir-locals.el: Update bug-reference configuration and document it. |
Date: |
Tue, 12 Sep 2023 10:20:10 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
> +;;; This extends the default expression (the first complicated blob) to also
> +;;; match URLs such as <https://issues.guix.gnu.org/58697> or
> +;;; <https://bugs.gnu.org/58697>. It is also extended to detect "Fixes:
> +;;; #NNNNN" git trailers.
> +(setq bug-reference-bug-regexp
> + (concat
> + "\\("
> + "\\(?:\\b\\(?:[Bb]ug ?#?\\|[Pp]atch ?#\\|[Ff]ixes:? ?#\\|\
> +RFE ?#\\|PR [a-z+-]+/\\)\\([0-9]+\\(?:#[0-9]+\\)?\\)\\)"
> + "\\|"
> + "\\(?:<https://bugs\\.gnu\\.org/\\(?2:[0-9]+\\)>\\)"
> + "\\)"))
Is there any reason not to use ‘rx’, rather than, as you say,
“complicated blobs’? Particularly with Emacs' requirement for ‘\\’
everywhere, regexps become even more like line noise.
If I'm reading this regexp right, for example, it could be:
--8<---------------cut here---------------start------------->8---
(setq bug-reference-bug-regexp2
(rx (group (or (seq word-boundary
(or (seq (char "Bb") "ug"
(zero-or-one " ")
(zero-or-one "#"))
(seq (char "Pp") "atch"
(zero-or-one " ")
"#")
(seq (char "Ff") "ixes"
(zero-or-one ":")
(zero-or-one " ") "#")
(seq "RFE"
(zero-or-one " ") "#")
(seq "PR "
(one-or-more (char "a-z+-")) "/"))
(group (one-or-more (char "0-9"))
(zero-or-one
(seq "#" (one-or-more
(char "0-9"))))))
(seq "<https://bugs.gnu.org/"
(group-n 2 (one-or-more (char "0-9")))
">")))))
--8<---------------cut here---------------end--------------->8---
-bjc