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 10:13:03 -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="7744"; 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 16:14:05 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 1ruvBk-0001pq-O8 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Apr 2024 16:14:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruvBb-0004pY-3D; Thu, 11 Apr 2024 10:13:55 -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 1ruvBZ-0004p5-4s for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2024 10:13:53 -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 1ruvBY-0006xJ-LD for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2024 10:13:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ruvBh-00030N-SS for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2024 10:14:01 -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 14:14:01 +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.171284480411271 (code B ref 58888); Thu, 11 Apr 2024 14:14:01 +0000 Original-Received: (at 58888) by debbugs.gnu.org; 11 Apr 2024 14:13:24 +0000 Original-Received: from localhost ([127.0.0.1]:57059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruvB4-0002vL-Fo for submit@debbugs.gnu.org; Thu, 11 Apr 2024 10:13:23 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:14725) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruvB2-0002uL-V8 for 58888@debbugs.gnu.org; Thu, 11 Apr 2024 10:13:21 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9C81B80C8F; Thu, 11 Apr 2024 10:13:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1712844784; bh=XwRcCDySNU2/z0/iq5NIZ/i06gh14It8Uw45Djf2ZJE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=mTCrvo5hayjgvgx+6RlM6hnHpJKexNbBk5CB7NArk1T2RNyhGPmnzzaSxjNeAgExH IbSDy2pOPGzmstQZkEahfeG4q3gAY0lZi86v8EH/708MxR/VzXOrrSH5Y530D42A3M p6+48YPVukU7LJ1FLLS5G7edlejq1Yrd/PH7UfKJ6gfiS21zu5gSBQkoJVg4j55Qpv 5P4dhO6WfEsjW3lCL5lvPzJ38t3VLVvEGVcKjyUAppQfsIZXnya9aQkZaGtbbMQlT6 JFG4FjgEteR5elpA/JHPwZENPeyG552iDsoWXH6oGrkSR5iDjRzMCqdQV/4uLt1qri V17Pp8fxYXBGw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 76CF9805F1; Thu, 11 Apr 2024 10:13:04 -0400 (EDT) Original-Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1B7B61206A7; Thu, 11 Apr 2024 10:13:04 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Thu, 11 Apr 2024 09:53:27 -0400") 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:283098 Archived-At: --=-=-= Content-Type: text/plain > 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 --=-=-= 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..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) --=-=-=--