From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko 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: Sun, 30 Oct 2022 06:58:11 +0000 Message-ID: <878rkxajcs.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4314"; mail-complaints-to="usenet@ciao.gmane.io" To: 58888@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 30 08:04:19 2022 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 1op2Mk-0000sj-2l for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Oct 2022 08:04:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1op2MA-0006pv-7E; Sun, 30 Oct 2022 03:03:42 -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 1op2Gg-0005Sg-FF for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 02:58:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1op2Gg-0000Mc-5f for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 02:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1op2Gf-0008Vh-Tx for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 02:58:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Oct 2022 06:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58888 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166711306932691 (code B ref -1); Sun, 30 Oct 2022 06:58:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Oct 2022 06:57:49 +0000 Original-Received: from localhost ([127.0.0.1]:37217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1op2GT-0008VB-ED for submit@debbugs.gnu.org; Sun, 30 Oct 2022 02:57:49 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1op2GQ-0008V3-L2 for submit@debbugs.gnu.org; Sun, 30 Oct 2022 02:57:47 -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 1op2GD-0005Ah-Ot for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 02:57:34 -0400 Original-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 ) id 1op2GB-0000GT-Jg for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 02:57:33 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4F9CC240026 for ; 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== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N0RtJ2DKRz6tmL for ; Sun, 30 Oct 2022 07:57:27 +0100 (CET) Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; 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-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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246592 Archived-At: 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 . Support Org development at , or support my work at