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#57003: 28.1.90; Can local variables be loaded before loading major mode? Date: Sat, 29 Oct 2022 23:51:39 -0400 Message-ID: References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@gnus.org> <875yj5xzou.fsf@localhost> <87h6zni1uc.fsf@localhost> <87pmeaauib.fsf@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18541"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , 57003@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 30 04:52:18 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 1oozMv-0004f4-GY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Oct 2022 04:52:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oozMi-0007pB-5z; Sat, 29 Oct 2022 23:52:04 -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 1oozMg-0007oo-BN for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 23:52:02 -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 1oozMg-0008Cd-3V for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 23:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oozMf-0003OB-S2 for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 23:52: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: Sun, 30 Oct 2022 03:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57003 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 57003-submit@debbugs.gnu.org id=B57003.166710191513014 (code B ref 57003); Sun, 30 Oct 2022 03:52:01 +0000 Original-Received: (at 57003) by debbugs.gnu.org; 30 Oct 2022 03:51:55 +0000 Original-Received: from localhost ([127.0.0.1]:36999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oozMY-0003Nq-Om for submit@debbugs.gnu.org; Sat, 29 Oct 2022 23:51:55 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:28318) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oozMW-0003Nc-8T for 57003@debbugs.gnu.org; Sat, 29 Oct 2022 23:51:52 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 97D9C100134; Sat, 29 Oct 2022 23:51:46 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id EF3F1100048; Sat, 29 Oct 2022 23:51:40 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1667101901; bh=/hyQuUBE3ObEEzG+GgxmFVRUyRpW5BaeMcfHp/Rv0Bg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fT8aKkR6EtBdaMAlFptuk+8u9eeYQSjQrj+jjuYrAqfG6tPRTzyJ9m5qS8sW9ygQ7 8cjUrjJjpY5pMWcxnQXW0opCJNztE4+grXBxlyXRocNSycDJGcsR2uExDi9VPn2TwF zKnWyDyJHB7/f1LL+93npRj1e1EwgCaTgvlB//PZG8sp+QJSS6YxXBKGj6oH5a7Sz8 XbWCNcaADSWsc4lW8SrCJt2/OfpZc65EaiDD1KXXN/AS4rcVW8kmcUBqkIg7eDrkEE 5feSDH0+7I3X3154KAhlkOxM/CFwiQvkhlpwFTluU67JUS6vuHVSCVMGTM3TqHSHQm 4si31/y/W3XEQ== Original-Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BF33C120F92; Sat, 29 Oct 2022 23:51:40 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Sat, 29 Oct 2022 23:43:21 -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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246582 Archived-At: >>>> Will moving the whole major mode definition into >>>> `hack-local-variables-hook' be safe? >>> Define "safe". I'm sure it'll cause problems in corner cases. >>> If those problems come down to the fact that `hack-local-variables-hook' >>> doesn't fit the bill, then we can look at fixing that. >> I was mostly asking if you are aware about any gotchas. > > Not really, no. I have no doubt that there are various (in addition to > the one you mention above). Looking at some of the related code, I had a feeling of "d=E9j=E0 vu": `hack-local-variables-hook' indeed suffers from various gotchas (starting with the non-intuitive name and the fact that it only applies to file-visiting buffers), and I think my recommendation was out of date: the better answer is to use `after-change-major-mode-hook` the `:after-hook` thingy of `define-derived-mode`. And the remaining gotcha (for Org's support of Emacs-25) is that in Emacs<26 these were run *before* `hack-local-variables` :-( Stefan