unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: 58888@debbugs.gnu.org
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	[thread overview]
Message-ID: <jwvil0o3tdp.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87sezv3bct.fsf@localhost> (Ihor Radchenko's message of "Mon, 08 Apr 2024 19:25:54 +0000")

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: easy-mmode.patch --]
[-- Type: text/x-diff, Size: 884 bytes --]

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

  parent reply	other threads:[~2024-04-11 13:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-30  6:58 bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults Ihor Radchenko
2022-10-31  2:15 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-31  7:11   ` Ihor Radchenko
2024-04-08 12:48     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-08 13:15       ` Eli Zaretskii
2024-04-08 13:42         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-08 19:25       ` Ihor Radchenko
2024-04-10 20:34         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-11  6:20           ` Eli Zaretskii
2024-04-11 13:27             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-11 14:12               ` Eli Zaretskii
2024-04-13 14:32                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-11 13:53         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-04-11 14:13           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvil0o3tdp.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=58888@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).