(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.
This commit is contained in:
Stefan Monnier 2024-04-13 10:10:19 -04:00
parent d67e08d6c3
commit 3f7e26e2be

View file

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