[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3f7e26e2bed 1/2: (define-globalized-minor-mode): Fix bug#58888
From: |
Stefan Monnier |
Subject: |
master 3f7e26e2bed 1/2: (define-globalized-minor-mode): Fix bug#58888 |
Date: |
Sat, 13 Apr 2024 10:31:40 -0400 (EDT) |
branch: master
commit 3f7e26e2bed4ee7adab3a5d2bfa289517499e4c8
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
(define-globalized-minor-mode): Fix bug#58888
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode) <MODE-cmhh>:
Try and detect well-behaved modes so they're not affected by
those which require the cmhh hack.
---
lisp/emacs-lisp/easy-mmode.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 095bd5faa03..b09466d79fc 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -661,8 +661,12 @@ list."
;; The function that catches kill-all-local-variables.
(defun ,MODE-cmhh ()
- (add-to-list ',MODE-buffers (current-buffer))
- (add-hook 'post-command-hook #',MODE-check-buffers))
+ ;; If `delay-mode-hooks' is set, it indicates that the current
+ ;; buffer's mode will run `run-mode-hooks' afterwards anyway,
+ ;; so we don't need to keep this buffer in MODE-buffers.
+ (unless delay-mode-hooks
+ (add-to-list ',MODE-buffers (current-buffer))
+ (add-hook 'post-command-hook #',MODE-check-buffers)))
(put ',MODE-cmhh 'definition-name ',global-mode))))
(defun easy-mmode--globalized-predicate-p (predicate)