bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Eli Zaretskii
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:20:33 +0300

> Cc: 58888@debbugs.gnu.org
> Date: Wed, 10 Apr 2024 16:34:48 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Eli, any objection to the patch below?

Any idea how many major modes out there don't use run-mode-hooks?  We
are basically breaking those with this change, right?

> Subject: [PATCH] (define-globalized-minor-mode): Require the use of
>  `run-mode-hooks`
> 
> When `define-globalized-minor-mode` was introduced (Emacs-22),
> `run-mode-hooks` was brand new, so we could not expect all major
> modes to use it and we had to rely on brittle workarounds to try
> and approximate `after-change-major-mode-hook`.
> 
> These workarounds have undesirable side effects, and they're not
> needed any more now that virtually all major modes have been
> changed to use `run-mode-hooks`.
> 
> * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
> Rely only on `after-change-major-mode-hook`.  Fixes bug#58888.

Please don't quote `like this`.  (I think you should by now have a
commit hook in your init files that replaces the quoting with our
style, because this seems to be ubiquitous in all your writings.)

> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -1658,6 +1658,12 @@ documentation and examples.
>  
>  * Incompatible Lisp Changes in Emacs 30.1
>  
> +** 'define-globalized-minor-mode' requires that modes use 'run-mode-hooks'.
> +Minor modes defined with 'define-globalized-minor-mode', such as
> +'global-font-lock-mode', don't work any more with major modes which
> +don't use 'run-mode-hooks'.  Major modes defined with
> +'define-derived-mode' are not affected.

IMO, this NEWS entry is not detailed enough.  First, it should mention
that run-mode-hooks is the modern way of running the mode's hook, a
replacement for run-hooks.  And second, it should at least hint on
what will happen with modes which don't use run-mode-hooks, so that
affected users could identify the problem when they see its signs.

Also, I think we should tell in the ELisp manual that run-mode-hooks
is now a must, not just a preference, and we should mention in the
Minor Modes chapter that the globalized minor modes will work
correctly only if the major mode uses run-mode-hooks to run its hooks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]