Commit ec3b108c authored by Tassilo Horn's avatar Tassilo Horn
Browse files

Add support for sourcehut to bug-reference.el

* lisp/progmodes/bug-reference.el (bug-reference-setup-from-vc-alist):
Add support for bug references like #17 and ~user/project#19 for
sourcehut (sr.ht).
* doc/emacs/maintaining.texi (Bug Reference): Document sourcehut
support.
parent eaefa44a
Pipeline #11425 failed with stages
in 35 seconds
......@@ -3132,10 +3132,12 @@ one is able to set the variables.
Setup for version-controlled files configurable by the variable
@code{bug-reference-setup-from-vc-alist}. The default is able to
setup GNU projects where @url{https://debbugs.gnu.org} is used as
issue tracker, Github projects where both bugs and pull requests are
referenced using the @code{#42} notation, and GitLab projects where
bugs are references with @code{#17}, too, but merge requests use the
@code{!18} notation.
issue tracker and issues are usually referenced as @code{bug#13} (but
many different notations are considered, too), Sourcehut projects
where issues are referenced using the notation @code{#17}, Github
projects where both bugs and pull requests are referenced using the
same notation, and GitLab projects where bugs are references with
@code{#17}, too, but merge requests use the @code{!18} notation.
@item
Setup for email guessing from mail folder/mbox names, and mail header
......
......@@ -201,6 +201,31 @@ The second subexpression should match the bug reference (usually a number)."
(if (string= (match-string 3) "#")
"issues/"
"merge_requests/")
(match-string 2))))))
;;
;; Sourcehut projects.
;;
;; #19 is an issue. Other project's issues can be referenced as
;; #~user/project#19.
;;
;; Caveat: The code assumes that a project on git.sr.ht or
;; hg.sr.ht has a tracker of the same name on todo.sh.ht. That's
;; a very common setup but all sr.ht services are loosely coupled,
;; so you can have a repo without tracker, or a repo with a
;; tracker using a different name, etc. So we can only try to
;; make a good guess.
("[/@]\\(?:git\\|hg\\).sr.ht[/:]\\(~[.A-Za-z0-9_/-]+\\)"
"\\(~[.A-Za-z0-9_/-]+\\)?\\(?:#\\)\\([0-9]+\\)\\>"
,(lambda (groups)
(let ((ns-project (nth 1 groups)))
(lambda ()
(concat "https://todo.sr.ht/"
(or
;; Explicit user/proj#18 link.
(match-string 1)
ns-project)
"/"
(match-string 2)))))))
"An alist for setting up `bug-reference-mode' based on VC URL.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment