[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 09:53:27 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>>> I tried the patch via make extraclean; make bootstrap
>>> I can still reproduce the original recipe.
>> I pushed that patch to m`aster` because it fixed other cases
>> (e.g. bug#69431) but I think to fix bug#58888 we need the next step,
>> which is the patch below.
>> Can you confirm that it fixes it for you as well?
> Yes, after make bootstrap, I am no longer able to reproduce the recipe.
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.
If we don't go for the complete removal of the hacks to support modes
that don't use `run-mode-hooks`, maybe we should try and arrange to
missing calls to `run-mode-hooks` and emit warnings accordingly.
Stefan
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 095bd5faa03..580cc0115cf 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -651,7 +651,12 @@ define-globalized-minor-mode
(dolist (buf buffers)
(when (buffer-live-p buf)
(with-current-buffer buf
- (,MODE-enable-in-buffer))))))
+ ;; If `delay-mode-hooks' is set, it indicates that
+ ;; the current buffer's mode is not fully setup yet,
+ ;; and also that `run-mode-hooks' will be run afterwards
+ ;; anyway, so we don't need to keep BUF in MODE-buffers.
+ (unless delay-mode-hooks
+ (,MODE-enable-in-buffer)))))))
(put ',MODE-enable-in-buffers 'definition-name ',global-mode)
(defun ,MODE-check-buffers ()
bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults,
Stefan Monnier <=