GNU bug report logs - #72735
31.0.50; [PATCH] Make more bug-reference variables customizeable

Previous Next

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

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#72735: closed (31.0.50; [PATCH] Make more bug-reference
 variables customizeable  )
Date: Tue, 11 Feb 2025 07:30:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 10 Feb 2025 23:29:47 -0800
with message-id <CADwFkm=KMQNn1y08KoidWmvJnnGicEiL4ZHt4LezzPAdsNwZ3g <at> mail.gmail.com>
and subject line Re: bug#72735: 31.0.50; [PATCH] Make more bug-reference variables customizeable
has caused the debbugs.gnu.org bug report #72735,
regarding 31.0.50; [PATCH] Make more bug-reference variables customizeable  
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
72735: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72735
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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 3 (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

[Message part 7 (message/rfc822, inline)]
From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: bjorn.bidar <at> thaodan.de, 72735-done <at> debbugs.gnu.org,
 Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#72735: 31.0.50;
 [PATCH] Make more bug-reference variables customizeable
Date: Mon, 10 Feb 2025 23:29:47 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Tassilo Horn <tsdh <at> gnu.org>
>> Cc: Björn Bidar <bjorn.bidar <at> thaodan.de>,
>>   72735 <at> debbugs.gnu.org
>> Date: Wed, 21 Aug 2024 07:20:27 +0200
>>
>> As Eli already mentioned, bug-reference-url-format is usually set via a
>> file local variables section or programatically so neither a defcustom
>> nor a default value makes sense.
>>
>> Wrt. bug-reference-setup-from-mail-alist,
>> bug-reference-setup-from-irc-alist, and
>> bug-reference-setup-from-vc-alist: yes, they could be defcustoms but
>> their entries can all (and are likely to) contain functions which are
>> hard to specify in the defcustom interface.  I've thought it wouldn't be
>> needed.  After all, bug-reference is a programmer's tool.
>>
>> Wrt. bug-reference-forge-alist: if it became a defcustom and a user
>> would set it, she wouldn't see updates (like support for some new forge)
>> in its default value anymore because their old saved custom value
>> overrides the new default value.  It's much better to add new entries
>> programatically using add-to-list or push/cl-pushnew.  Of course, one
>> could split the variable in some *-default-alist defvar and a defcustom
>> *-alist where the latter is meant for user customization but I think
>> it's not worth the added complexity here.
>>
>> So I'd rather keep it as-is.
>
> Thanks.
>
> So, Björn, now you get to try to convince Tassilo that making some of
> these variables defcustoms does make sense.  IOW, what are the
> problems in the current situation that prompted you to suggest these
> changes?

No further comments within 24 weeks, so I'm closing this bug.


This bug report was last modified 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.