Package: emacs;
Reported by: Björn Bidar <bjorn.bidar <at> thaodan.de>
Date: Tue, 20 Aug 2024 15:36:02 UTC
Severity: wishlist
Found in version 31.0.50
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Björn Bidar <bjorn.bidar <at> thaodan.de> To: bug-gnu-emacs <at> gnu.org Subject: 31.0.50; [PATCH] Make more bug-reference variables customizeable Date: Tue, 20 Aug 2024 18:34:38 +0300
[Message part 1 (text/plain, inline)]
Hello, I noticed that some of the variables that can be modified by the user or as mentioned as such were not defined as custom variable. These patches to so and correct the group of one of the existing defcustom. The patches don't change any of the existing functionality but only document these variables better and make them easier to modify. Because of that I set version to Emacs 30.1. Please tell if that's ok. Good day, Björn
[0001-Define-bug-reference-url-format-as-custom-type.patch (text/x-patch, inline)]
From 0a0f4062c41de25225df6b216470141d3537308c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar <at> thaodan.de> Date: Tue, 20 Aug 2024 16:05:31 +0300 Subject: [PATCH 1/3] Define bug-reference-url-format as custom type * lisp/progmodes/bug-reference.el (bug-reference-url-format): Define as custom type. The manual and the documentation string talk like the variable like is a custom variable. It does make sense to define it as a custom type to check the type and group it under the other bug-reference-mode settings --- lisp/progmodes/bug-reference.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 3bcfc213fc6..815e51aef73 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -48,7 +48,7 @@ bug-reference-map "C-c RET" #'bug-reference-push-button) ;; E.g., "https://gcc.gnu.org/PR%s" -(defvar bug-reference-url-format nil +(defcustom bug-reference-url-format nil "Format used to turn a bug number into a URL. The bug number is supplied as a string, so this should have a single %s. This can also be a function designator; it is called without arguments @@ -62,7 +62,11 @@ bug-reference-url-format If you set it to a symbol in the file Local Variables section, you need to add a `bug-reference-url-format' property to it: \(put \\='my-bug-reference-url-format \\='bug-reference-url-format t) -so that it is considered safe, see `enable-local-variables'.") +so that it is considered safe, see `enable-local-variables'." + :type '(choice (function) + (string)) + :version "30.1" + :group 'bug-reference) ;;;###autoload (put 'bug-reference-url-format 'safe-local-variable -- 2.45.2
[0002-Define-bug-reference-forge-alist-as-custom-type.patch (text/x-patch, inline)]
From 5cad0f9d1cb982f03a60c494f0a363056feab688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar <at> thaodan.de> 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
[0003-Set-custom-group-of-bug-reference-bug-regexp.patch (text/x-patch, inline)]
From 5498829ad845ad7763d25f417be52233cc707753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar <at> thaodan.de> Date: Tue, 20 Aug 2024 17:41:20 +0300 Subject: [PATCH 3/3] ; Set custom group of bug-reference-bug-regexp --- lisp/progmodes/bug-reference.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 9f293754c78..00d8f5d506c 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -97,6 +97,7 @@ bug-reference-bug-regexp outside the bounds of subexpressions 1 and then don't contribute to the highlighted and clickable region." :type 'regexp + :group 'bug-reference ; 24.3: defconst -> defcustom ; 28.1: contract about subexpression 1 defines the overlay region. :version "28.1") -- 2.45.2
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.