[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master de61b0b: Refactor bug-reference setup functions into a defvar
From: |
Tassilo Horn |
Subject: |
master de61b0b: Refactor bug-reference setup functions into a defvar |
Date: |
Sat, 15 May 2021 15:23:13 -0400 (EDT) |
branch: master
commit de61b0b25f0ff47e6da1c86da04b37bc61f963df
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>
Refactor bug-reference setup functions into a defvar
* lisp/progmodes/bug-reference.el
(bug-reference-auto-setup-functions): New defvar so that other
packages can add their own auto-setup functions to it.
* lisp/progmodes/bug-reference.el (bug-reference--run-auto-setup): Use
the new variable instead of hard-coding the 4 functions we've had
already.
---
lisp/progmodes/bug-reference.el | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index 0c5837c..81aeb60 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -420,6 +420,24 @@ and set it if applicable."
(erc-format-target)
(erc-network-name))))
+(defvar bug-reference-auto-setup-functions
+ (list #'bug-reference-try-setup-from-vc
+ #'bug-reference-try-setup-from-gnus
+ #'bug-reference-try-setup-from-rcirc
+ #'bug-reference-try-setup-from-erc)
+ "Functions trying to auto-setup `bug-reference-mode'.
+These functions are run after `bug-reference-mode' has been
+activated in a buffer and try to guess suitable values for
+`bug-reference-bug-regexp' and `bug-reference-url-format'. Their
+guesswork is based on these variables:
+
+- `bug-reference-setup-from-vc-alist' for guessing based on
+ version control, e.g., URL of repository.
+- `bug-reference-setup-from-mail-alist' for guessing based on
+ mail group names or mail header values.
+- `bug-reference-setup-from-irc-alist' for guessing based on IRC
+ channel or network names.")
+
(defun bug-reference--run-auto-setup ()
(when (or bug-reference-mode
bug-reference-prog-mode)
@@ -430,10 +448,7 @@ and set it if applicable."
(with-demoted-errors
"Error during bug-reference auto-setup: %S"
(catch 'setup
- (dolist (f (list #'bug-reference-try-setup-from-vc
- #'bug-reference-try-setup-from-gnus
- #'bug-reference-try-setup-from-rcirc
- #'bug-reference-try-setup-from-erc))
+ (dolist (f bug-reference-auto-setup-functions)
(when (funcall f)
(throw 'setup t))))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master de61b0b: Refactor bug-reference setup functions into a defvar,
Tassilo Horn <=