Received: (at 58888) by debbugs.gnu.org; 11 Apr 2024 13:53:55 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 11 09:53:55 2024 Received: from localhost ([127.0.0.1]:55308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ruusF-0005jA-Bi for submit <at> debbugs.gnu.org; Thu, 11 Apr 2024 09:53:55 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:20026) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1ruus9-0005hl-2q; Thu, 11 Apr 2024 09:53:52 -0400 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== 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) 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) From: Stefan Monnier <monnier@HIDDEN> To: Ihor Radchenko <yantar92@HIDDEN> Subject: Re: bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults In-Reply-To: <87sezv3bct.fsf@localhost> (Ihor Radchenko's message of "Mon, 08 Apr 2024 19:25:54 +0000") Message-ID: <jwvil0o3tdp.fsf-monnier+emacs@HIDDEN> References: <878rkxajcs.fsf@localhost> <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> <87cza8jwm6.fsf@localhost> <jwv7ch8dp2h.fsf-monnier+emacs@HIDDEN> <87sezv3bct.fsf@localhost> Date: Thu, 11 Apr 2024 09:53:27 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.009 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58888 Cc: 58888 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= 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 () --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.Received: (at 58888) by debbugs.gnu.org; 11 Apr 2024 13:28:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 11 09:28:08 2024 Received: from localhost ([127.0.0.1]:55295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ruuTH-0002LB-3v for submit <at> debbugs.gnu.org; Thu, 11 Apr 2024 09:28:08 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1ruuTC-0002K0-MD for 58888 <at> debbugs.gnu.org; Thu, 11 Apr 2024 09:28:04 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 60A0A441EDC; Thu, 11 Apr 2024 09:27:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1712842065; bh=R0oSmoW20cr7lWF9OdMEHYO+5SFGq/1CBKCQmXzAZ+4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=F0i6Nd2OnUs4xxT7qluCWLkHD0h8qFmh+MNzMjOHQGlAVpRpoAHRi0UTDhNS9n9dh /FwmECT9CmknO1lxQQ0nvqZ1FOznqe6WYdtdvOlVzPrkySuypYSHZIQF0LK+ImN2zX 90njN6/WcUKvenMEtYz/cA7N7QF/xY2jCz2EqRU9BLbcz9y/mcCRpeS+m3FpR6Vwfi Gm2hmCikgVDMqUcHxlUv3Q+YvAqNRRMVxDp8hP68aPBbF4D2BrhQvNsCe/2AuaHEjJ KiaiT/qcu8Fr88vwUukNe5sa1Od3G1jz34gvyFblLArevW9YZiT9rJxwsRL8O2r/N1 hQThyzOV+Plfw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C0FC7441D20; Thu, 11 Apr 2024 09:27:45 -0400 (EDT) Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9A2BE1201F4; Thu, 11 Apr 2024 09:27:45 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults In-Reply-To: <868r1kv2ry.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 11 Apr 2024 09:20:33 +0300") Message-ID: <jwvttk83w2m.fsf-monnier+emacs@HIDDEN> References: <878rkxajcs.fsf@localhost> <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> <87cza8jwm6.fsf@localhost> <jwv7ch8dp2h.fsf-monnier+emacs@HIDDEN> <87sezv3bct.fsf@localhost> <jwv5xwp6jpm.fsf-monnier+emacs@HIDDEN> <868r1kv2ry.fsf@HIDDEN> Date: Thu, 11 Apr 2024 09:27:44 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.022 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58888 Cc: yantar92@HIDDEN, 58888 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Any idea how many major modes out there don't use run-mode-hooks? Hard to tell. I did a quick grep '^[^;]*kill-all-local-variables' $(grep -L run-mode-hooks **/*.el) in our own code, and it shows a fairly large number of occurrences, but once you look at them it's not clear what to make of them. Many of them don't bother to define an actual mode for the buffer, they just call `kill-all-local-variables` then fill the buffer somehow, occasionally do some major-mode-like setup such as `use-local-map`, and finally display the result to the user. > We are basically breaking those with this change, right? Yes. More specifically the minor modes defined with `define-globalized-minor-mode` will stay inactive in them. > 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.) I do my best to follow the ugly `...' convention in ELisp file and the '...' convention in our other files, but not for anything else. I strongly prefer the Markdown convention over '...' because it's a convention enshrined in many tools. I could live with the Org convention if you prefer, but I strongly feel that we should use notational conventions that tools are able to use. > 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. I'll get back to this once we decide we do want the change. Stefan
bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.Received: (at 58888) by debbugs.gnu.org; 11 Apr 2024 06:21:01 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 11 02:21:00 2024 Received: from localhost ([127.0.0.1]:54768 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1runnw-0004Aw-74 for submit <at> debbugs.gnu.org; Thu, 11 Apr 2024 02:21:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1runnu-00049z-Io for 58888 <at> debbugs.gnu.org; Thu, 11 Apr 2024 02:20:59 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1runne-0004Jn-T4; Thu, 11 Apr 2024 02:20:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=KxiQJT/1rvO9JNuy+MTZk1Dx9nHymCHFYmeBojFN28s=; b=eIXy0JnFOdjS rA4ur93qey5rvtC4qugcitFPy8EgwWnzc5eBLmDQqpeDL76hgieNCaeozXo92LNSYxeuHqaf2f9Tj GVQDznZQ9DWsoq4lkOjxEoRKiKAd0JDV6lfuW4yZLxk5+RwnQUdB4xDwf14X++WwO5bB5Eqyg3xB/ pLnDdczgNR6TV5NY4NXaVKt4MMEMW+5brFWkxjDvyU3th5xAg1bp21vf4uxK8mHSG/inU6Vva1bgV FNjaSjZ+yowcb3MS16lnmPXxZA6FeuC2DFbTqvIoUA+Qgd4OufKZfvxuR6zV6ZJ1t2fJrgvbBoocU 1ev7QlhNhEyOG7kxIjivrg==; Date: Thu, 11 Apr 2024 09:20:33 +0300 Message-Id: <868r1kv2ry.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> In-Reply-To: <jwv5xwp6jpm.fsf-monnier+emacs@HIDDEN> (bug-gnu-emacs@HIDDEN) Subject: Re: bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults References: <878rkxajcs.fsf@localhost> <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> <87cza8jwm6.fsf@localhost> <jwv7ch8dp2h.fsf-monnier+emacs@HIDDEN> <87sezv3bct.fsf@localhost> <jwv5xwp6jpm.fsf-monnier+emacs@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58888 Cc: yantar92@HIDDEN, 58888 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Cc: 58888 <at> 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@HIDDEN> > > 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.
bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.Received: (at 58888) by debbugs.gnu.org; 10 Apr 2024 20:37:48 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 10 16:37:48 2024 Received: from localhost ([127.0.0.1]:54425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ruehW-0002Ed-P3 for submit <at> debbugs.gnu.org; Wed, 10 Apr 2024 16:37:48 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:41270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1ruehT-0002D1-3g for 58888 <at> debbugs.gnu.org; Wed, 10 Apr 2024 16:37:44 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 233B98093D; Wed, 10 Apr 2024 16:37:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1712781446; bh=XiW4JZdmcaHAltDzHnpjZVk6Avx1VtnWAZm0z3xHgAs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=NlFiDhvnP1BinhjjxIKtTF5odPZXiImO46i0qFqNsgGAqKvpQ7KFJzu280oU8XgWD eT7QcPj3svHg3u80z3TGgFlRm4nEMpGWFL2v+RU08A/LSwIsAdCYPn8WcsR3ZFoByB 2FjqV5g6uer6+LVW6ljbEaiOJhwMCP/fENUWWa66c4ekL11TD1VDEROTpUkTCN+0Ho N7XM2d+ewB0QU7lFREoPuU9NHLM+7bUEccMJvGx4nB5ojrw/5NnYgEBtY/xHKN//7h 5o1JXAmCEB9+zhxiLYrRvjZ/fRZ+LHWj/XzcvbCX0QD4tE/NqmAVA26UP/8atzDI05 dUtmGgYETecew== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id B2D3E8001C; Wed, 10 Apr 2024 16:37:26 -0400 (EDT) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 941771206AA; Wed, 10 Apr 2024 16:37:26 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Ihor Radchenko <yantar92@HIDDEN> Subject: Re: bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults In-Reply-To: <87sezv3bct.fsf@localhost> (Ihor Radchenko's message of "Mon, 08 Apr 2024 19:25:54 +0000") Message-ID: <jwv5xwp6jpm.fsf-monnier+emacs@HIDDEN> References: <878rkxajcs.fsf@localhost> <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> <87cza8jwm6.fsf@localhost> <jwv7ch8dp2h.fsf-monnier+emacs@HIDDEN> <87sezv3bct.fsf@localhost> Date: Wed, 10 Apr 2024 16:34:48 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.164 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58888 Cc: 58888 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain >> 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. Thanks for confirming. Eli, any objection to the patch below? Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-define-globalized-minor-mode-Require-the-use-of-run-.patch From 4fd9a51b4d9f2e2e0c04341eeabb656884059301 Mon Sep 17 00:00:00 2001 From: Stefan Monnier <monnier@HIDDEN> Date: Wed, 10 Apr 2024 16:31:58 -0400 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. --- etc/NEWS | 6 ++++ lisp/emacs-lisp/easy-mmode.el | 58 +++-------------------------------- 2 files changed, 10 insertions(+), 54 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index a2a3fe494cb..0da59201e55 100644 --- 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. + --- ** Old derived.el functions removed. The following functions have been deleted because they were only used diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 095bd5faa03..eaad9646985 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -495,11 +495,6 @@ define-globalized-minor-mode (MODE-buffers (intern (concat global-mode-name "-buffers"))) (MODE-enable-in-buffer (intern (concat global-mode-name "-enable-in-buffer"))) - (MODE-enable-in-buffers - (intern (concat global-mode-name "-enable-in-buffers"))) - (MODE-check-buffers - (intern (concat global-mode-name "-check-buffers"))) - (MODE-cmhh (intern (concat global-mode-name "-cmhh"))) (minor-MODE-hook (intern (concat mode-name "-hook"))) (MODE-set-explicitly (intern (concat mode-name "-set-explicitly"))) (MODE-major-mode (intern (concat (symbol-name mode) "-major-mode"))) @@ -559,14 +554,9 @@ define-globalized-minor-mode ;; Setup hook to handle future mode changes and new buffers. (if ,global-mode - (progn - (add-hook 'after-change-major-mode-hook - #',MODE-enable-in-buffer) - (add-hook 'find-file-hook #',MODE-check-buffers) - (add-hook 'change-major-mode-hook #',MODE-cmhh)) - (remove-hook 'after-change-major-mode-hook #',MODE-enable-in-buffer) - (remove-hook 'find-file-hook #',MODE-check-buffers) - (remove-hook 'change-major-mode-hook #',MODE-cmhh)) + (add-hook 'after-change-major-mode-hook + #',MODE-enable-in-buffer) + (remove-hook 'after-change-major-mode-hook #',MODE-enable-in-buffer)) ;; Go through existing buffers. (dolist (buf (buffer-list)) @@ -623,47 +613,7 @@ define-globalized-minor-mode (funcall ,turn-on-function)) (funcall ,turn-on-function)))) (setq ,MODE-major-mode major-mode)) - (put ',MODE-enable-in-buffer 'definition-name ',global-mode) - - ;; In the normal case, major modes run `after-change-major-mode-hook' - ;; which will have called `MODE-enable-in-buffer' for us. But some - ;; major modes don't use `run-mode-hooks' (customarily used via - ;; `define-derived-mode') and thus fail to run - ;; `after-change-major-mode-hook'. - ;; The functions below try to handle those major modes, with - ;; a combination of ugly hacks to try and catch those corner - ;; cases by listening to `change-major-mode-hook' to discover - ;; potential candidates and then checking in `post-command-hook' - ;; and `find-file-hook' if some of those still haven't run - ;; `after-change-major-mode-hook'. FIXME: We should try and get - ;; rid of this ugly hack and rely purely on - ;; `after-change-major-mode-hook' because they can (and do) end - ;; up running `MODE-enable-in-buffer' too early (when the major - ;; isn't yet fully setup) in some cases (see bug#58888). - - ;; The function that calls TURN-ON in each buffer. - (defun ,MODE-enable-in-buffers () - (let ((buffers ,MODE-buffers)) - ;; Clear MODE-buffers to avoid scanning the same list of - ;; buffers in recursive calls to MODE-enable-in-buffers. - ;; Otherwise it could lead to infinite recursion. - (setq ,MODE-buffers nil) - (dolist (buf buffers) - (when (buffer-live-p buf) - (with-current-buffer buf - (,MODE-enable-in-buffer)))))) - (put ',MODE-enable-in-buffers 'definition-name ',global-mode) - - (defun ,MODE-check-buffers () - (,MODE-enable-in-buffers) - (remove-hook 'post-command-hook #',MODE-check-buffers)) - (put ',MODE-check-buffers 'definition-name ',global-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)) - (put ',MODE-cmhh 'definition-name ',global-mode)))) + (put ',MODE-enable-in-buffer 'definition-name ',global-mode)))) (defun easy-mmode--globalized-predicate-p (predicate) (cond -- 2.43.0 --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.Received: (at 58888) by debbugs.gnu.org; 8 Apr 2024 19:26:05 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 08 15:26:04 2024 Received: from localhost ([127.0.0.1]:47730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rtud2-0000Nb-KK for submit <at> debbugs.gnu.org; Mon, 08 Apr 2024 15:26:04 -0400 Received: from mout01.posteo.de ([185.67.36.65]:50993) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <yantar92@HIDDEN>) id 1rtucx-0000MX-Dm for 58888 <at> debbugs.gnu.org; Mon, 08 Apr 2024 15:26:02 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 68D53240027 for <58888 <at> debbugs.gnu.org>; Mon, 8 Apr 2024 21:25:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1712604345; bh=co5Em0IED7c2bjkzBFZ0T/Wj2jAVucqZUXCG2drIOHo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=mDkXl8cT+Vt8opiqt58ms7mAi08IbBPczy5wzeitZYmQ8C2CF1HE8Om0eTtKDCuuJ uTHlMQLLCd8PZ9zlKJ7E13s4xZMhAd8JEguTQzvl0QRXiq0AsIoSIQQZyRvd5Jb4ub GTtRRTVYfAcXy37nPWaEe9hBAudPA0+4D2iQKixVkVarAo9otQ1+SUZH2m/VXdgXBF pq5sJ3n9m8x5dc8aamGrCty6dXsR6Z8tQ8lCtugNniVNZIVingqZ6GYPEsORYDRFLc rNvZjzqEB+CkKf9tDba6ZvZJiQio87xIwCo2yKCSNSQs7KB79M1YazqawgvxXXAsYi 8KG91NeNbgRUg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VCzZw2hwjz6txT; Mon, 8 Apr 2024 21:25:43 +0200 (CEST) From: Ihor Radchenko <yantar92@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> Subject: Re: bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults In-Reply-To: <jwv7ch8dp2h.fsf-monnier+emacs@HIDDEN> References: <878rkxajcs.fsf@localhost> <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> <87cza8jwm6.fsf@localhost> <jwv7ch8dp2h.fsf-monnier+emacs@HIDDEN> Date: Mon, 08 Apr 2024 19:25:54 +0000 Message-ID: <87sezv3bct.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58888 Cc: 58888 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Stefan Monnier <monnier@HIDDEN> writes: >> 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. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.Received: (at 58888) by debbugs.gnu.org; 8 Apr 2024 13:42:54 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 08 09:42:54 2024 Received: from localhost ([127.0.0.1]:45608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rtpGv-0004eh-R8 for submit <at> debbugs.gnu.org; Mon, 08 Apr 2024 09:42:54 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1rtpGt-0004dp-0j for 58888 <at> debbugs.gnu.org; Mon, 08 Apr 2024 09:42:51 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D162D1000DD; Mon, 8 Apr 2024 09:42:37 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1712583752; bh=d6PntUjLwiOI7msIv8j6QraQIRlqwfuiuH7+Ee5D4rQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ZAGG6godic4GL+LBH2SFChpMKq9yO21lZBydG5y1bJhMuDj+tByTrSQUYm8szP60c waVJEBkHQdcrnZULx8OUwKMtbFOunKZ8T3ZRJyoOqAKihSKrhiFDZhuSF5hmXpY1np 4QASdplkhwI/hQ2zM3apruOVVsvfKP4dUJx9AXdo4c7BG1u3T0EqJjcYvzRCW6HFL+ UcD/8M9HChciFbUgABTMbL+Vl00WATC8184JtjIS1ABOqPBC7vgKqMLz5NIXbATk8Y fpdAVvsN+ePwfF0edG8+wIHHfdUmgp3RE6sXupp8CxUg/hE+rx4jgaKIzKaw9qyTJ/ oIIcDN7XBTODw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 98D88100048; Mon, 8 Apr 2024 09:42:32 -0400 (EDT) Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7016912059E; Mon, 8 Apr 2024 09:42:32 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults In-Reply-To: <86ttkcxafm.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 08 Apr 2024 16:15:25 +0300") Message-ID: <jwvv84sc6qi.fsf-monnier+emacs@HIDDEN> References: <878rkxajcs.fsf@localhost> <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> <87cza8jwm6.fsf@localhost> <jwv7ch8dp2h.fsf-monnier+emacs@HIDDEN> <86ttkcxafm.fsf@HIDDEN> Date: Mon, 08 Apr 2024 09:42:31 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.018 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58888 Cc: yantar92@HIDDEN, 58888 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain >> 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. > > ENOPATCH [ Hmm... not sure how I managed to make that empty file. I'll put this in the "creativity" column. ] I think this one isn't empty, 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..eaad9646985 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -495,11 +495,6 @@ define-globalized-minor-mode (MODE-buffers (intern (concat global-mode-name "-buffers"))) (MODE-enable-in-buffer (intern (concat global-mode-name "-enable-in-buffer"))) - (MODE-enable-in-buffers - (intern (concat global-mode-name "-enable-in-buffers"))) - (MODE-check-buffers - (intern (concat global-mode-name "-check-buffers"))) - (MODE-cmhh (intern (concat global-mode-name "-cmhh"))) (minor-MODE-hook (intern (concat mode-name "-hook"))) (MODE-set-explicitly (intern (concat mode-name "-set-explicitly"))) (MODE-major-mode (intern (concat (symbol-name mode) "-major-mode"))) @@ -559,14 +554,9 @@ define-globalized-minor-mode ;; Setup hook to handle future mode changes and new buffers. (if ,global-mode - (progn - (add-hook 'after-change-major-mode-hook - #',MODE-enable-in-buffer) - (add-hook 'find-file-hook #',MODE-check-buffers) - (add-hook 'change-major-mode-hook #',MODE-cmhh)) - (remove-hook 'after-change-major-mode-hook #',MODE-enable-in-buffer) - (remove-hook 'find-file-hook #',MODE-check-buffers) - (remove-hook 'change-major-mode-hook #',MODE-cmhh)) + (add-hook 'after-change-major-mode-hook + #',MODE-enable-in-buffer) + (remove-hook 'after-change-major-mode-hook #',MODE-enable-in-buffer)) ;; Go through existing buffers. (dolist (buf (buffer-list)) @@ -623,47 +613,7 @@ define-globalized-minor-mode (funcall ,turn-on-function)) (funcall ,turn-on-function)))) (setq ,MODE-major-mode major-mode)) - (put ',MODE-enable-in-buffer 'definition-name ',global-mode) - - ;; In the normal case, major modes run `after-change-major-mode-hook' - ;; which will have called `MODE-enable-in-buffer' for us. But some - ;; major modes don't use `run-mode-hooks' (customarily used via - ;; `define-derived-mode') and thus fail to run - ;; `after-change-major-mode-hook'. - ;; The functions below try to handle those major modes, with - ;; a combination of ugly hacks to try and catch those corner - ;; cases by listening to `change-major-mode-hook' to discover - ;; potential candidates and then checking in `post-command-hook' - ;; and `find-file-hook' if some of those still haven't run - ;; `after-change-major-mode-hook'. FIXME: We should try and get - ;; rid of this ugly hack and rely purely on - ;; `after-change-major-mode-hook' because they can (and do) end - ;; up running `MODE-enable-in-buffer' too early (when the major - ;; isn't yet fully setup) in some cases (see bug#58888). - - ;; The function that calls TURN-ON in each buffer. - (defun ,MODE-enable-in-buffers () - (let ((buffers ,MODE-buffers)) - ;; Clear MODE-buffers to avoid scanning the same list of - ;; buffers in recursive calls to MODE-enable-in-buffers. - ;; Otherwise it could lead to infinite recursion. - (setq ,MODE-buffers nil) - (dolist (buf buffers) - (when (buffer-live-p buf) - (with-current-buffer buf - (,MODE-enable-in-buffer)))))) - (put ',MODE-enable-in-buffers 'definition-name ',global-mode) - - (defun ,MODE-check-buffers () - (,MODE-enable-in-buffers) - (remove-hook 'post-command-hook #',MODE-check-buffers)) - (put ',MODE-check-buffers 'definition-name ',global-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)) - (put ',MODE-cmhh 'definition-name ',global-mode)))) + (put ',MODE-enable-in-buffer 'definition-name ',global-mode)))) (defun easy-mmode--globalized-predicate-p (predicate) (cond --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.Received: (at 58888) by debbugs.gnu.org; 8 Apr 2024 13:16:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 08 09:16:07 2024 Received: from localhost ([127.0.0.1]:45584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rtor1-0002aJ-3l for submit <at> debbugs.gnu.org; Mon, 08 Apr 2024 09:16:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1rtoqv-0002Zh-Oa for 58888 <at> debbugs.gnu.org; Mon, 08 Apr 2024 09:16:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1rtoqi-0000p2-MP; Mon, 08 Apr 2024 09:15:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=QrJqVWtV+8IlbXacS2OOxyIHSjuIDdYprdhirVn7cWw=; b=YcZwvcu3a7Gj hvHbk3aajYMZEhar7zW7u0CAIXYFCcfKoYNbhRkHHqelXjIKlywjbFZ/ZfJeSKPjwugNuHc9SeqbN xh1bpxTfk2P8K3BIW6reVdsBrUoSTp7iYmuMLe6oddCo6wVwxv+DScvLr/oU8FQMyukFLLc30xN7k N5kC+jcYQWZIQor0SS7knwn7KvUgXR4ZEaMNasJlM7pHOT0jS+7R8hNbuiEE0J3IEF/Aw5bEam3uy jKVv396O/vh1iknyiXMEXBynuMGyD6MWQzrlWhSvAxN5aoNoPd7XWMkEWCA+OPsz0yBScTL36D/NG 3b0oRmw2GjCA4GunmSmlhA==; Date: Mon, 08 Apr 2024 16:15:25 +0300 Message-Id: <86ttkcxafm.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> In-Reply-To: <jwv7ch8dp2h.fsf-monnier+emacs@HIDDEN> (bug-gnu-emacs@HIDDEN) Subject: Re: bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults References: <878rkxajcs.fsf@localhost> <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> <87cza8jwm6.fsf@localhost> <jwv7ch8dp2h.fsf-monnier+emacs@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58888 Cc: yantar92@HIDDEN, 58888 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Cc: 58888 <at> debbugs.gnu.org > Date: Mon, 08 Apr 2024 08:48:36 -0400 > From: Stefan Monnier via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> > > 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. ENOPATCH
bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.Received: (at 58888) by debbugs.gnu.org; 8 Apr 2024 12:48:58 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 08 08:48:57 2024 Received: from localhost ([127.0.0.1]:45551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rtoQi-0000WL-H4 for submit <at> debbugs.gnu.org; Mon, 08 Apr 2024 08:48:57 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:23911) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1rtoQe-0000Uk-L5 for 58888 <at> debbugs.gnu.org; Mon, 08 Apr 2024 08:48:54 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B16DA1000DD; Mon, 8 Apr 2024 08:48:38 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1712580517; bh=C3TxZqzEU60FAAQtrJw+ZIeok4RhuGm0W2Q3vRmXIMQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Bzd6UIl6hMozI9y6Pqd1WmgDfRVR3sc+fyNCNRpNcHO5zq0+7Trd2rxc7FvrTR4G/ ZXPYLLpTvNiFKkOctjTV6UtR8KOAGUf3yu8da9jePFGWEDdBepuV+3VZKj+x0JBqXU VuD0d/JU1ACQMPTlwnaR1jVP/Qx0NEzOGKSie0NBL7GrN432bBRUZpPp66KTHET/57 XpoDl0Bzdymr/lUWmL61IVCMpDyYtSBX0khI2ZXSrL4n0/UwCnTzSu7vrJcQQ+vTwr fabqz3MwgdvPYAeq8a6KOK1di4bMWNxgwu6n6kNl8y5dmIJ9N7TXH+t/3tdhw6/uBA S4WeXcaIxy+Bg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 9C79E100046; Mon, 8 Apr 2024 08:48:37 -0400 (EDT) Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7725A120484; Mon, 8 Apr 2024 08:48:37 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Ihor Radchenko <yantar92@HIDDEN> Subject: Re: bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults In-Reply-To: <87cza8jwm6.fsf@localhost> (Ihor Radchenko's message of "Mon, 31 Oct 2022 07:11:29 +0000") Message-ID: <jwv7ch8dp2h.fsf-monnier+emacs@HIDDEN> References: <878rkxajcs.fsf@localhost> <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> <87cza8jwm6.fsf@localhost> Date: Mon, 08 Apr 2024 08:48:36 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.018 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58888 Cc: 58888 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain >> Hmm... AFAICT the problem here is that the implementation of >> `global-font-lock-mode` ends up trying to enable `font-lock-mode` in >> that file's buffer during execution of the >> `after-major-mode-change-hook` of *another* buffer while querying >> whether to obey those file-local settings, and then fails to try again >> when the hook is run in the desired buffer. >> >> I suspect the patch below might help (requires recompiling >> `font-core.el` and re-dumping Emacs), but as the comment in there >> explains it might not always be sufficient either. > > 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? It will remove support for globalized minor modes in those few remaining major modes which don't use `run-mode-hooks`. `run-mode-hooks` was introduced in Emacs-22 and for many years it was really important to support modes which don't use it, but nowadays those modes are vanishingly rare and really should get fixed, so I think it's time to get rid of those ugly hacks. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=easy-mmode.patch --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.Received: (at 58888) by debbugs.gnu.org; 31 Oct 2022 07:11:09 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 03:11:09 2022 Received: from localhost ([127.0.0.1]:39385 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1opOwt-0006fJ-6D for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 03:11:09 -0400 Received: from mout01.posteo.de ([185.67.36.65]:48035) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <yantar92@HIDDEN>) id 1opOwo-0006eW-8P for 58888 <at> debbugs.gnu.org; Mon, 31 Oct 2022 03:11:05 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 3D039240029 for <58888 <at> debbugs.gnu.org>; Mon, 31 Oct 2022 08:10:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667200256; bh=pb/T/suAj2o/1x4y+siElJgDDcsgI9sLwzazWJtxHeA=; h=From:To:Cc:Subject:Date:From; b=qJVkTqoXk49MaB4xUa7pwhJ8rOKIaewhmZgM/kJ/dEaXXRcG8M0vBK5OmEzmVqwR5 ngZT9TxfouiXPthmawiKkR7aiukW6QyhpU9sK3mve2WUh5SqsUmB6reYzEJbZtS0Hf HC5hSwYS7DcvaCDKmG7Nzvkk0Te2ofVWmftkUcONbWkEsgVDGnV4MpqDrMG/L6gy87 8YRv2qRYL25e52SOI8o3AXonFnGNt+K6xqw6ezDW7VpGC9pE0/BmkGz9O1m6MB6D2S 3eNB+KMjfWv7+1exP3395QpbIUOE1V0oRm4oeLuW/tSBBndlqCDMwMo5pN+7lTLv7i Ys7OMGSEjD8ow== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N147G5s1hz6tpY; Mon, 31 Oct 2022 08:10:50 +0100 (CET) From: Ihor Radchenko <yantar92@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> Subject: Re: bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults In-Reply-To: <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> References: <878rkxajcs.fsf@localhost> <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> Date: Mon, 31 Oct 2022 07:11:29 +0000 Message-ID: <87cza8jwm6.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58888 Cc: 58888 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Stefan Monnier <monnier@HIDDEN> writes: > Hmm... AFAICT the problem here is that the implementation of > `global-font-lock-mode` ends up trying to enable `font-lock-mode` in > that file's buffer during execution of the > `after-major-mode-change-hook` of *another* buffer while querying > whether to obey those file-local settings, and then fails to try again > when the hook is run in the desired buffer. > > I suspect the patch below might help (requires recompiling > `font-core.el` and re-dumping Emacs), but as the comment in there > explains it might not always be sufficient either. I tried the patch via make extraclean; make bootstrap I can still reproduce the original recipe. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.Received: (at 58888) by debbugs.gnu.org; 31 Oct 2022 02:16:02 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 30 22:16:02 2022 Received: from localhost ([127.0.0.1]:39300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1opKLJ-0007Ns-M0 for submit <at> debbugs.gnu.org; Sun, 30 Oct 2022 22:16:02 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1opKLG-0007NZ-W3 for 58888 <at> debbugs.gnu.org; Sun, 30 Oct 2022 22:15:59 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 03A2C100189; Sun, 30 Oct 2022 22:15:53 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C117E10000D; Sun, 30 Oct 2022 22:15:50 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1667182550; bh=V26k14DRnVJS8sRupiWNCb6wTuByWyz6CLFz82tHJdo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=mM1IFdeO9xvf/PV9w4rM/3ER8bwZxJNjIoiXUB9V8yOacOLvkYfixr8eXtOV5SoIE 9si0ri6bLmHAfFxn7rJkkr/U8/CbKITA1+eWGznJyA2B0tFNUXy1FJDI9uBrhTJfJQ 7Go5pDhddcBC+X4juNv7Mqg6sDx65afEvw905fBpRyfRPhmpDXs4fp/2nQScStOJZn Jd9QhsA4+5xoXb+fWGDw/0JNJgT3IwDseeqtE395pH99huMt52W8Fp5kZ3aMWYxuBT dfH4NSdmEKFWokchchGOwlBCS2TpKRUkc7RkYAYvdrv128I008aJ4zqHXLB+20HElk OW/wnFp30D8uw== Received: from milanesa (65-110-220-202.cpe.pppoe.ca [65.110.220.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 51AA2120172; Sun, 30 Oct 2022 22:15:50 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Ihor Radchenko <yantar92@HIDDEN> Subject: Re: bug#58888: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults In-Reply-To: <878rkxajcs.fsf@localhost> (Ihor Radchenko's message of "Sun, 30 Oct 2022 06:58:11 +0000") Message-ID: <jwv8rkw216e.fsf-monnier+emacs@HIDDEN> References: <878rkxajcs.fsf@localhost> Date: Sun, 30 Oct 2022 22:15:40 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.059 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 58888 Cc: 58888 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain > ------------ > # -*- mode:my/test -*- > This is test with keyword to be fontified. > > # Local Variables: > # eval: (setq unsafe-variable t) > # End: > ------------- > > Then, consider the following major mode: > > (define-derived-mode my/test-mode text-mode "Test" > "" > (add-hook 'hack-local-variables-hook > (lambda () > (setq-local my/test-mode-keywords '(("keyword" . font-lock-keyword-face))) > (setq font-lock-defaults '(my/test-mode-keywords))) > nil 'local)) > > 1. emacs -Q > 2. Evaluate the major mode definition > 3. Open the file > 4. Answer "y" in the unsafe variable prompt > 5. Observe "keyword" not being fontified. > 6. Expected: "keyword" fontified using font-lock-keyword-face. Hmm... AFAICT the problem here is that the implementation of `global-font-lock-mode` ends up trying to enable `font-lock-mode` in that file's buffer during execution of the `after-major-mode-change-hook` of *another* buffer while querying whether to obey those file-local settings, and then fails to try again when the hook is run in the desired buffer. I suspect the patch below might help (requires recompiling `font-core.el` and re-dumping Emacs), but as the comment in there explains it might not always be sufficient either. Hmm... 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 7d54a84687b..4d2174fbe6a 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -485,6 +485,8 @@ define-globalized-minor-mode (extra-keywords nil) (MODE-variable mode) (MODE-buffers (intern (concat global-mode-name "-buffers"))) + (MODE-enable-in-buffer + (intern (concat global-mode-name "-enable-in-buffer"))) (MODE-enable-in-buffers (intern (concat global-mode-name "-enable-in-buffers"))) (MODE-check-buffers @@ -551,10 +553,10 @@ define-globalized-minor-mode (if ,global-mode (progn (add-hook 'after-change-major-mode-hook - #',MODE-enable-in-buffers) + #',MODE-enable-in-buffer) (add-hook 'find-file-hook #',MODE-check-buffers) (add-hook 'change-major-mode-hook #',MODE-cmhh)) - (remove-hook 'after-change-major-mode-hook #',MODE-enable-in-buffers) + (remove-hook 'after-change-major-mode-hook #',MODE-enable-in-buffer) (remove-hook 'find-file-hook #',MODE-check-buffers) (remove-hook 'change-major-mode-hook #',MODE-cmhh)) @@ -601,7 +603,32 @@ define-globalized-minor-mode ;; List of buffers left to process. (defvar ,MODE-buffers nil) - ;; The function that calls TURN-ON in each buffer. + ;; The function that calls TURN-ON in the current buffer. + (defun ,MODE-enable-in-buffer () + ;; Remove ourselves from the list of pending buffers. + (setq ,MODE-buffers (delq (current-buffer) ,MODE-buffers)) + (unless ,MODE-set-explicitly + (unless (eq ,MODE-major-mode major-mode) + (if ,MODE-variable + (progn + (,mode -1) + (funcall ,turn-on-function)) + (funcall ,turn-on-function)))) + (setq ,MODE-major-mode major-mode)) + (put ',MODE-enable-in-buffer 'definition-name ',global-mode) + + ;; In the normal case, major modes run `after-change-major-mode-hook' + ;; which will have called `MODE-enable-in-buffer' for us. But some + ;; major modes don't use `define-derived-mode' and thus fail to run + ;; `after-change-major-mode-hook', so have a combination of ugly hacks + ;; to try and catch those corner cases by listening to + ;; `change-major-mode-hook' to discover potential candidates and then + ;; checking in `post-command-hook' and `find-file-hook' if some of those + ;; still haven't run `after-change-major-mode-hook'. + ;; FIXME: We should try a get rid of this ugly hack and rely purely + ;; on `after-change-major-mode-hook' because they can (and do) end up + ;; running `MODE-enable-in-buffer' too early (when the major isn't yet + ;; fully setup) in some cases (see bug#58888). (defun ,MODE-enable-in-buffers () (let ((buffers ,MODE-buffers)) ;; Clear MODE-buffers to avoid scanning the same list of @@ -611,14 +638,7 @@ define-globalized-minor-mode (dolist (buf buffers) (when (buffer-live-p buf) (with-current-buffer buf - (unless ,MODE-set-explicitly - (unless (eq ,MODE-major-mode major-mode) - (if ,MODE-variable - (progn - (,mode -1) - (funcall ,turn-on-function)) - (funcall ,turn-on-function)))) - (setq ,MODE-major-mode major-mode)))))) + (,MODE-enable-in-buffer)))))) (put ',MODE-enable-in-buffers 'definition-name ',global-mode) (defun ,MODE-check-buffers () --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 30 Oct 2022 06:57:49 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 30 02:57:49 2022 Received: from localhost ([127.0.0.1]:37217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1op2GT-0008VB-ED for submit <at> debbugs.gnu.org; Sun, 30 Oct 2022 02:57:49 -0400 Received: from lists.gnu.org ([209.51.188.17]:55834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <yantar92@HIDDEN>) id 1op2GQ-0008V3-L2 for submit <at> debbugs.gnu.org; Sun, 30 Oct 2022 02:57:47 -0400 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 <yantar92@HIDDEN>) id 1op2GD-0005Ah-Ot for bug-gnu-emacs@HIDDEN; Sun, 30 Oct 2022 02:57:34 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>) id 1op2GB-0000GT-Jg for bug-gnu-emacs@HIDDEN; Sun, 30 Oct 2022 02:57:33 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4F9CC240026 for <bug-gnu-emacs@HIDDEN>; Sun, 30 Oct 2022 07:57:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667113049; bh=Slj20LgxCxJ9/jW/IU5TClQbOttW/jBywfxfkhJTPX8=; h=From:To:Subject:Date:From; b=TWNvcy1OVJFXgDGGFeF/lxJw33YLrXNzWTdO8v/eDNKrbYSYSAOPhP7ZQ58wBHGZR 8e07e6PlxG9a2X/o0X9PfbavTcJuBBcnj97NfLz4iPyuc5sX0PL0s7uPKvqxcmSa+O siJhMNcFM8WnY2NpbPZsp00VLukWe3eaoiqTfmKunRDiW4XblCgO8SIvYnsdpg7j8k CMUKKrlsqHE3n+S2uWrdCBGEq52ydf/ZTSXVsIWXN1Lj9E90th7cj0buzuqsoYlfrY jJMD7uS0Kaia/xNnoQuaBHN9bNsHIF6RdMuTdqKXj82ol+ZQm92KFh970qobtj6OXD rGPlimcItf2wA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N0RtJ2DKRz6tmL for <bug-gnu-emacs@HIDDEN>; Sun, 30 Oct 2022 07:57:27 +0100 (CET) From: Ihor Radchenko <yantar92@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: 28.1.90; font-lock-defaults not respected when hack-local-variables unsafe variable dialogue is displayed before setting the defaults Date: Sun, 30 Oct 2022 06:58:11 +0000 Message-ID: <878rkxajcs.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@HIDDEN; helo=mout01.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) Following up the discussion in bug#57003. Consider the following file: ------------ # -*- mode:my/test -*- This is test with keyword to be fontified. # Local Variables: # eval: (setq unsafe-variable t) # End: ------------- Then, consider the following major mode: (define-derived-mode my/test-mode text-mode "Test" "" (add-hook 'hack-local-variables-hook (lambda () (setq-local my/test-mode-keywords '(("keyword" . font-lock-keyword-face))) (setq font-lock-defaults '(my/test-mode-keywords))) nil 'local)) 1. emacs -Q 2. Evaluate the major mode definition 3. Open the file 4. Answer "y" in the unsafe variable prompt 5. Observe "keyword" not being fontified. 6. Expected: "keyword" fontified using font-lock-keyword-face. I can also reproduce using (define-derived-mode my/test-mode text-mode "Test" "" (hack-local-variables) (setq-local my/test-mode-keywords '(("keyword" . font-lock-keyword-face))) (setq font-lock-defaults '(my/test-mode-keywords))) The fontification works as expected with (define-derived-mode my/test-mode text-mode "Test" "" (setq-local my/test-mode-keywords '(("keyword" . font-lock-keyword-face))) (setq font-lock-defaults '(my/test-mode-keywords))) Also reproduced on Emacs master. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
Ihor Radchenko <yantar92@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#58888
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.