[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-var
From: |
Stefan Monnier |
Subject: |
bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults |
Date: |
Thu, 11 Apr 2024 10:13:03 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> A more tepid solution might be the patch below: the problem will still
> bite those modes defined by hand (as opposed to using
> `define-derived-mode`), but it should be sufficient for the most
> important cases.
The version below is a bit better.
Stefan
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 095bd5faa03..015ab1d3f84 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -661,8 +661,12 @@ define-globalized-minor-mode
;; 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 BUF 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)