summaryrefslogtreecommitdiff
path: root/lisp/progmodes/bug-reference.el
diff options
context:
space:
mode:
authorTassilo Horn <tsdh@gnu.org>2021-07-15 21:43:29 +0200
committerTassilo Horn <tsdh@gnu.org>2021-07-15 21:43:29 +0200
commitec3b108c1f91f7adb25db46ae6aacddff762ed8a (patch)
tree634c0516033bf54ba8a931627def2992869f2e11 /lisp/progmodes/bug-reference.el
parenteaefa44acd32f4f7d5e6357546ad22058495ee3f (diff)
downloademacs-ec3b108c1f91f7adb25db46ae6aacddff762ed8a.tar.gz
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.
Diffstat (limited to 'lisp/progmodes/bug-reference.el')
-rw-r--r--lisp/progmodes/bug-reference.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index 61d722f5b9d..918930a8afb 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -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.