From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <878rkxajcs.fsf@localhost> <87cza8jwm6.fsf@localhost> <87sezv3bct.fsf@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18659"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 58888@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 11 15:54:26 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ruusk-0004g9-0u for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Apr 2024 15:54:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruusG-0007yU-3w; Thu, 11 Apr 2024 09:53:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruusE-0007y4-41 for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2024 09:53:54 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruusD-0002Ml-Ok for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2024 09:53:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ruusM-0005je-Fh for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2024 09:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Apr 2024 13:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58888 X-GNU-PR-Package: emacs Original-Received: via spool by 58888-submit@debbugs.gnu.org id=B58888.171284363522026 (code B ref 58888); Thu, 11 Apr 2024 13:54:02 +0000 Original-Received: (at 58888) by debbugs.gnu.org; 11 Apr 2024 13:53:55 +0000 Original-Received: from localhost ([127.0.0.1]:55308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruusF-0005jA-Bi for submit@debbugs.gnu.org; Thu, 11 Apr 2024 09:53:55 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:20026) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruus9-0005hl-2q; Thu, 11 Apr 2024 09:53:52 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id AF54C10005D; Thu, 11 Apr 2024 09:53:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1712843608; bh=u6oFpM4yBDm8M9ywvfbLVPc+UwObiDQWyDj3yh8s1Ks=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=SL+wET9KjrLH2pd2kmF29ItDt4OEXNkucyHxuQbRceLdZM92//0tv+D4/NXVHYKQx X3vLS3eOTsHvpa71MkdZvW9FepO/yJtRyJEuireJYc2A2EdXTu2xEtlJYMzMMPKymE U1S+oHxh4Bes81msWqJMNKcGXnTlTDhQAsr/1BYDi/f4G8bb3fiSBtTHj+C+q/TTTs kG2n41tXtpZHG5bLGB9qkLfl8jcbstzOpbS43PbMPgF4MekT0iP97z+yyu1JtiXWur RhU37p2WGGLJh4vUL7SfDKqfvZuikpdZS2YPKTICVNBCNzodgcctXDNsjgGAc/xeQT NyYa0DP75dMKw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 34AF510004A; Thu, 11 Apr 2024 09:53:28 -0400 (EDT) Original-Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0E7B9120454; Thu, 11 Apr 2024 09:53:28 -0400 (EDT) In-Reply-To: <87sezv3bct.fsf@localhost> (Ihor Radchenko's message of "Mon, 08 Apr 2024 19:25:54 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283095 Archived-At: --=-=-= Content-Type: text/plain >>> 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=easy-mmode.patch 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 () --=-=-=--