From 5cad0f9d1cb982f03a60c494f0a363056feab688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Tue, 20 Aug 2024 17:09:14 +0300 Subject: [PATCH 2/3] Define bug-reference-forge-alist as custom type * lisp/progmodes/bug-reference.el (bug-reference-forge-alist): Define as custom type. The manual and the documentation string refere to it like it is a custom variable. Further defcustom will also ensure that the variable is the right type when the user modifies it. --- lisp/progmodes/bug-reference.el | 49 +++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 815e51aef73..9f293754c78 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -104,6 +104,37 @@ bug-reference-bug-regexp ;;;###autoload (put 'bug-reference-bug-regexp 'safe-local-variable 'stringp) + +(defcustom bug-reference-forge-alist + '(("github.com" github "https") + ("gitea.com" gitea "https") + ("codeberg.org" gitea "https") + ("gitlab.com" gitlab "https") + ("framagit.org" gitlab "https") + ("salsa.debian.org" gitlab "https") + ("sr.ht" sourcehut "https")) + "An alist of forge instances. +Each entry has the form (HOST-DOMAIN FORGE-TYPE PROTOCOL). +HOST-DOMAIN is the host- and domain name, e.g., gitlab.com, +salsa.debian.org, or sr.ht. +FORGE-TYPE is the type of the forge, e.g., gitlab, gitea, +sourcehut, or github. +PROTOCOL is the protocol for accessing the forge's issue tracker, +usually \"https\" but for self-hosted forge instances not +accessible via the internet it might also be \"http\"." + :type '(alist :key-type (string :tag "Host-Domain") + :value-type (group (choice :tag "Forge-Type" + (const :tag "Github" github) + (const :tag "Gitea" gitea) + (const :tag "Gitlab" gitlab) + (const :tag "Sourcehut" sourcehut) + (symbol)) + (choice :tag "Protocol" + (const "https") (string)))) + :group 'bug-reference + :version "30.1") + + (defun bug-reference-set-overlay-properties () "Set properties of bug reference overlays." (put 'bug-reference 'evaporate t) @@ -240,24 +271,6 @@ bug-reference--setup-from-vc-alist from a few default entries, and the value of `bug-reference-forge-alist'.") -(defvar bug-reference-forge-alist - '(("github.com" github "https") - ("gitea.com" gitea "https") - ("codeberg.org" gitea "https") - ("gitlab.com" gitlab "https") - ("framagit.org" gitlab "https") - ("salsa.debian.org" gitlab "https") - ("sr.ht" sourcehut "https")) - "An alist of forge instances. -Each entry has the form (HOST-DOMAIN FORGE-TYPE PROTOCOL). -HOST-DOMAIN is the host- and domain name, e.g., gitlab.com, -salsa.debian.org, or sr.ht. -FORGE-TYPE is the type of the forge, e.g., gitlab, gitea, -sourcehut, or github. -PROTOCOL is the protocol for accessing the forge's issue tracker, -usually \"https\" but for self-hosted forge instances not -accessible via the internet it might also be \"http\".") - (cl-defgeneric bug-reference--build-forge-setup-entry (host-domain forge-type protocol) "Build an entry for `bug-reference--setup-from-vc-alist'. -- 2.45.2