unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Small bug-reference.el change; safe enough for emacs-29
@ 2023-02-05 18:26 Tassilo Horn
  2023-02-05 18:35 ` Small bug-reference.el change; safe enough for emacs-29? Tassilo Horn
  2023-02-05 18:42 ` Small bug-reference.el change; safe enough for emacs-29 Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Tassilo Horn @ 2023-02-05 18:26 UTC (permalink / raw)
  To: Emacs Developers

Hi Eli & all,

I'd like to apply the below patch.  It just moves the
bug-reference-auto-setup-functions init value out of the defvar and sets
it afterwards.  That's because if a package like mu4e in the concrete
case (https://github.com/djcb/mu/pull/2428) uses

  (add-hook 'bug-reference-auto-setup-functions
            #'mu4e--view-try-setup-bug-reference-mode)

to add bug-reference auto-setup for its modes *before* bug-reference
itself is loaded, the stock auto-setup functions defined by
bug-reference would not be added when bug-reference gets loaded later
on.

--8<---------------cut here---------------start------------->8---
1 file changed, 13 insertions(+), 6 deletions(-)
lisp/progmodes/bug-reference.el | 19 +++++++++++++------

modified   lisp/progmodes/bug-reference.el
@@ -599,12 +599,7 @@ bug-reference-try-setup-from-erc
      (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-rmail
-        #'bug-reference-try-setup-from-rcirc
-        #'bug-reference-try-setup-from-erc)
+(defvar bug-reference-auto-setup-functions nil
   "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
@@ -618,6 +613,18 @@ bug-reference-auto-setup-functions
 - `bug-reference-setup-from-irc-alist' for guessing based on IRC
   channel or network names.")
 
+;; Add the default auto-setup functions.  We don't have them as
+;; default value of bug-reference-auto-setup-functions because then
+;; they wouldn't be added if some package uses
+;;   (add-hook 'bug-reference-auto-setup-functions #'my-fn)
+;; before bug-reference.el is loaded.
+(dolist (fn (list #'bug-reference-try-setup-from-vc
+                  #'bug-reference-try-setup-from-gnus
+                  #'bug-reference-try-setup-from-rmail
+                  #'bug-reference-try-setup-from-rcirc
+                  #'bug-reference-try-setup-from-erc))
+  (add-hook 'bug-reference-auto-setup-functions fn))
+
 (defun bug-reference--run-auto-setup ()
   (when (or bug-reference-mode
             bug-reference-prog-mode)
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-05 19:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-05 18:26 Small bug-reference.el change; safe enough for emacs-29 Tassilo Horn
2023-02-05 18:35 ` Small bug-reference.el change; safe enough for emacs-29? Tassilo Horn
2023-02-05 18:45   ` Eli Zaretskii
2023-02-05 19:00     ` Tassilo Horn
2023-02-05 18:42 ` Small bug-reference.el change; safe enough for emacs-29 Eli Zaretskii

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).