diff options
| author | Tassilo Horn | 2021-07-15 21:43:29 +0200 |
|---|---|---|
| committer | Tassilo Horn | 2021-07-15 21:43:29 +0200 |
| commit | ec3b108c1f91f7adb25db46ae6aacddff762ed8a (patch) | |
| tree | 634c0516033bf54ba8a931627def2992869f2e11 | |
| parent | eaefa44acd32f4f7d5e6357546ad22058495ee3f (diff) | |
| download | emacs-ec3b108c1f91f7adb25db46ae6aacddff762ed8a.tar.gz emacs-ec3b108c1f91f7adb25db46ae6aacddff762ed8a.zip | |
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.
| -rw-r--r-- | doc/emacs/maintaining.texi | 10 | ||||
| -rw-r--r-- | lisp/progmodes/bug-reference.el | 25 |
2 files changed, 31 insertions, 4 deletions
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index a91bfacb9ea..a84af8535b4 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi | |||
| @@ -3132,10 +3132,12 @@ one is able to set the variables. | |||
| 3132 | Setup for version-controlled files configurable by the variable | 3132 | Setup for version-controlled files configurable by the variable |
| 3133 | @code{bug-reference-setup-from-vc-alist}. The default is able to | 3133 | @code{bug-reference-setup-from-vc-alist}. The default is able to |
| 3134 | setup GNU projects where @url{https://debbugs.gnu.org} is used as | 3134 | setup GNU projects where @url{https://debbugs.gnu.org} is used as |
| 3135 | issue tracker, Github projects where both bugs and pull requests are | 3135 | issue tracker and issues are usually referenced as @code{bug#13} (but |
| 3136 | referenced using the @code{#42} notation, and GitLab projects where | 3136 | many different notations are considered, too), Sourcehut projects |
| 3137 | bugs are references with @code{#17}, too, but merge requests use the | 3137 | where issues are referenced using the notation @code{#17}, Github |
| 3138 | @code{!18} notation. | 3138 | projects where both bugs and pull requests are referenced using the |
| 3139 | same notation, and GitLab projects where bugs are references with | ||
| 3140 | @code{#17}, too, but merge requests use the @code{!18} notation. | ||
| 3139 | 3141 | ||
| 3140 | @item | 3142 | @item |
| 3141 | Setup for email guessing from mail folder/mbox names, and mail header | 3143 | Setup for email guessing from mail folder/mbox names, and mail header |
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)." | |||
| 201 | (if (string= (match-string 3) "#") | 201 | (if (string= (match-string 3) "#") |
| 202 | "issues/" | 202 | "issues/" |
| 203 | "merge_requests/") | 203 | "merge_requests/") |
| 204 | (match-string 2)))))) | ||
| 205 | |||
| 206 | ;; | ||
| 207 | ;; Sourcehut projects. | ||
| 208 | ;; | ||
| 209 | ;; #19 is an issue. Other project's issues can be referenced as | ||
| 210 | ;; #~user/project#19. | ||
| 211 | ;; | ||
| 212 | ;; Caveat: The code assumes that a project on git.sr.ht or | ||
| 213 | ;; hg.sr.ht has a tracker of the same name on todo.sh.ht. That's | ||
| 214 | ;; a very common setup but all sr.ht services are loosely coupled, | ||
| 215 | ;; so you can have a repo without tracker, or a repo with a | ||
| 216 | ;; tracker using a different name, etc. So we can only try to | ||
| 217 | ;; make a good guess. | ||
| 218 | ("[/@]\\(?:git\\|hg\\).sr.ht[/:]\\(~[.A-Za-z0-9_/-]+\\)" | ||
| 219 | "\\(~[.A-Za-z0-9_/-]+\\)?\\(?:#\\)\\([0-9]+\\)\\>" | ||
| 220 | ,(lambda (groups) | ||
| 221 | (let ((ns-project (nth 1 groups))) | ||
| 222 | (lambda () | ||
| 223 | (concat "https://todo.sr.ht/" | ||
| 224 | (or | ||
| 225 | ;; Explicit user/proj#18 link. | ||
| 226 | (match-string 1) | ||
| 227 | ns-project) | ||
| 228 | "/" | ||
| 204 | (match-string 2))))))) | 229 | (match-string 2))))))) |
| 205 | "An alist for setting up `bug-reference-mode' based on VC URL. | 230 | "An alist for setting up `bug-reference-mode' based on VC URL. |
| 206 | 231 | ||