unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 72735@debbugs.gnu.org
Subject: bug#72735: 31.0.50; [PATCH] Make more bug-reference variables customizeable
Date: Tue, 20 Aug 2024 18:34:38 +0300	[thread overview]
Message-ID: <16727.7714981296$1724168157@news.gmane.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 454 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Define-bug-reference-url-format-as-custom-type.patch --]
[-- Type: text/x-patch, Size: 1774 bytes --]

From 0a0f4062c41de25225df6b216470141d3537308c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Define-bug-reference-forge-alist-as-custom-type.patch --]
[-- Type: text/x-patch, Size: 3631 bytes --]

From 5cad0f9d1cb982f03a60c494f0a363056feab688 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Set-custom-group-of-bug-reference-bug-regexp.patch --]
[-- Type: text/x-patch, Size: 838 bytes --]

From 5498829ad845ad7763d25f417be52233cc707753 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= <bjorn.bidar@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


             reply	other threads:[~2024-08-20 15:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20 15:34 Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
     [not found] <874j7fnr75.fsf@>
2024-08-20 17:40 ` bug#72735: 31.0.50; [PATCH] Make more bug-reference variables customizeable Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-20 17:40 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-20 18:39 ` Eli Zaretskii
2024-08-20 19:39   ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]   ` <875xrvhtll.fsf@>
2024-08-21 13:27     ` Eli Zaretskii
     [not found] <87a5h7hz3d.fsf@>
2024-08-20 19:04 ` Eli Zaretskii
2024-08-20 19:49   ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-21  5:20   ` Tassilo Horn
2024-08-21 13:51     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='16727.7714981296$1724168157@news.gmane.org' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=72735@debbugs.gnu.org \
    --cc=bjorn.bidar@thaodan.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).