From f770538b30e5b55905617f293eb933b9d6e93ec1 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Thu, 15 Jul 2021 21:51:54 +0200 Subject: [PATCH] Add bug-reference support for Codeberg projects * lisp/progmodes/bug-reference.el (bug-reference-setup-from-vc-alist): Add support for codeberg.org bug and pull request references. * doc/emacs/maintaining.texi (Bug Reference): Mention that bug and pull request references for codeberg projects are supported. --- doc/emacs/maintaining.texi | 8 ++++---- lisp/progmodes/bug-reference.el | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index a84af8535b4..3205e6dbdf7 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -3134,10 +3134,10 @@ Setup for version-controlled files configurable by the variable setup GNU projects where @url{https://debbugs.gnu.org} is used as 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. +where issues are referenced using the notation @code{#17}, Codeberg +and Github projects where both bugs and pull requests are referenced +using the same notation, and GitLab projects where bugs are referenced +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 diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 918930a8afb..755211b922b 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -184,6 +184,22 @@ The second subexpression should match the bug reference (usually a number)." "/issues/" (match-string 2)))))) ;; + ;; Codeberg projects. + ;; + ;; The systematics is exactly as for Github projects. + ("[/@]codeberg.org[/:]\\([.A-Za-z0-9_/-]+\\)\\.git" + "\\([.A-Za-z0-9_/-]+\\)?\\(?:#\\)\\([0-9]+\\)\\>" + ,(lambda (groups) + (let ((ns-project (nth 1 groups))) + (lambda () + (concat "https://codeberg.org/" + (or + ;; Explicit user/proj#18 link. + (match-string 1) + ns-project) + "/issues/" + (match-string 2)))))) + ;; ;; GitLab projects. ;; ;; Here #18 is an issue and !17 is a merge request. Explicit @@ -202,7 +218,6 @@ The second subexpression should match the bug reference (usually a number)." "issues/" "merge_requests/") (match-string 2)))))) - ;; ;; Sourcehut projects. ;; -- 2.39.5