GNU bug report logs - #57003
28.1.90; Can local variables be loaded before loading major mode?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Ihor Radchenko <yantar92@HIDDEN>; dated Fri, 5 Aug 2022 11:44:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Removed tag(s) moreinfo. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 31 Oct 2022 03:08:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 30 23:08:08 2022
Received: from localhost ([127.0.0.1]:39307 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opL9j-0000J1-NQ
	for submit <at> debbugs.gnu.org; Sun, 30 Oct 2022 23:08:08 -0400
Received: from mout02.posteo.de ([185.67.36.66]:43935)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1opL9h-0000IV-DD
 for 57003 <at> debbugs.gnu.org; Sun, 30 Oct 2022 23:08:06 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id C98FF240101
 for <57003 <at> debbugs.gnu.org>; Mon, 31 Oct 2022 04:07:59 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1667185679; bh=SMtsjJt2LxvP+chTpjXmzc0fVPYQ5Ds5rypujca6o/M=;
 h=From:To:Cc:Subject:Date:From;
 b=qnCKqvH8oeHvRRnaUP39hi147Ppz08wv1Y0oc0CidT31OSHUHH4yWi7qY4tLxS5KS
 P/pLMjSfwtNGV2rhojZZh/s5q+59e4DwUr2sXbCz3nnCE8wHaawiMHr7OgFQ9RG5Tt
 OZpzoNGkMj68FD8HCL87U36uuRY4/Yh93AGaIbBVbGO207R2GLiK/JSxyDtsRU86bh
 QJGUXT8oBOPW3tND9/UXRc/1nK6W0poKSCG5VGxJZPD+A53EJa5Ss2Yc+XcU+kxxrn
 VMujuMfPGoOZUpr2M94NLljAiy+Rd8B1UL7LLDcx7jMvIrNT6UsFLqxo/rb6Xe7aE4
 7O5d/gDROJoPg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4N0yl16G5Rz6tpG;
 Mon, 31 Oct 2022 04:07:57 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <jwv1qqp7awd.fsf-monnier+emacs@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
 <87h6zni1uc.fsf@localhost> <jwvsfj6itry.fsf-monnier+emacs@HIDDEN>
 <87pmeaauib.fsf@localhost> <jwvmt9e6m3b.fsf-monnier+emacs@HIDDEN>
 <jwvh6zm6kmv.fsf-monnier+emacs@HIDDEN> <875yg2arjv.fsf@localhost>
 <jwv1qqp7awd.fsf-monnier+emacs@HIDDEN>
Date: Mon, 31 Oct 2022 03:08:36 +0000
Message-ID: <87y1swlmff.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <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: -1.0 (-)

Stefan Monnier <monnier@HIDDEN> writes:

>>> , 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`.
>>
>> Will it run before or after org-mode-hook?
>
> It's run after setting file-local vars, which themselves are set after
> running the mode hooks.

This is unfortunate.

org-mode-hook is "Mode hook for Org mode, run after the mode was turned
on.". But we need to load file-local variables in order to turn on Org
mode + respect file-local settings. So, neither
hack-local-variables-hook nor :after-hook will solve the problem I
suggested solving in this discussion.

For Org mode, it is necessary to complete the setup before org-mode-hook
is loaded (I am not talking about folding; there are more critical parts
like parser setup). Otherwise, the existing third-party packages adding
things to org-mode-hook will be broken.

Outside Org mode peculiarities, the fact that
hack-local-variables-hook is run after *-mode-hook also means that
subtle bugs might be introduced into major modes that are utilizing
hack-local-variables-hook for important setup.

I conclude that my original idea herein about a new option to load local
variables early may be even more important than I initially thought.

-- 
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>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 30 Oct 2022 12:30:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 30 08:30:24 2022
Received: from localhost ([127.0.0.1]:37477 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1op7SJ-0007U5-VZ
	for submit <at> debbugs.gnu.org; Sun, 30 Oct 2022 08:30:24 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:63107)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1op7SH-0007Tt-UK
 for 57003 <at> debbugs.gnu.org; Sun, 30 Oct 2022 08:30:23 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F30C544089C;
 Sun, 30 Oct 2022 08:30:15 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9906F44088B;
 Sun, 30 Oct 2022 08:30:14 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1667133014;
 bh=kR3l1WtCCs8H2+meH2saR/gCj8zCFZPNVF7rKCmr8lQ=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Xo3ClXwqnPlWTPX1JiP64T9ZNile4/AZTd5HOnCi0w1iXY/brM/ogGxa3/ot3I1EB
 73L/32jYYl7Z/oAlvsfXqWZXNmEoVfs3+g1TvV5ytEQLKwvC0oUR9QtW3a/OkdhYgh
 DqTq97pFRdCH1ISF3DMkdy46QR/LNCS8BePzcpnC8IOHO0jet/zlNrgCoKUzKZaFTN
 9gWh3OYfL51RyPcg93mqh0iEw5pQ8sbBij53h+xYgwQfyHtcronTco1QMid6VpIlDd
 ZGO0CEtc7wgJ+RsWQG6FoDz1O+VPWIkU6kfHkfKOL5CU1UnEyywz73QQWWzAWyrEeo
 VQbvQmThEn4zQ==
Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4AA20120E90;
 Sun, 30 Oct 2022 08:30:14 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <875yg2arjv.fsf@localhost> (Ihor Radchenko's message of "Sun, 30
 Oct 2022 04:01:08 +0000")
Message-ID: <jwv1qqp7awd.fsf-monnier+emacs@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
 <87h6zni1uc.fsf@localhost> <jwvsfj6itry.fsf-monnier+emacs@HIDDEN>
 <87pmeaauib.fsf@localhost> <jwvmt9e6m3b.fsf-monnier+emacs@HIDDEN>
 <jwvh6zm6kmv.fsf-monnier+emacs@HIDDEN> <875yg2arjv.fsf@localhost>
Date: Sun, 30 Oct 2022 08:30:12 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
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
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <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 (---)

Ihor Radchenko [2022-10-30 04:01:08] wrote:
> Stefan Monnier <monnier@HIDDEN> writes:
>>> 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)
>
> Does it mean that "Major modes can use this to examine user-specified
> local variables in order to initialize other data structure based on
> them." statement in the docstring of `hack-local-variables-hook' should
> be amended?

Good question, maybe it should be amended to point to
`after-change-major-mode-hook`?

>> , 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`.
>
> Will it run before or after org-mode-hook?

It's run after setting file-local vars, which themselves are set after
running the mode hooks.






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 30 Oct 2022 06:59:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 30 02:59:14 2022
Received: from localhost ([127.0.0.1]:37223 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1op2Hp-00006R-W7
	for submit <at> debbugs.gnu.org; Sun, 30 Oct 2022 02:59:14 -0400
Received: from mout01.posteo.de ([185.67.36.65]:59989)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1op2Ho-00006D-PG
 for 57003 <at> debbugs.gnu.org; Sun, 30 Oct 2022 02:59:13 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id A09D4240027
 for <57003 <at> debbugs.gnu.org>; Sun, 30 Oct 2022 07:59:06 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1667113146; bh=FTLeBGRHJ+eFOBEc73rcPH/XhQ/altMBOKVVoZyPpl0=;
 h=From:To:Cc:Subject:Date:From;
 b=gm5Vrxxe1CBy0KJYG3y8eVqIBHYdH+gOpzF8gJMgeGgHDATDIxo+SfiaxjWvJgpln
 fegwu89Mg+L68NOI1hkASLNxoLYmm1Chk3WQlSq6bAPg8nXrgH/rhm+QcGK6o0vej+
 frvmebgBFSY9tJFjmnsWkB6wwCR5NveVDqheNshWE3DmXis8bBCJr/cQGgsIhOT700
 m4loWVi4bGPYKf0KaY01pfu7HcEWTd0zqKcEXdMVBJcCZFLDEzuxvfqNFEJhrLQZ6X
 a85atwAmS3J0ufaDnL92c8QR3yGRZyvaVglhEN6gAVCdR7CLD+g87mU6minpNV3eVp
 rEwTMaDpGXSqA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4N0Rw90KGNz9rxD;
 Sun, 30 Oct 2022 07:59:04 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <jwvmt9e6m3b.fsf-monnier+emacs@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
 <87h6zni1uc.fsf@localhost> <jwvsfj6itry.fsf-monnier+emacs@HIDDEN>
 <87pmeaauib.fsf@localhost> <jwvmt9e6m3b.fsf-monnier+emacs@HIDDEN>
Date: Sun, 30 Oct 2022 06:59:48 +0000
Message-ID: <875yg1aja3.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <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: -1.0 (-)

Stefan Monnier <monnier@HIDDEN> writes:

>> See https://list.orgmode.org/orgmode/878ro8kqwv.fsf@localhost/T/#u
>
> I didn't quite understand the problem from that thread.
>
> Your description above isn't very clear either  On the one hand you say
> "font-locking is not setup prior to that" but on the other you say
> "Emacs will try to fontify the visible part of buffer" which only
> happens if font-lock is setup, AFAIK.
>
> I suggest you open a bug report to get to the bottom of this.

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58888

-- 
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>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 30 Oct 2022 04:00:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 30 00:00:38 2022
Received: from localhost ([127.0.0.1]:37003 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oozUz-0003d1-Qb
	for submit <at> debbugs.gnu.org; Sun, 30 Oct 2022 00:00:38 -0400
Received: from mout01.posteo.de ([185.67.36.65]:34549)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oozUu-0003cj-VH
 for 57003 <at> debbugs.gnu.org; Sun, 30 Oct 2022 00:00:36 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 3905F240027
 for <57003 <at> debbugs.gnu.org>; Sun, 30 Oct 2022 05:00:26 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1667102427; bh=S4Z7xCa9klfb8cHEtD1e6KWomBctO1Q8bOAcgwcHo/c=;
 h=From:To:Cc:Subject:Date:From;
 b=JEhaIsLV1FAnyQG36lXGf3fmT0CCl8hlm/9IInOzoAmwt5BjFyuI72cAUGkDXfI98
 P5cEGTUJQ73E4fdyD9482FYf3mxWWVhMdinFTcXqYktIO2XfngW46XLcYvYMB+r1ct
 KULXekt4Em4xou6HIQIbb+Ylfn10Qo0WrC7G+owcj0lhQugwtBswUe7GiCJlaiz/eu
 miNh/XiwRPLOd3/G3KvzGM5bYsFdKkv7A3TZEgjVsG0IRwM6ENENqO4zZX6dnJFEdC
 RDg12ywos1DN0WifY9V2yDUD0PI8poQDDS8BrMOmlMjCWe+TwgQXbX6CWEL+Q6I/U0
 vzYvlZLnZ4g8w==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4N0My13yb7z9rxD;
 Sun, 30 Oct 2022 05:00:25 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <jwvh6zm6kmv.fsf-monnier+emacs@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
 <87h6zni1uc.fsf@localhost> <jwvsfj6itry.fsf-monnier+emacs@HIDDEN>
 <87pmeaauib.fsf@localhost> <jwvmt9e6m3b.fsf-monnier+emacs@HIDDEN>
 <jwvh6zm6kmv.fsf-monnier+emacs@HIDDEN>
Date: Sun, 30 Oct 2022 04:01:08 +0000
Message-ID: <875yg2arjv.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <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: -1.0 (-)

Stefan Monnier <monnier@HIDDEN> writes:

>> 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=C3=A9j=C3=A0 v=
u":
> `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)

Does it mean that "Major modes can use this to examine user-specified
local variables in order to initialize other data structure based on
them." statement in the docstring of `hack-local-variables-hook' should
be amended?

> , 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`.

Will it run before or after org-mode-hook?

> And the remaining gotcha (for Org's support of Emacs-25) is that in
> Emacs<26 these were run *before* `hack-local-variables` :-(

This is not a problem. Org officially supports Emacs >=3D26. No more need
to keep Emacs 25 compatibility. See
https://orgmode.org/worg/org-maintenance.html#emacs-compatibility

--=20
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>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 30 Oct 2022 03:51:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 29 23:51:55 2022
Received: from localhost ([127.0.0.1]:36999 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oozMY-0003Nq-Om
	for submit <at> debbugs.gnu.org; Sat, 29 Oct 2022 23:51:55 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:28318)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1oozMW-0003Nc-8T
 for 57003 <at> debbugs.gnu.org; Sat, 29 Oct 2022 23:51:52 -0400
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)
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==
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)
From: Stefan Monnier <monnier@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <jwvmt9e6m3b.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Sat, 29 Oct 2022 23:43:21 -0400")
Message-ID: <jwvh6zm6kmv.fsf-monnier+emacs@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
 <87h6zni1uc.fsf@localhost> <jwvsfj6itry.fsf-monnier+emacs@HIDDEN>
 <87pmeaauib.fsf@localhost> <jwvmt9e6m3b.fsf-monnier+emacs@HIDDEN>
Date: Sat, 29 Oct 2022 23:51:39 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.041 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: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <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 (---)

>>>> 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





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 30 Oct 2022 03:43:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 29 23:43:37 2022
Received: from localhost ([127.0.0.1]:36993 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oozEW-00038M-PG
	for submit <at> debbugs.gnu.org; Sat, 29 Oct 2022 23:43:37 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:34329)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1oozER-000380-Pf
 for 57003 <at> debbugs.gnu.org; Sat, 29 Oct 2022 23:43:35 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 09B4E441189;
 Sat, 29 Oct 2022 23:43:25 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6FFB1441186;
 Sat, 29 Oct 2022 23:43:23 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1667101403;
 bh=D8KQiR1kMSBt03tLBNc22sf3lSTTQ46dCtLA64n9Cuk=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=T/oo1xAP5yESlyry3RUmW9a5cupOAxJ8y7wnFf0FdoxYwiH9/RfGCrRwjRijp/Jc6
 DX1+u9wwJTJWajc0Qgq2ibZG8+zB7HkoE7QSWrVR5B3CVu/Miej2ZomrJ3Bi83/CBN
 RMRrOdI14nMv1CV1dp6prQhsAMSM71Y/KAk2+cEni9qjmHYcXl9WvCXLh3gj0XLSjH
 4fayakL2Wui3QEGcOv5gOx5be/CwsZfTOPAbbyqOy7yB5UFgdGpvcZ26BXpIihCDrt
 HZfTvHRmHpWkmqqHiD2qlz+tkW77nE3nvWPgFjqylrVqPSWlnw6Q2Y3Mc0fDgpGnNn
 kdKaCBdEmZofw==
Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 25807120FD1;
 Sat, 29 Oct 2022 23:43:23 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87pmeaauib.fsf@localhost> (Ihor Radchenko's message of "Sun, 30
 Oct 2022 02:57:16 +0000")
Message-ID: <jwvmt9e6m3b.fsf-monnier+emacs@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
 <87h6zni1uc.fsf@localhost> <jwvsfj6itry.fsf-monnier+emacs@HIDDEN>
 <87pmeaauib.fsf@localhost>
Date: Sat, 29 Oct 2022 23:43:21 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
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.010 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: 57003
Cc: Ihor Radchenko <yantar92@HIDDEN>, 57003 <at> debbugs.gnu.org,
 Lars Ingebrigtsen <larsi@HIDDEN>
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 (---)

>>> However, pretty much all the BODY in Org major mode definition will need
>>> to go into the hook. It feels awkward.
>> The body of a major mode should usually be limited to setting some
>> variables.  All the font-lock highlighting, the imenu scanning, the
>> syntax-propertizing, etc... is done afterwards (the later the better).
> One issue I envision is when unsafe variable dialogue is being
> displayed. If font-locking is not setup prior to that, Emacs will try to
> fontify the visible part of buffer when displaying the dialogue and
> later font-lock settings may not fully apply.
>
> See https://list.orgmode.org/orgmode/878ro8kqwv.fsf@localhost/T/#u

I didn't quite understand the problem from that thread.

Your description above isn't very clear either  On the one hand you say
"font-locking is not setup prior to that" but on the other you say
"Emacs will try to fontify the visible part of buffer" which only
happens if font-lock is setup, AFAIK.

I suggest you open a bug report to get to the bottom of this.

>> The act of folding is not part of "defining" the major mode in my
>> book :-)
> Indeed.  However, a lot more things in Org mode depend on user
> customizations.  For example, buffer-invisibility-spec may be changed
> depending on user settings, including settings defined in file-local
> variables.

I don't see a problem with postpone that to `hack-local-variables-hook', no.
[ Other approaches exist, of course, such as monitoring those config
  vars and updating the other pieces of data that depend on them
  whenever needed.  ]

>>> 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).


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 30 Oct 2022 02:56:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 29 22:56:46 2022
Received: from localhost ([127.0.0.1]:36968 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ooyVB-0001oN-Kl
	for submit <at> debbugs.gnu.org; Sat, 29 Oct 2022 22:56:45 -0400
Received: from mout02.posteo.de ([185.67.36.66]:59587)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1ooyV7-0001o3-2d
 for 57003 <at> debbugs.gnu.org; Sat, 29 Oct 2022 22:56:43 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 21C9F240101
 for <57003 <at> debbugs.gnu.org>; Sun, 30 Oct 2022 03:56:34 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1667098595; bh=De0sBDQk0UbinkpLNI0dA9Oma5NrlcNNwo4cKWEy/Ho=;
 h=From:To:Cc:Subject:Date:From;
 b=lrx1F+cE7V4tEydu2V1vlCX5JUIbj7j+SbZ3tASCPVCU2DS0HhS51HL5hbt6zFsil
 71Vk+k6WjvtDPKQIu9IDsk1NtBanGStV1eNPzTWaCdbm9L20nXa8XxBYYkrlYV3/RG
 Yz0L1j7gq+tgAjY7gZQWTwqsUJDAgHSaVlEU+ySslvhJ5U643wTUCNf/j+gstS9gMN
 QUVtN0UDOUuO6QvU8GIKAc0pdCcDhv5Awd0V6bB60JEtKXzoEBKlSZ0/o6JnO27EYd
 PXhMjMI/6MWoGScB3f0Doynjz/LHSmr+rVzlsnfMu+UpyjGbw6A2tJbw560zkD73Cy
 w6wC+P/HyXTLw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4N0LXK1Twkz9rxF;
 Sun, 30 Oct 2022 03:56:32 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <jwvsfj6itry.fsf-monnier+emacs@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
 <87h6zni1uc.fsf@localhost> <jwvsfj6itry.fsf-monnier+emacs@HIDDEN>
Date: Sun, 30 Oct 2022 02:57:16 +0000
Message-ID: <87pmeaauib.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <at> debbugs.gnu.org,
 Ihor Radchenko <yantar92@HIDDEN>
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: -1.0 (-)

Stefan Monnier <monnier@HIDDEN> writes:

>> However, pretty much all the BODY in Org major mode definition will need
>> to go into the hook. It feels awkward.
>
> The body of a major mode should usually be limited to setting some
> variables.  All the font-lock highlighting, the imenu scanning, the
> syntax-propertizing, etc... is done afterwards (the later the better).

One issue I envision is when unsafe variable dialogue is being
displayed. If font-locking is not setup prior to that, Emacs will try to
fontify the visible part of buffer when displaying the dialogue and
later font-lock settings may not fully apply.

See https://list.orgmode.org/orgmode/878ro8kqwv.fsf@localhost/T/#u

> The act of folding is not part of "defining" the major mode in my
> book :-)

Indeed. However, a lot more things in Org mode depend on user
customizations. For example, buffer-invisibility-spec may be changed
depending on user settings, including settings defined in file-local
variables.

>> 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.
As I stated above, there is at least one gotcha with early fontification
when unsafe variable dialogue is being shown.

-- 
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>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 29 Oct 2022 14:40:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 29 10:40:18 2022
Received: from localhost ([127.0.0.1]:36309 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oon0U-0002sO-K2
	for submit <at> debbugs.gnu.org; Sat, 29 Oct 2022 10:40:18 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10936)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1oon0T-0002s9-2i
 for 57003 <at> debbugs.gnu.org; Sat, 29 Oct 2022 10:40:17 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1091D100189;
 Sat, 29 Oct 2022 10:40:11 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5A1AA1000FF;
 Sat, 29 Oct 2022 10:40:09 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1667054409;
 bh=MXRgDCkk2zAoRT8AhGwW1MQyondTHdSMP2UVvNvaJx0=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=ZKbf7tIk+U6Oknxzs7LKdpdUvxalk/l7/2z9xtQZUq3RpBX2deIWmWgaTNo6ZSMtb
 UDEG34S9Hv2O6Yq2fLNm5hvJ+jizJIf6g7puzOFHL6ZGqGjHoXp4DzEy58HDCZwmMr
 8kfDsbKz8bFYmEGsTSrPeLI2dQTNUYvOXzS7rrNIyIkixhPUubqP5uqlr0GhV6sYYX
 CNk9kB4mx3hTqUG2nSoryoBwA8nY90IFDz8Dpfwqzy0oxjBy5D4ChL9MvxeacvSZsz
 Z5/oOttVhJoJR06Xzz4bgevQ3JIqhyJd1z46RLIA/X9PhiQAeFpAASydsA3/fuijsw
 Q6wJ3sKH2BRaA==
Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 23247120EA1;
 Sat, 29 Oct 2022 10:40:09 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87h6zni1uc.fsf@localhost> (Ihor Radchenko's message of "Sat, 29
 Oct 2022 06:24:43 +0000")
Message-ID: <jwvsfj6itry.fsf-monnier+emacs@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
 <87h6zni1uc.fsf@localhost>
Date: Sat, 29 Oct 2022 10:40:06 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
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.052 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: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <at> debbugs.gnu.org,
 Ihor Radchenko <yantar92@HIDDEN>
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 (---)

>> The problem is not that the variables are set too late,it's that you
>> fold too early: the folding should not to take place from within
>> `org-mode` but instead `org-mode` should add the folding function to
>> `hack-local-variables-hook`.
>>
>> What you request is a common need, and `hack-local-variables-hook` is
>> the standard answer.
>
> I guess that it can be an option. Though such hook will also need to be
> guarded against repetitive execution (if `hack-local-variables' is
> called by some minor mode or a command).
>
> However, pretty much all the BODY in Org major mode definition will need
> to go into the hook. It feels awkward.

The body of a major mode should usually be limited to setting some
variables.  All the font-lock highlighting, the imenu scanning, the
syntax-propertizing, etc... is done afterwards (the later the better).

The act of folding is not part of "defining" the major mode in my
book :-)

> 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.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 29 Oct 2022 06:24:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 29 02:24:12 2022
Received: from localhost ([127.0.0.1]:34815 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oofGN-0002Mx-Rn
	for submit <at> debbugs.gnu.org; Sat, 29 Oct 2022 02:24:12 -0400
Received: from mout02.posteo.de ([185.67.36.66]:58349)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oofGL-0002Mg-Ck
 for 57003 <at> debbugs.gnu.org; Sat, 29 Oct 2022 02:24:10 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 6F388240103
 for <57003 <at> debbugs.gnu.org>; Sat, 29 Oct 2022 08:24:01 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1667024643; bh=/mCSV7bcN/pXy22yBsZ3uU4j1x5TI6HzLs1zC3qb5zU=;
 h=From:To:Cc:Subject:Date:From;
 b=lPd61DPqxhG4Jx+98+mGDfRPh4D4euHHjOIs83OKl9wjYCpSkk9y269tLigCH3Mal
 TW+IGosAfuH+V+yFci3ASl7/RT1cbD4YC5sYRjivZoVGumrEBOBj9iAxzsKN1DUCko
 nuHV+erprf0XFmaBD5TUzYJGNG3eOGHN3RxxTdxO7Szz7S12+giIu5TNJuWMJsPBBS
 fJF4u3h3nOS9LqMbCjFTv7MOIGm0oJHUyaCMf0cjiNwvLGwWlZizQXTp+gTLrtz5n7
 3Vy1hFF/RgcmS5s8eQvoaEzeqrYpFhYytaa9jPFYHh/PymN0kNc9SZT9ycW05JprG+
 UMp4bF4wSFj4A==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4MzqB82cP3z6tmM;
 Sat, 29 Oct 2022 08:23:59 +0200 (CEST)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
Date: Sat, 29 Oct 2022 06:24:43 +0000
Message-ID: <87h6zni1uc.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <at> debbugs.gnu.org,
 Ihor Radchenko <yantar92@HIDDEN>
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: -1.0 (-)

Stefan Monnier <monnier@HIDDEN> writes:

> The problem is not that the variables are set too late,it's that you
> fold too early: the folding should not to take place from within
> `org-mode` but instead `org-mode` should add the folding function to
> `hack-local-variables-hook`.
>
> What you request is a common need, and `hack-local-variables-hook` is
> the standard answer.

I guess that it can be an option. Though such hook will also need to be
guarded against repetitive execution (if `hack-local-variables' is
called by some minor mode or a command).

However, pretty much all the BODY in Org major mode definition will need
to go into the hook. It feels awkward.

Will moving the whole major mode definition into
`hack-local-variables-hook' be safe?

-- 
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>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 18 Oct 2022 13:29:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 18 09:29:50 2022
Received: from localhost ([127.0.0.1]:51594 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1okmfF-0004G6-PF
	for submit <at> debbugs.gnu.org; Tue, 18 Oct 2022 09:29:50 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:42882)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1okmfE-0004Fu-Ci
 for 57003 <at> debbugs.gnu.org; Tue, 18 Oct 2022 09:29:48 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F0E22442868;
 Tue, 18 Oct 2022 09:29:42 -0400 (EDT)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9C2B9442865;
 Tue, 18 Oct 2022 09:29:41 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1666099781;
 bh=FBY5/dSwzjPHJPOw7VxAu7/Qu5hkUnLKMpCM6XUqFLk=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=TJWh7PBV9659omPMia07WxmvT1467FUerAmAJnwF5r5aI4u4g7LgYRvLmh87/kXSH
 uMGdWmgKv9uNhwpbfrFEnh4ewqT+QvDEQrt2rSn70YsN6tgrTGJQUnqPRHzf4iqgP8
 roNYd0Nhlv6SdUOJBRDLze/0btKztXJI8ipn0AQiPRBU49gqOHcl2A3wqUMv4ZWKPy
 77LqOkcqd88s/YP3zrbCh+G4tMexZlLU31IM005psNy18SBhNKp9CaxzsIjHEbcGIl
 GsHYNW6PHFLFz6ABaqLPf+JxOC4XRMC+5yYSLuHAbbD3DeR42KRuCP4+qtv3d8EePY
 Dovmzo1Wsvj3Q==
Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 79AB9120F15;
 Tue, 18 Oct 2022 09:29:41 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <875yj5xzou.fsf@localhost> (Ihor Radchenko's message of "Sat, 06
 Aug 2022 21:35:13 +0800")
Message-ID: <jwvbkq9b6tw.fsf-monnier+emacs@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost>
Date: Tue, 18 Oct 2022 09:29:40 -0400
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
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.066 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: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <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 (---)

> We have a variable org-startup-folded:
>
>    Non-nil means entering Org mode will switch to OVERVIEW.
>
> This variable controls the initial state of the Org buffer.
> When, non-nil, headings will be folded at the end of Org initialization.
> This folding happens inside org-mode specification and hence setting the
> variable after Org mode is loaded makes no difference.

The problem is not that the variables are set too late,it's that you
fold too early: the folding should not to take place from within
`org-mode` but instead `org-mode` should add the folding function to
`hack-local-variables-hook`.

What you request is a common need, and `hack-local-variables-hook` is
the standard answer.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 31 Aug 2022 03:28:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 30 23:28:12 2022
Received: from localhost ([127.0.0.1]:37880 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oTEOi-0001Cr-Gl
	for submit <at> debbugs.gnu.org; Tue, 30 Aug 2022 23:28:12 -0400
Received: from mail-pl1-f171.google.com ([209.85.214.171]:46004)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oTEOg-0001Cc-Au
 for 57003 <at> debbugs.gnu.org; Tue, 30 Aug 2022 23:28:11 -0400
Received: by mail-pl1-f171.google.com with SMTP id u22so12961065plq.12
 for <57003 <at> debbugs.gnu.org>; Tue, 30 Aug 2022 20:28:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc;
 bh=mSk4BEaofDUk+UIrVzul40uwG9N8ReenpCWcJFHkDdU=;
 b=ia0XjIpm+CI2ch/y5Env0C3heIzKLyl5kTWKEE4Vp3ZulPRMS5tvtGyBHUosyy4J3h
 1IhQCczJ9kcdYs+HzWEhWz8aeFLUwaNh8AfCbZf18kE47OvxQaiSRGwgB+k9mZtYZS2X
 1u5OP23MnvjwhIkp3/f6KiCrlP8rWUr+FOMfegLHgVZCjWIyMGj0/beJBSzx49KWy2rG
 4+ur1oSEmUNb8WnHexOcZRTm/Sl9PcBSUBncs+UScrdl4JqzoOBIIcZyr48a7VfQat5Q
 pdgsu2o+diQ+/ptVgNsif16Fiofi1ah0ycQBQl591m4dkSoo8130fdW5gcyXj6HfKjLK
 0i8A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc;
 bh=mSk4BEaofDUk+UIrVzul40uwG9N8ReenpCWcJFHkDdU=;
 b=0xPuOMhj4zmZtL/dvhrkQjRyGiqPHmZjVCBQDrXWCOGVNjaytC+ZZKWCT+SX1xghDD
 6d2/p5+16vkcKYw8SwKR3Nhdte2oL5h3RH0uucHgs5UUUQ4sZIMuWCy2Lk5HxhygUC0s
 r5j7B9g0frXPRPRxXDnPMXJeIE/2zhPVpqVjFe9enOlkbGRtNaF97U3HmnEc8tygSJ4/
 wydOidF/05cqB+zrtxaGXUNpW6xZv9S3uWgg7ARbLQVGQ7xMSN2FeH37fArOAYE3le8N
 kxPhsdP2oFd6EcLdJSFDJWoD/fnSikraR8K1JOtMLTvBVkPcQUM43IAyBTGT7uDznZOE
 W8MQ==
X-Gm-Message-State: ACgBeo333h6Isi6q9Pfk399BSG9wptNzOeEXoMxDEx+W+tmtU8O1XXe+
 2U26DlU9aJgU4fiD/NnBDRo=
X-Google-Smtp-Source: AA6agR5WZvzdDlTR76a1OEavRC6TJNE9mvitut585j2tTHbcaCRJpYRVbZXmGsdaiK+mJDLvxhVgwQ==
X-Received: by 2002:a17:902:cec7:b0:172:5b09:161c with SMTP id
 d7-20020a170902cec700b001725b09161cmr23231998plg.60.1661916484547; 
 Tue, 30 Aug 2022 20:28:04 -0700 (PDT)
Received: from localhost ([115.154.175.57]) by smtp.gmail.com with ESMTPSA id
 m20-20020a17090ade1400b001fad1f975casm323397pjv.12.2022.08.30.20.28.03
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 30 Aug 2022 20:28:04 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: rms@HIDDEN
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <E1oSVXx-0008BG-HH@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <875yj5xzou.fsf@localhost>
 <875yj443zy.fsf@HIDDEN> <874jyo6vd6.fsf@localhost>
 <87k07k18ro.fsf@HIDDEN> <871qts6tzy.fsf@localhost>
 <87bksv0ya6.fsf@HIDDEN> <87edxqzzm6.fsf@localhost>
 <87leryzzdl.fsf@HIDDEN> <87a68ezycj.fsf@localhost>
 <875yj2zudw.fsf@HIDDEN> <871qtp64eq.fsf@localhost>
 <878rntskld.fsf@HIDDEN> <877d3c7by7.fsf@localhost>
 <87h72gjr3a.fsf@HIDDEN> <87ilmw5o4j.fsf@localhost>
 <E1oNQTp-0006TB-JE@HIDDEN> <87k07ayz7u.fsf@localhost>
 <E1oO98j-0008Lb-Um@HIDDEN> <87wnb7yyfb.fsf@localhost>
 <E1oSVXx-0008BG-HH@HIDDEN>
Date: Wed, 31 Aug 2022 11:29:08 +0800
Message-ID: <87o7w1ozuj.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57003
Cc: larsi@HIDDEN, 57003 <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: -0.8 (/)

Richard Stallman <rms@HIDDEN> writes:

> That's the right thing to do.  However, your previous message seemed
> to imply a problem, because it proposed loading these buffer-local
> variables "before executing the major mode body", and that would be
> before `kill-all-local-variables'.  That function would kill these new
> bindings, unless it were prevented from doing so.

I was referring to define-derived-mode macro, where
`kill-all-local-variables' is actually called before BODY argument. Of
course, as Lars pointed, some major modes may not use
`define-derived-mode' and the meaning of "body" is different.

The major modes that do not use define-derived-mode are actually
problematic. While we can expect `kill-all-local-variables' to be called
early even in such major modes, the mode symbol is not yet known by the
time `kill-all-local-variables' is called. I am not sure how to approach
the proposed 'early-local property for mode-specific
file/directory-local variables in such scenario.

-- 
Ihor Radchenko,
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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 29 Aug 2022 03:34:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 28 23:34:53 2022
Received: from localhost ([127.0.0.1]:59843 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oSVY5-0007se-Dc
	for submit <at> debbugs.gnu.org; Sun, 28 Aug 2022 23:34:53 -0400
Received: from eggs.gnu.org ([209.51.188.92]:53124)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rms@HIDDEN>) id 1oSVY3-0007sK-CZ
 for 57003 <at> debbugs.gnu.org; Sun, 28 Aug 2022 23:34:51 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:57222)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rms@HIDDEN>)
 id 1oSVXy-0004wi-1E; Sun, 28 Aug 2022 23:34:46 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From:
 mime-version; bh=RxmqoRi+T1eZMXRgFuu0g9x4/6Wm4QGmMIRCMQtPNd0=; b=eSiEdN7uLRVj
 49c3p7l9uVMU+nPYHlnk6Xa3gil2dxlVzh8mQjknXkA7M3jYfZ2Gop4FBgWtxWpgYZQFnws8aJUaJ
 F6ajOxNzy7vxS+4tj43ZShN9BO9FRS9RRfmMBmcx2KNLOVHzhjp37oN2fvS0id9lIuxRkQkGQ3RBG
 Sh3iUa9RR7xSz3hvr+CVKY884M6YeLJfDAOkwnvcXPgEfDXd10EnQlexpPldMah/QasMH9Dwf2xQk
 H2+bDm4/YNOdcoDyjgfggrTirN1uHWevnYb+lPx+Z8oDoVS9nzTKb7mqedVsffmspMvK40PRivE2Y
 OR2whvbCDV9w8QgC61udJw==;
Received: from rms by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <rms@HIDDEN>)
 id 1oSVXx-0008BG-HH; Sun, 28 Aug 2022 23:34:45 -0400
Content-Type: text/plain; charset=Utf-8
From: Richard Stallman <rms@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87wnb7yyfb.fsf@localhost> (message from Ihor Radchenko on Wed,
 17 Aug 2022 18:08:56 +0800)
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
 <877d3c7by7.fsf@localhost> <87h72gjr3a.fsf@HIDDEN>
 <87ilmw5o4j.fsf@localhost> <E1oNQTp-0006TB-JE@HIDDEN>
 <87k07ayz7u.fsf@localhost> <E1oO98j-0008Lb-Um@HIDDEN>
 <87wnb7yyfb.fsf@localhost>
Message-Id: <E1oSVXx-0008BG-HH@HIDDEN>
Date: Sun, 28 Aug 2022 23:34:45 -0400
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: larsi@HIDDEN, 57003 <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>
Reply-To: rms@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > >   > 'early-local will apply file/directory-local variables _before_ executing
  > >   > the major-mode body. In contrast, the variables without this property
  > >   > are applied _after_ executing the major-mode body.
  > >
  > > I suppose you'll do something to protect those local variables from
  > > `kill-all-local-variables' so it won't kill them.

  > No. Not killing the _already existing_ local variables is what
  > 'persistent-local is for. What I am proposing here is only relevant to
  > buffer-local and directory-local variables that are going to be loaded
  > anyway. The change will only affect _when_ they are loaded.

That's the right thing to do.  However, your previous message seemed
to imply a problem, because it proposed loading these buffer-local
variables "before executing the major mode body", and that would be
before `kill-all-local-variables'.  That function would kill these new
bindings, unless it were prevented from doing so.

Now I think that was just my misundersanding.  So I am relieved.


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 17 Aug 2022 10:08:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 17 06:08:02 2022
Received: from localhost ([127.0.0.1]:49462 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oOFxx-0006oM-QI
	for submit <at> debbugs.gnu.org; Wed, 17 Aug 2022 06:08:02 -0400
Received: from mail-oi1-f177.google.com ([209.85.167.177]:33779)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oOFxv-0006ns-DS
 for 57003 <at> debbugs.gnu.org; Wed, 17 Aug 2022 06:08:00 -0400
Received: by mail-oi1-f177.google.com with SMTP id v125so236304oie.0
 for <57003 <at> debbugs.gnu.org>; Wed, 17 Aug 2022 03:07:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc;
 bh=0koI18j1lddN+/NGQhGZU3nA9K41zZGexN9r6QhX7+A=;
 b=AkAPfYHsiZRDygvDgWZ6LHMor9ynLwKmnDHGa5MUQh3UCvgGEdxxSXdgfLHR9NDbIB
 UjGDUbo3NSU8ahM3LC/mNyGDe8HVfBlFnhkdpF9l4xx6dy4/CpHB6vC5GujgQ8bAqZDg
 NU9W8gZ5gGgmJ2Ev9oR5SCxdCokQTBMPYVByiDeDG0GwLEnpQy0Wvn6tVuARAafxxXzN
 6FWfZ1go9Qk3sz3Mabpfy4wdmnWLvgGgxvzK5Y038o9ysSHYJmPWOvLfyV/bHdv3Gk6l
 7TOtXVYly5IhfSmilN+oCEgOstbG8JDAafWfhCRfuEJSdPb4g6F+Ei1vxv7YY8QHAwWX
 uLRA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc;
 bh=0koI18j1lddN+/NGQhGZU3nA9K41zZGexN9r6QhX7+A=;
 b=BJ91C/ywiRVITS2A6GTFxQTI4J/iC0evl7cJPtomlmejIJ3UV+ydfUJWKA0xPp4f/E
 TYpYWF+yiPf627fvcTWLJS4RR0un9aCRVByH1uNS5WOt9VIlWb2GOItHxT/pDFf7mAED
 SfM+11gRxBzJw2ZZ7hfeUWBdzqTbB7Dx2cgRMdeE9rj1Rzu9CjykuFLhTm2TPnaFF1X6
 QqzghvXE/I7WJpsODOi/i9BeQUV6NvH4oMYYocWyeAoeiQ0Oi0bztlUTb5Inamq7sWop
 FIgK1V0PAkid3kXI0sPixV3813Yhuf92gxZFdz1if1Hrcjknif1CrozdX8YwJaRTheOP
 0Z2A==
X-Gm-Message-State: ACgBeo0JE1LxxMQgjXGt5beQ71YaJjRh5+PL1SFFR87FNwtQalB+rhHg
 KpkLVyzhHrwG2GlewsSHhAliRHjyikq52J4Atak=
X-Google-Smtp-Source: AA6agR7mmeij2hWVKsmzj63qxBjarVVt+s8YhfRe4boOwJD6D90jN7y/BL4Mw13bxE/WnvYlLxcBIw==
X-Received: by 2002:a05:6808:1b0b:b0:343:60fc:b610 with SMTP id
 bx11-20020a0568081b0b00b0034360fcb610mr1075299oib.133.1660730873775; 
 Wed, 17 Aug 2022 03:07:53 -0700 (PDT)
Received: from localhost ([115.154.175.57]) by smtp.gmail.com with ESMTPSA id
 o18-20020a05680803d200b0034290c4ed01sm2855069oie.41.2022.08.17.03.07.51
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 17 Aug 2022 03:07:52 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: rms@HIDDEN
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <E1oO98j-0008Lb-Um@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
 <877d3c7by7.fsf@localhost> <87h72gjr3a.fsf@HIDDEN>
 <87ilmw5o4j.fsf@localhost> <E1oNQTp-0006TB-JE@HIDDEN>
 <87k07ayz7u.fsf@localhost> <E1oO98j-0008Lb-Um@HIDDEN>
Date: Wed, 17 Aug 2022 18:08:56 +0800
Message-ID: <87wnb7yyfb.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57003
Cc: larsi@HIDDEN, 57003 <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: -0.8 (/)

Richard Stallman <rms@HIDDEN> writes:

>   > 'early-local will apply file/directory-local variables _before_ executing
>   > the major-mode body. In contrast, the variables without this property
>   > are applied _after_ executing the major-mode body.
>
> I suppose you'll do something to protect those local variables from
> `kill-all-local-variables' so it won't kill them.

No. Not killing the _already existing_ local variables is what
'persistent-local is for. What I am proposing here is only relevant to
buffer-local and directory-local variables that are going to be loaded
anyway. The change will only affect _when_ they are loaded.

> Will it distinguish THIS major mode's early local variables from the
> early local variables of the PREVIOUS major mode?  Those ought to be
> killed with all the rest.

I do not propose to keep the local variable values from the previous
major mode. What I suggest is running a part of hack-local-variables
earlier. Either way, file/directory-local variables will be set in the
buffer.

Hope I clarified the confusion.

-- 
Ihor Radchenko,
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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 17 Aug 2022 02:50:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 16 22:50:51 2022
Received: from localhost ([127.0.0.1]:48882 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oO98t-0001j0-9X
	for submit <at> debbugs.gnu.org; Tue, 16 Aug 2022 22:50:51 -0400
Received: from eggs.gnu.org ([209.51.188.92]:43652)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rms@HIDDEN>) id 1oO98p-0001iU-Eb
 for 57003 <at> debbugs.gnu.org; Tue, 16 Aug 2022 22:50:47 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:36346)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rms@HIDDEN>)
 id 1oO98k-0002jX-7w; Tue, 16 Aug 2022 22:50:42 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From:
 mime-version; bh=GmrSnOyWvWy3legmKUtwGeyKmD/1B+hkwBgRuu5e4/E=; b=EoYLXiSNhvJu
 fi9iHGq3LIbavF6KgfN/aSjHcNQBuMTqWBm0dMO4HW8p5YiwxsaWyhVV1/UDV4UnLrzg23gEcfpE0
 8lFM5n9U4Bd8PEIwB7YcQCh1AOARwj3D3EcwUPdS5LKHMMyxtiaNyQofjh7ioHsDnW6luuSezdcbq
 OO3M9XcDusZZFSYrWQLz2CE0BfPk1xS893CZFJzE9oRbhL8nziMCF0ZBRyI2FjJZ+djTj2t5n52CY
 HyFPercwmdX4TdG6Nj+zW1hH1HTWhuRkFa8Gn2jlKUNLb8BvngcyJOa3KLBZU0EbzUX8QR8yjd6TB
 dXLYQdl+0fXKEkt6vbTeeQ==;
Received: from rms by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <rms@HIDDEN>)
 id 1oO98j-0008Lb-Um; Tue, 16 Aug 2022 22:50:41 -0400
Content-Type: text/plain; charset=Utf-8
From: Richard Stallman <rms@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87k07ayz7u.fsf@localhost> (message from Ihor Radchenko on Mon,
 15 Aug 2022 11:15:01 +0800)
Subject: Re: bug#57003: 28.1.90;
 Can local variables be loaded before loading major mode?
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
 <877d3c7by7.fsf@localhost> <87h72gjr3a.fsf@HIDDEN>
 <87ilmw5o4j.fsf@localhost> <E1oNQTp-0006TB-JE@HIDDEN>
 <87k07ayz7u.fsf@localhost>
Message-Id: <E1oO98j-0008Lb-Um@HIDDEN>
Date: Tue, 16 Aug 2022 22:50:41 -0400
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: larsi@HIDDEN, 57003 <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>
Reply-To: rms@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > 'early-local will apply file/directory-local variables _before_ executing
  > the major-mode body. In contrast, the variables without this property
  > are applied _after_ executing the major-mode body.

I suppose you'll do something to protect those local variables from
`kill-all-local-variables' so it won't kill them.

Will it distinguish THIS major mode's early local variables from the
early local variables of the PREVIOUS major mode?  Those ought to be
killed with all the rest.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 15 Aug 2022 03:14:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 14 23:14:06 2022
Received: from localhost ([127.0.0.1]:40227 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oNQYH-0005Cx-T7
	for submit <at> debbugs.gnu.org; Sun, 14 Aug 2022 23:14:06 -0400
Received: from mail-pg1-f181.google.com ([209.85.215.181]:45032)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oNQYG-0005CM-1n
 for 57003 <at> debbugs.gnu.org; Sun, 14 Aug 2022 23:14:05 -0400
Received: by mail-pg1-f181.google.com with SMTP id c24so5546653pgg.11
 for <57003 <at> debbugs.gnu.org>; Sun, 14 Aug 2022 20:14:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc;
 bh=+y5yBgJtqwcd5tzgw6Milth9dzbBLtp2PZkqcesDQuI=;
 b=INIbTPwCh4Yye1tPfzoA7k2FBFqONee7XVmobW6ywAXqx609ugDnsmkhwO0sWgOXaH
 xf1vwIROvzs/7TK4m3dEaiRTgscOWoZiBiNmNfmew6EDpfCo9Yw7A/dhpo+MqIkZSeCg
 /rSvrlKQUWn/0iZhPFAsHRWqOJ1M02Kc/0ps9B968xKL5dyVxCco2PQWaZvtXxE1qKHS
 ecWdAmH9dPotnx/o6MCqmD1Kwei4L9zjuSl4B1pi6um+AfvAgSfcLnSivWIdgJ0RZKfz
 8S1cHcYrbX7RKiZFB0L18BdkvdB19RNG3514pW/dhBroU+UQFfF0NV0Aeewqktfif7hc
 4jIA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc;
 bh=+y5yBgJtqwcd5tzgw6Milth9dzbBLtp2PZkqcesDQuI=;
 b=7+csUd5kJ/SwoH60w/RxfjIpDk2qltMRIqy4RyZlt5Quh6lFWuS2cJWdVPMLLt8fCg
 jzATrFNg9xDpHvcAZVyAbSU3FNrotYoCCXycLX9Khddabyysg4Vebkadq6QdpwGFDrsK
 PKLdeU29fDUHjC35GjzWPnGbS5btx3twlxi9nOQji7lJJ6qJ47hfrF+JBCGBVBYfIDXP
 Jh78OYO5z6rS08gaLI5M0nyh9KLGg5114llpaHNYplsuk9UqO/78YTDKEwBLcvbW+msT
 q9B9+Y4NZiaGHD2TI4lvZluvBg0mVCavzFuotpLov/Bp8W9nTJjPI9i0D7FHT/peujMB
 geYQ==
X-Gm-Message-State: ACgBeo0wCUvFyxo8ud4+GQ1HpE04/MXyFxi6QleqxGYOkhyCUxJY8wkt
 ZgWLLEHqh5BceObCCUUh9K6tIORtNKBE6PFH
X-Google-Smtp-Source: AA6agR7FJY6bZOLy/FsNk6rOZB7hTk+1dOksUAce/k70rFVQlg31uVZry9ZJDFOO0WV1k6z4MjyL3g==
X-Received: by 2002:a63:e901:0:b0:422:4d27:5814 with SMTP id
 i1-20020a63e901000000b004224d275814mr10908410pgh.317.1660533238432; 
 Sun, 14 Aug 2022 20:13:58 -0700 (PDT)
Received: from localhost ([115.154.175.57]) by smtp.gmail.com with ESMTPSA id
 z6-20020a1709027e8600b0016d7afee272sm6048296pla.153.2022.08.14.20.13.57
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 14 Aug 2022 20:13:57 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: rms@HIDDEN
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <E1oNQTp-0006TB-JE@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
 <877d3c7by7.fsf@localhost> <87h72gjr3a.fsf@HIDDEN>
 <87ilmw5o4j.fsf@localhost> <E1oNQTp-0006TB-JE@HIDDEN>
Date: Mon, 15 Aug 2022 11:15:01 +0800
Message-ID: <87k07ayz7u.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 57003
Cc: larsi@HIDDEN, 57003 <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: -0.7 (/)

Richard Stallman <rms@HIDDEN> writes:

>   > Maybe something like 'early-local property instead of 'permanent-local?
>   > It will not break the existing cases, while allowing the major modes or
>   > users to mark the variables that are safe to load early.
>
> Could you spell out the behavior you propose `early-local' to have?
> From those three lines, I am not sure what it would do.

'early-local will apply file/directory-local variables _before_ executing
the major-mode body. In contrast, the variables without this property
are applied _after_ executing the major-mode body.

Currently, all the file/directory-locals are applied after executing the
major-mode body.

-- 
Ihor Radchenko,
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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 15 Aug 2022 03:09:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 14 23:09:39 2022
Received: from localhost ([127.0.0.1]:40213 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oNQTz-00055f-E8
	for submit <at> debbugs.gnu.org; Sun, 14 Aug 2022 23:09:39 -0400
Received: from eggs.gnu.org ([209.51.188.92]:39408)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rms@HIDDEN>) id 1oNQTv-00055Q-Iz
 for 57003 <at> debbugs.gnu.org; Sun, 14 Aug 2022 23:09:38 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:58906)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rms@HIDDEN>)
 id 1oNQTq-0006CW-9a; Sun, 14 Aug 2022 23:09:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From:
 mime-version; bh=s/a4KQLGJZk8/fwuXkqvwm9P0L+5GX6lyzciUj10P3k=; b=AssYg99L+Spp
 UDdAXEqjb+I65+aWackr72zV06OVnEwvKKe+shrIfuC38JAjqm2uU8sYS43oCQv7l+nsi9ovlzbsA
 z2Jwc5N8DnMxMhrXYg/6sStjdrIn57skJOKjLQAw2inwfJ7W6orcqOJ9c/zs7ibq8G7x3qJQtvxiu
 E71tqPTA5iCklWSthg0v8jUiUi0rZaF5n2kS8FG7Nq/6b/Zo1cwc9iqf6MpAGj+3eZAXKkE0B7QXY
 DJEon7deRz+LGQ4WNi3HM3RJjvZQuErij8I7NpMAe/9KJPxamVpQc2fAesNIf8bVGEQVnx0ecV1Pq
 1OrKYCnyqvNIn3+wSc+ckg==;
Received: from rms by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <rms@HIDDEN>)
 id 1oNQTp-0006TB-JE; Sun, 14 Aug 2022 23:09:29 -0400
Content-Type: text/plain; charset=Utf-8
From: Richard Stallman <rms@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87ilmw5o4j.fsf@localhost> (message from Ihor Radchenko on Sat,
 13 Aug 2022 20:22:52 +0800)
Subject: Re: bug#57003: 28.1.90;
 Can local variables be loaded before loading major mode?
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
 <877d3c7by7.fsf@localhost> <87h72gjr3a.fsf@HIDDEN>
 <87ilmw5o4j.fsf@localhost>
Message-Id: <E1oNQTp-0006TB-JE@HIDDEN>
Date: Sun, 14 Aug 2022 23:09:29 -0400
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: larsi@HIDDEN, 57003 <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>
Reply-To: rms@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > So I'd really prefer a new way to specify "early variables", but I have
  > > no idea how that'd look in practice.  Perhaps just a new thing in
  > > .dir-local.el, making that backwards-compatible is a challenge in
  > > itself.

  > Maybe something like 'early-local property instead of 'permanent-local?
  > It will not break the existing cases, while allowing the major modes or
  > users to mark the variables that are safe to load early.

Could you spell out the behavior you propose `early-local' to have?
From those three lines, I am not sure what it would do.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 13 Aug 2022 12:33:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 13 08:33:07 2022
Received: from localhost ([127.0.0.1]:60006 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oMqKB-0005Ee-6V
	for submit <at> debbugs.gnu.org; Sat, 13 Aug 2022 08:33:07 -0400
Received: from quimby.gnus.org ([95.216.78.240]:36536)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oMqK9-0005Dv-Ls
 for 57003 <at> debbugs.gnu.org; Sat, 13 Aug 2022 08:33:06 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=3jajvgIeC7XRCgHJb1UBXuLvHjN4JAfYLtoYaBBJ2Hk=; b=KHX2RD7V0E33JmAG37E6D0sHtx
 GqaLb75bPEAA3SG8ZKQYQsCSlj098BXe43JmFxfywgq+tkypXLb6ygRd9crp8FdfVzsKNKc2hMsb1
 9+5nL0vStaROV+H7xg/RQ6JYShiWcrVB5W4UyMctMDGjHiJuPOl7+1zVqx9mH88tLaU0=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oMqK1-0007aS-NW; Sat, 13 Aug 2022 14:32:59 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87ilmw5o4j.fsf@localhost> (Ihor Radchenko's message of "Sat, 13
 Aug 2022 20:22:52 +0800")
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
 <877d3c7by7.fsf@localhost> <87h72gjr3a.fsf@HIDDEN>
 <87ilmw5o4j.fsf@localhost>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEXWm5WzlJixZWlX
 QEnCgX0YEBj///+frFP4AAAAAWJLR0QGYWa4fQAAAAd0SU1FB+YIDQweOUyNj5AAAAG0SURBVDjL
 XZNRlusgCIZp631vZgU9aDYg43smdTYQTva/lQuCmo4PbQ9f+X9ABOjntvhBjEQE8/wsyxMGGeFQ
 9cByMxAHWJ6bfS9fqkTw9ITFf/xYnIByi1SwBNjNWwAR4narHldAORqgk/LwqhWtqrOd754AdyTz
 MPAa4EEWcVC3UD3jvALe9pafcYPSATXRQn7SBEkGKAnsZICTc5IuQvyINw+mJONzVD7NM1bJ0jF9
 As1qSLz+gIZEscZyAV1A+pA5fZijS+ioLadlZL3UvQxN6hnftQ0qTjsHmGyAX6PY4uA1lmsU+QfA
 egGcLlvXp65A73ubYDb4miDAnQdgWys7+c1D6mg37SlYprlV5HU9Zrnc1UVvr4UHyCaiKxrgTWMs
 gH0zBWC8eKA/myBtPjhOD29bNi7B/VgvoHmEhIWxHOXszFoLe3qXM59ZaDYbG4YugQxNgnk9/hlo
 CaHqymapKjLCBPqMBCCuXPILfhsIqlV1aVhX55AqQwO7tty26dgVbH6NUm6APdXIlJM48OajBNRX
 1qRkDVfRG0Bel0i1ovQzdSlEfcLyXykKtQL5m5r/B0or0xJYJ1b3AAAAJXRFWHRkYXRlOmNyZWF0
 ZQAyMDIyLTA4LTEzVDEyOjMwOjU3KzAwOjAwbPXPkAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0w
 OC0xM1QxMjozMDo1NyswMDowMB2odywAAAAASUVORK5CYII=
X-Now-Playing: Joni Mitchell's _Chalk Mark In A Rain Storm_: "Number One"
Date: Sat, 13 Aug 2022 14:32:57 +0200
Message-ID: <871qtkiarq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Ihor Radchenko <yantar92@HIDDEN> writes: > Maybe something
 like 'early-local property instead of 'permanent-local? > It will not break
 the existing cases, while allowing the major modes or > users to mark the
 variables that are safe to load [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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 (---)

Ihor Radchenko <yantar92@HIDDEN> writes:

> Maybe something like 'early-local property instead of 'permanent-local?
> It will not break the existing cases, while allowing the major modes or
> users to mark the variables that are safe to load early.

Hm, yes, that sounds like a possibility.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 13 Aug 2022 12:21:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 13 08:21:58 2022
Received: from localhost ([127.0.0.1]:59955 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oMq9O-0002k5-2d
	for submit <at> debbugs.gnu.org; Sat, 13 Aug 2022 08:21:58 -0400
Received: from mail-pl1-f177.google.com ([209.85.214.177]:37809)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oMq9M-0002jq-DI
 for 57003 <at> debbugs.gnu.org; Sat, 13 Aug 2022 08:21:56 -0400
Received: by mail-pl1-f177.google.com with SMTP id m2so2845274pls.4
 for <57003 <at> debbugs.gnu.org>; Sat, 13 Aug 2022 05:21:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc;
 bh=4+quR1fy76FJLSkGohcl75WFiqUnAAqMzvlQuUmVvHA=;
 b=Np/a74Y98obr0kzPlLNmce9nSWXefrLoHcgPl60PnYXsDPivXGuTSrYzF/uvNxq/y8
 I+/j2RdjBLlz4046yUPNZ8MThJk/JGmU9pRj0tqDVsbCpYgAbejhzzhrtoTRDk2gIB4b
 1y2Bpp1y5OWyQGycshxTPlIqsGBhvDZm4l6uMTX6DvzuNRrS9MO+6dD+RL3JJ7EMnjNp
 ql9WE+jBJs8HRD27xWz7vMQUXYp7PuwYF5kioNYsL+vD5Bd6oJSk4InODQQHrDoAX2x1
 +hlZ5Xl2nTm43bZoWIGIpc1ZuYljNjRl2PZDnI1jc313AOpAfO9qJRVvcRcdUx+r4354
 jmTA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc;
 bh=4+quR1fy76FJLSkGohcl75WFiqUnAAqMzvlQuUmVvHA=;
 b=L4VmCoaMvFq28dUT59+AFYeZBXLF4TJMdgTdrqszL8IMeHtJyKQTf6084ecY4pa9eH
 kN5cGqWD7Ji2YI8lK5p4AvAcHV+4lQwWK8iZoLXzies1cnekw2Jo0A7E7UBqsMDFnHc6
 QgP1DMo+jIWqF3UQ74wXuY3x48QwhPJDsNmLmOz/iRuE5KZ8Zr9EswOXjrExJysNY4Zl
 i4oZUhfQjhjOjBZF8SPElLz83hDc9Tnyh7kSYuw/0Rx9V061sgUB3K6z7DVrjeWJSfgb
 HvEGeEbDnWbD61eOnxmq1Ia5Uc+yeH+fx5KT2Qdhx5nx1lyzuJMvbS3Axi7CVjkXdp6F
 U8KA==
X-Gm-Message-State: ACgBeo3Wy4BHIK34qNd3eGbAO4UBSteUu9Er6YbI3ZypCQoxvOaenbMo
 k3L3vSTKtTM9OKhKgxeV4oU=
X-Google-Smtp-Source: AA6agR6QCA9+4Bko075VUcxzcWpnD8sT5vpX+A5w90c7zCcpJiX+et8wLiHrm8MkkdM4k/msSp62lQ==
X-Received: by 2002:a17:902:e394:b0:171:3f46:1f13 with SMTP id
 g20-20020a170902e39400b001713f461f13mr7943530ple.174.1660393310634; 
 Sat, 13 Aug 2022 05:21:50 -0700 (PDT)
Received: from localhost ([2409:8a70:2bf:80b0:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 i18-20020a170902cf1200b0016c38eb1f3asm3527849plg.214.2022.08.13.05.21.49
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 13 Aug 2022 05:21:50 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87h72gjr3a.fsf@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
 <877d3c7by7.fsf@localhost> <87h72gjr3a.fsf@HIDDEN>
Date: Sat, 13 Aug 2022 20:22:52 +0800
Message-ID: <87ilmw5o4j.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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: -0.7 (/)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> This area is notoriously brittle and complicated.  I worry that any
> change in evaluation order is going to break lots of stuff for various
> use cases.

Agree.

> So I'd really prefer a new way to specify "early variables", but I have
> no idea how that'd look in practice.  Perhaps just a new thing in
> .dir-local.el, making that backwards-compatible is a challenge in
> itself.

Maybe something like 'early-local property instead of 'permanent-local?
It will not break the existing cases, while allowing the major modes or
users to mark the variables that are safe to load early.

-- 
Ihor Radchenko,
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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 13 Aug 2022 11:55:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 13 07:55:16 2022
Received: from localhost ([127.0.0.1]:59867 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oMpjX-0001zo-PC
	for submit <at> debbugs.gnu.org; Sat, 13 Aug 2022 07:55:16 -0400
Received: from quimby.gnus.org ([95.216.78.240]:36002)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oMpjV-0001zX-VF
 for 57003 <at> debbugs.gnu.org; Sat, 13 Aug 2022 07:55:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=vclDtIXo9HDZu58lfqqhQ9KOaySHTKMT9ppOJKSCjc8=; b=nqjk1Z+d8eRLBed51wSqd95ksq
 ZjiYLbmP4SPmEyieh5M9a5j9c+m/yvgfG1ds+ZFXHjBT6078jTepWCznnsc68/oZepcfKifFs2snD
 kk6gSy+w17CGkomX77JXp4GZzjzHvKNuW4N3fb6qm+cjdWLQ6OublGtgZz6p2/A71huk=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oMpjN-0007HX-Rq; Sat, 13 Aug 2022 13:55:07 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <877d3c7by7.fsf@localhost> (Ihor Radchenko's message of "Sat, 13
 Aug 2022 17:02:56 +0800")
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
 <877d3c7by7.fsf@localhost>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEU7MjeVWmXe1cr/
 //9HfuA7AAAAAWJLR0QDEQxM8gAAAAd0SU1FB+YIDQssKM4C7ZYAAAFLSURBVCjPTZFBbsIwEEX/
 WEmksjJSsiBHyClsqek6SDYL1kUqOUXgBHRB11RKKuJTdmzHgBfWPM/4j/0H4FVc/I467KvhBWr1
 Ao0CGS6IAFQ2wREwunsA/cwGRQAH9PNBRWiGvJktdlFzoH5usY9Nod2cUwQg70fSHwvg8wtbSsCZ
 LsWoL0/IAVIJysxzggLZEmYw4pbAwtC0xNSiFFOq05BikktKE8SYlCmHuD3atCh+8VRY3RJU76jH
 cMrvq9iMeyjvQNZCzB7eFBtocQovaBU4xjkMQimybLX+jpOoGHK6RG3qWmyyboxftp08Bvd9xpbZ
 vVI9SxCDovnI1kusQVvF7sLxLGSwyd2Fc4MHRTyExjkvXknQ/to7LpUw/Pv+unJ8SYOHjkPLd/7Y
 M7/MTvuMiePxMC2ZcqO9GreHQlacQsas2fms2DL8A0kSVvj+DBcIAAAAJXRFWHRkYXRlOmNyZWF0
 ZQAyMDIyLTA4LTEzVDExOjQ0OjQwKzAwOjAw+OIotwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0w
 OC0xM1QxMTo0NDo0MCswMDowMIm/kAsAAAAASUVORK5CYII=
X-Now-Playing: Joni Mitchell's _Dog Eat Dog_: "The Three Great Stimulants"
Date: Sat, 13 Aug 2022 13:55:05 +0200
Message-ID: <87h72gjr3a.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Ihor Radchenko <yantar92@HIDDEN> writes: > What can be
 probably done is a call to `hack-local-variables' inside >
 `kill-all-local-variables', 
 but setting only the variables marked > 'permanent-local. The later call
 to `hack-local-variables' [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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 (---)

Ihor Radchenko <yantar92@HIDDEN> writes:

> What can be probably done is a call to `hack-local-variables' inside
> `kill-all-local-variables', but setting only the variables marked
> 'permanent-local. The later call to `hack-local-variables' inside
> `run-mode-hooks' may then only go through the remaining variables.

This area is notoriously brittle and complicated.  I worry that any
change in evaluation order is going to break lots of stuff for various
use cases.

So I'd really prefer a new way to specify "early variables", but I have
no idea how that'd look in practice.  Perhaps just a new thing in
.dir-local.el, making that backwards-compatible is a challenge in
itself.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 13 Aug 2022 11:53:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 13 07:53:03 2022
Received: from localhost ([127.0.0.1]:59853 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oMphP-0001vs-LS
	for submit <at> debbugs.gnu.org; Sat, 13 Aug 2022 07:53:03 -0400
Received: from quimby.gnus.org ([95.216.78.240]:35966)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oMphN-0001vP-GR
 for 57003 <at> debbugs.gnu.org; Sat, 13 Aug 2022 07:53:01 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=3bT8HYInHoPi29ibZd6jkUCGHSC87yCyWJ+FHh2SR4c=; b=rTywAm1qX/5nAhBkrlP6RMDfdk
 AdOjBl5EP8Zyt9eZHKRFI6VJ8iLlgS2ukqpf80Ior6TPqOjfjXfEJnJt7sxXEgNAijfRRUQPV6ySN
 zKajbHWoRpydYCqdOZtw2pXqS7h0W2Zt2iuQJra16qk8Vf4eCGU/S+PFsf2DUQOPBt1k=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oMphE-0007Gz-On; Sat, 13 Aug 2022 13:52:55 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Phil Sainty <psainty@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <8d5495b94426dfed88899e46dc68db50@HIDDEN> (Phil
 Sainty's message of "Sat, 13 Aug 2022 13:33:31 +1200")
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
 <8d5495b94426dfed88899e46dc68db50@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEU7MjeVWmXe1cr/
 //9HfuA7AAAAAWJLR0QDEQxM8gAAAAd0SU1FB+YIDQssKM4C7ZYAAAFLSURBVCjPTZFBbsIwEEX/
 WEmksjJSsiBHyClsqek6SDYL1kUqOUXgBHRB11RKKuJTdmzHgBfWPM/4j/0H4FVc/I467KvhBWr1
 Ao0CGS6IAFQ2wREwunsA/cwGRQAH9PNBRWiGvJktdlFzoH5usY9Nod2cUwQg70fSHwvg8wtbSsCZ
 LsWoL0/IAVIJysxzggLZEmYw4pbAwtC0xNSiFFOq05BikktKE8SYlCmHuD3atCh+8VRY3RJU76jH
 cMrvq9iMeyjvQNZCzB7eFBtocQovaBU4xjkMQimybLX+jpOoGHK6RG3qWmyyboxftp08Bvd9xpbZ
 vVI9SxCDovnI1kusQVvF7sLxLGSwyd2Fc4MHRTyExjkvXknQ/to7LpUw/Pv+unJ8SYOHjkPLd/7Y
 M7/MTvuMiePxMC2ZcqO9GreHQlacQsas2fms2DL8A0kSVvj+DBcIAAAAJXRFWHRkYXRlOmNyZWF0
 ZQAyMDIyLTA4LTEzVDExOjQ0OjQwKzAwOjAw+OIotwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0w
 OC0xM1QxMTo0NDo0MCswMDowMIm/kAsAAAAASUVORK5CYII=
X-Now-Playing: Joni Mitchell's _Dog Eat Dog_: "Fiction"
Date: Sat, 13 Aug 2022 13:52:52 +0200
Message-ID: <87lersjr6z.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Phil Sainty <psainty@HIDDEN> writes: > Just as
 `kill-all-local-variables'
 runs `change-major-mode-hook' > before doing anything else, it could run
 another hook at the end > before returning. I think that may be a promising
 approach -- it'd allow modes to opt in to "early file-locals". 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <at> debbugs.gnu.org, Ihor Radchenko <yantar92@HIDDEN>
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 (---)

Phil Sainty <psainty@HIDDEN> writes:

> Just as `kill-all-local-variables' runs `change-major-mode-hook'
> before doing anything else, it could run another hook at the end
> before returning.

I think that may be a promising approach -- it'd allow modes to opt in
to "early file-locals".






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 13 Aug 2022 09:02:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 13 05:02:04 2022
Received: from localhost ([127.0.0.1]:59665 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oMn1w-0001gG-9N
	for submit <at> debbugs.gnu.org; Sat, 13 Aug 2022 05:02:04 -0400
Received: from mail-pg1-f174.google.com ([209.85.215.174]:39752)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oMn1t-0001fj-My
 for 57003 <at> debbugs.gnu.org; Sat, 13 Aug 2022 05:02:03 -0400
Received: by mail-pg1-f174.google.com with SMTP id q16so2643762pgq.6
 for <57003 <at> debbugs.gnu.org>; Sat, 13 Aug 2022 02:02:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc;
 bh=TqgWVexzelbDBHTwY87hXZUZn3EMzgxjOhMeOG0ld4E=;
 b=Zvo0QuWty6f4V3mZFU6Ff1eGf2YE/P+x+WMIozLryAK5+qlsTbRcMv7tiD/Dx0B+k9
 Z93Aa5MRhNjuymzlPqnJ5yywWRkWcFpDYdlerSVNxRitXNDnbbJ5cR6NnrzvZSTZZoYs
 cU5eLa9457LhKc3kAs6mY9pQcAF9saJLmgbN5VFqflLy498Fs4M8OuoHsqWTUZNwNStd
 u5vcozruAAU3kVm1npaKXH9xsDyPzX+WHzR/4cxKWtZ65N2dSZ35u5aAcfGtayQxYU0k
 F/DZEg/Pf4GiVgpK5kSlDuDI1+xcaBOXd/6gb/B637x9+65Q1S+OSQEmR+MnUDubIyXb
 GhHg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc;
 bh=TqgWVexzelbDBHTwY87hXZUZn3EMzgxjOhMeOG0ld4E=;
 b=kZWGXx1zXMdNUBscZugr/OjceXmgDM+vWkOSESkDJlBLjRWvBo2lzP9GQXg5v+pXjE
 j2plyq0roEoSd00R1wVmbi8Xofqm/AAbSlJgdj+O8tALV89dHA/9ujzd3fpWaSQK6SKj
 3UEAUcOtEuPSU4SbzcfbBQJyLjzpfZ1h9ULv8MjqaGHM5ykhVqp7sMReov1yVCGRQ6jw
 Y7oAQgp+QMQdOkXzFILPl5Y2tzN2LekySut6HlQ4XeZT2VU//d3VzmYJCPgD0J7Uj2Jk
 PnGl9FF0rV8z1CBmeQrAkndkt0AOCxNBwap2P2u+s75M+XdfTpYB6srpCy+seaPCJKZ3
 ky7A==
X-Gm-Message-State: ACgBeo3xZ+w2EZ1KD2ZgS5l7UzY9jWsj6veot+SoKKhV8hzTlObiRFNg
 6Y/isdpyVaRxKO8IOGkPMynwF5sz9g/r4Q==
X-Google-Smtp-Source: AA6agR4EM3l5Uo6RNnRIelr2YjyTbBSfjmUY8Ql/BFHr7Yqc5c8M6TJvhOW25TncPq/tY2M4bBnXhQ==
X-Received: by 2002:a63:6d2:0:b0:41c:18f2:8ec5 with SMTP id
 201-20020a6306d2000000b0041c18f28ec5mr6298548pgg.197.1660381315846; 
 Sat, 13 Aug 2022 02:01:55 -0700 (PDT)
Received: from localhost ([2409:8a70:2bf:80b0:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 w9-20020a627b09000000b0052ddccd7b64sm3002427pfc.205.2022.08.13.02.01.53
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 13 Aug 2022 02:01:54 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <878rntskld.fsf@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
Date: Sat, 13 Aug 2022 17:02:56 +0800
Message-ID: <877d3c7by7.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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: -0.7 (/)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

>> Why not instead add something that is run _after_
>> kill-all-local-variables? Then, there will be no need to fiddle with
>> 'permanently-local (which might have undesired side effects).
>
> That'd work for things that use `define-derived-mode', but not all modes
> are defined that way and call `kill-all-local-variables' "manually".

I found such a case in ses.el. However, I am not sure if much can be
done mode-specifically in such scenario. Major modes using a custom
function may set the value of `major-mode' anywhere down to right before
`run-mode-hooks' call.

The only universal option then is indeed your suggestion about permanent
local variables. They were overridden by hack-local-variables in the
past anyway.

What can be probably done is a call to `hack-local-variables' inside
`kill-all-local-variables', but setting only the variables marked
'permanent-local. The later call to `hack-local-variables' inside
`run-mode-hooks' may then only go through the remaining variables.

WDYT?

-- 
Ihor Radchenko,
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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 13 Aug 2022 01:33:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 12 21:33:41 2022
Received: from localhost ([127.0.0.1]:59289 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oMg21-0004px-LS
	for submit <at> debbugs.gnu.org; Fri, 12 Aug 2022 21:33:41 -0400
Received: from smtp-4.orcon.net.nz ([60.234.4.59]:45787)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <psainty@HIDDEN>) id 1oMg1w-0004pk-Fn
 for 57003 <at> debbugs.gnu.org; Fri, 12 Aug 2022 21:33:41 -0400
Received: from [10.253.37.70] (port=18055 helo=webmail.orcon.net.nz)
 by smtp-4.orcon.net.nz with esmtpa (Exim 4.90_1)
 (envelope-from <psainty@HIDDEN>)
 id 1oMg1r-0005fY-Eq; Sat, 13 Aug 2022 13:33:31 +1200
Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135])
 via [10.253.37.253] by webmail.orcon.net.nz
 with HTTP (HTTP/1.1 POST); Sat, 13 Aug 2022 13:33:31 +1200
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Date: Sat, 13 Aug 2022 13:33:31 +1200
From: Phil Sainty <psainty@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major =?UTF-8?Q?mode=3F?=
In-Reply-To: <878rntskld.fsf@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost> <878rntskld.fsf@HIDDEN>
Message-ID: <8d5495b94426dfed88899e46dc68db50@HIDDEN>
X-Sender: psainty@HIDDEN
User-Agent: Orcon Webmail
X-GeoIP: --
X-Spam_score: -2.9
X-Spam_score_int: -28
X-Spam_bar: --
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <at> debbugs.gnu.org, Ihor Radchenko <yantar92@HIDDEN>
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: -1.0 (-)

On 2022-08-13 00:38, Lars Ingebrigtsen wrote:
> Ihor Radchenko <yantar92@HIDDEN> writes:
>> Why not instead add something that is run _after_
>> kill-all-local-variables?
> 
> That'd work for things that use `define-derived-mode', but not all 
> modes
> are defined that way and call `kill-all-local-variables' "manually".

Just as `kill-all-local-variables' runs `change-major-mode-hook'
before doing anything else, it could run another hook at the end
before returning.

(Caveat: I've not been following this discussion recently, so I'm
not actually sure if that covers the requirement or not.)






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 12 Aug 2022 12:38:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 12 08:38:36 2022
Received: from localhost ([127.0.0.1]:55851 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oMTvw-0003Ic-5v
	for submit <at> debbugs.gnu.org; Fri, 12 Aug 2022 08:38:36 -0400
Received: from quimby.gnus.org ([95.216.78.240]:53984)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oMTvs-0003IO-JH
 for 57003 <at> debbugs.gnu.org; Fri, 12 Aug 2022 08:38:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=ymu96ASrzFRv4gNmS33iPPrIvNzmp5O80uCHO0Zf+Hc=; b=OXw+/Kx+a+fINAcJrqSfOlOYgL
 UjQV/hzEC7qxgajAs1w8f2s8Tsf0ryoHH9xGiVgphVTm7V3BgCkUS56fPf/2zvxUjd69N3Jt/giZz
 cIdLN0I5O87T6JKnPFGddm9zjU9PxFq4mdlLszonwg4zyPV58UePOUOA2AdZCaXnFftM=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oMTvj-0004iZ-Jd; Fri, 12 Aug 2022 14:38:26 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <871qtp64eq.fsf@localhost> (Ihor Radchenko's message of "Tue, 09
 Aug 2022 19:29:49 +0800")
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
 <871qtp64eq.fsf@localhost>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAALVBMVEX9/fPd3drBpZGb
 d4I0JihRQUJhV1yXaVoHBgspFhxOMC1mMTCeUzy+kXD///+LNd4MAAAAAWJLR0QOb70wTwAAAAd0
 SU1FB+YIDAwlBwniGmYAAAE1SURBVDjLY2AYAYBRAJeEkoAgI4OgoCCGhCACoOhmdg0FgrC09LK0
 9PRUINMAKsHWAQQzp8xaumvV8VUrgOwEZIlZS1xcU2eVu3jMmIEq0TllideqFakeHeg6OqdEeXnt
 dJ2BLtE502XVEvfyEgyJ2Z6eXqt871Z1oEl01sxc1eKy9q4L0I5OuATzio5e4VmzPT3W6nZ4Iutg
 3rNtTfnqli0npld1zESRmF1zunzLrKMnW2d0uE7xRLJj5qrj6TNnHwm/lNKB4ir2mV3HV+fWXump
 TVMqQXHVzN3dtXfvXj91PFdJqbjKcwVcYveps+VVe07P2L3s0t27WUt2wiSYzpbfXgUELjNnTnFZ
 CTQqACZRpGueblxelgYFqbD4wB3pSJEsIAiMfGzqgMlCUICgAaOA7gAAlKmXRLWPAKcAAAAldEVY
 dGRhdGU6Y3JlYXRlADIwMjItMDgtMTJUMTI6Mzc6MDcrMDA6MDBooUscAAAAJXRFWHRkYXRlOm1v
 ZGlmeQAyMDIyLTA4LTEyVDEyOjM3OjA3KzAwOjAwGfzzoAAAAABJRU5ErkJggg==
X-Now-Playing: Two Nice Girls's _2 Nice Girls_: "Looking Out"
Date: Fri, 12 Aug 2022 14:38:22 +0200
Message-ID: <878rntskld.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Ihor Radchenko <yantar92@HIDDEN> writes: > The first thing
 executed when activating a major-mode is (according to > define-derived-mode)
 kill-all-local-variables which consist of > > run_hook
 (Qchange_major_mode_hook); > reset_buffer_local_v [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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 (---)

Ihor Radchenko <yantar92@HIDDEN> writes:

> The first thing executed when activating a major-mode is (according to
> define-derived-mode) kill-all-local-variables which consist of
>
>   run_hook (Qchange_major_mode_hook);
>   reset_buffer_local_variables (current_buffer, 0);
>   bset_update_mode_line (current_buffer);
>
> Having 'permanent-local variables will only affect
> change-major-mode-hook. I know no other hook ran earlier.
>
> Why not instead add something that is run _after_
> kill-all-local-variables? Then, there will be no need to fiddle with
> 'permanently-local (which might have undesired side effects).

That'd work for things that use `define-derived-mode', but not all modes
are defined that way and call `kill-all-local-variables' "manually".





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 9 Aug 2022 11:28:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 09 07:28:58 2022
Received: from localhost ([127.0.0.1]:42715 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oLNPu-00085w-HU
	for submit <at> debbugs.gnu.org; Tue, 09 Aug 2022 07:28:58 -0400
Received: from mail-pf1-f173.google.com ([209.85.210.173]:38785)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oLNPq-00085g-GA
 for 57003 <at> debbugs.gnu.org; Tue, 09 Aug 2022 07:28:55 -0400
Received: by mail-pf1-f173.google.com with SMTP id d20so10514465pfq.5
 for <57003 <at> debbugs.gnu.org>; Tue, 09 Aug 2022 04:28:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version; bh=zZcOjXB7qM+AJo/c9TixJqyazkfjzj2G95PUNe6H9Co=;
 b=CRPFh8jHzhJvD7Qo/bMk7nIhHzAAEoPfhnYZRy7c7NpksZqUJ4xzjLgy260BV8QeD9
 jMdTzFZUdfZ9e5kEe5rrMh6iTebhxsUolveOq5c+jII15HRXGUCwmDTWOkKtuaso4pm8
 BqJwOI1/oIXoeqDlDv4Gd1XbZO1xPQiRyTj+22UqH4H7sQXaR2Z8aAqvHbiGduFB5MQI
 sfROqtaACDUYRtg4XgHjYZzrPgDDOV9BgNLp/tFMpfC+dzv5WfT7a7HoCQqPa1CWMmpG
 y7trnwFP5pFcvNK+Vn8WZIS250OpGFF+C12lAXdmCACEqaGeG/SQeRWvtXJduJkS7GuQ
 fAnw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date
 :message-id:mime-version;
 bh=zZcOjXB7qM+AJo/c9TixJqyazkfjzj2G95PUNe6H9Co=;
 b=daQDcvzepz3WTgXPeO3qFO/nH/C/h/rCxWfvLlPvb8F16NJCzHMqptmoanmOj/YBs4
 FHr68h5ELHeufd2Ldqdm4RK0RNo3H03bJ2jx5J+y1dR4US8lOpqtIsDXSJYrw/d3ZuYe
 cvYu163P1mMKVUUQp0kSU2rkAHEyE8bYPLoVfdEbzOb2jRpAcEt8n8RQWlWY7OcwOWIT
 yG7Vh67VW1L/IqjtOvFe04XpUcexj0vKPA9pQ4xTIwX+md7ojW2FAYnkkPdeIdfA9ySP
 FDB3uNMLat3Q8E4fQs3UoyN1DBAXVZDN6xUtXn4AC1w+aT9tY1cBMD6j2pehRuZyM7CZ
 CUpw==
X-Gm-Message-State: ACgBeo3zg54sp53Fb5mNvLjWqMLE9Pb+iFJojBfsUOsqb+gN54VdvNOo
 I/UnTr7ctLdmSXTTfNTorCSrfHCT8cQ=
X-Google-Smtp-Source: AA6agR6Gy72ykncsrt05+Smd7QqesPl2e1EpPKI3CRuSLryxCH94mVA4XiRnF+SQyMD2r+uJWjpPvA==
X-Received: by 2002:a63:6a05:0:b0:41d:ba0a:6fe5 with SMTP id
 f5-20020a636a05000000b0041dba0a6fe5mr4133757pgc.306.1660044528355; 
 Tue, 09 Aug 2022 04:28:48 -0700 (PDT)
Received: from localhost ([2409:8a70:2bf:80b0:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 f4-20020a170902ce8400b0016cd74dae66sm10787556plg.28.2022.08.09.04.28.46
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 09 Aug 2022 04:28:47 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <875yj2zudw.fsf@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost> <875yj2zudw.fsf@HIDDEN>
Date: Tue, 09 Aug 2022 19:29:49 +0800
Message-ID: <871qtp64eq.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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: -0.7 (/)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Sorry, phrased that all wrong -- I meant that if we had a mechanism to
> read the dir-locals earlier, then if you make the variables
> permanently-local, then things would indeed work fine without any
> further scaffolding here.
>
> So perhaps we should just allow that, but I'm not sure how we'd specify
> this.

I am not sure what you mean by earlier.

The first thing executed when activating a major-mode is (according to
define-derived-mode) kill-all-local-variables which consist of

  run_hook (Qchange_major_mode_hook);
  reset_buffer_local_variables (current_buffer, 0);
  bset_update_mode_line (current_buffer);

Having 'permanent-local variables will only affect
change-major-mode-hook. I know no other hook ran earlier.

Why not instead add something that is run _after_
kill-all-local-variables? Then, there will be no need to fiddle with
'permanently-local (which might have undesired side effects).

Best,
Ihor







Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 8 Aug 2022 14:23:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 08 10:23:52 2022
Received: from localhost ([127.0.0.1]:41421 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oL3fc-0001aN-31
	for submit <at> debbugs.gnu.org; Mon, 08 Aug 2022 10:23:52 -0400
Received: from quimby.gnus.org ([95.216.78.240]:40470)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oL3fY-0001a0-UD
 for 57003 <at> debbugs.gnu.org; Mon, 08 Aug 2022 10:23:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=BmrnXcCGvPpWPpMELeObgkOUFazsSH19Ho/5TcyJXQw=; b=PLgCYcHTLsMFXRoY1t+WgWV5kv
 HRb0dLrK2INY9ITOg3mrmOPRtrqCF+YpIAdzX11U6fswuJ5iOYMgJ9hCpXFrkv20vSLqZNNuXjBeU
 1LtRbOrmLV6U9C/j/2gILJkYJekl8MjujUVx9Vpb94a2jCLbozsMJd+7htZT7ILbfjYI=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oL3fQ-0001L3-DR; Mon, 08 Aug 2022 16:23:42 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87a68ezycj.fsf@localhost> (Ihor Radchenko's message of "Mon, 08
 Aug 2022 20:58:04 +0800")
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
 <87a68ezycj.fsf@localhost>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEVdXFx+foGenaAx
 Ly7////2IpWJAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+YICA4WCZbXEWgAAAF1SURBVDjLlZRtmsMg
 CISH9QJqLhDpBch6/7vtAE3bpP5Z0sekvgz4gQJh0mqV2tK0a6voj773XVVH5/Oz/wxhKzusHvVo
 Og4qjmJ8wMcmpptKyfdpWwLR7H+DMmEwUQEjmDfTo3kDIlV89M3j4WKG+pUxP+3YEljf57cZ0GS0
 m3HGHdK73s09wfZCRnQ3hW7GlWpOR/5OwDRy1QgceCau5aeFPkG5jDRDNd+M7Q6o6FTotlAsQD1z
 yFKxBv3foI0VYPWsgZdSzrzfgZ7gcQHDl3Kl8BpVVO67ALcNZyhWzIEyr4Slwiopvgcv53MH7p4v
 wyV0uQLLzx7F/K2Ag7oCXkEvUN5AovBersiGaSQkOFOiRD5Y7vR4+ucZ5Lx5fthPReMRojeH/nRg
 ikwS3T4nf4dAPRJ3bkqdXNozZlT88AE/5+g62DRxBdOMveRQubDmIEvc515KDDSmYOmBuGb8yoj/
 Epo4FnFM3kB4vcD7Gr9InZf5B6vekdJLhQZ3AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA4LTA4
 VDE0OjIyOjA5KzAwOjAwzMmKdwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wOC0wOFQxNDoyMjow
 OSswMDowML2UMssAAAAASUVORK5CYII=
X-Now-Playing: The Ex's _Live-Skive_: "Punk Horse"
Date: Mon, 08 Aug 2022 16:23:39 +0200
Message-ID: <875yj2zudw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Ihor Radchenko <yantar92@HIDDEN> writes: >>> Having Emacs
 support early setting would be much easier. >> >> You could make the relevant
 Org variables `permanent-local' -- then >> calling `org-mode' won't clear
 them out. > > Could you please [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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 (---)

Ihor Radchenko <yantar92@HIDDEN> writes:

>>> Having Emacs support early setting would be much easier.
>>
>> You could make the relevant Org variables `permanent-local' -- then
>> calling `org-mode' won't clear them out.
>
> Could you please elaborate on how it is going to help with loading
> file-local variables before loading Org mode?

Sorry, phrased that all wrong -- I meant that if we had a mechanism to
read the dir-locals earlier, then if you make the variables
permanently-local, then things would indeed work fine without any
further scaffolding here.

So perhaps we should just allow that, but I'm not sure how we'd specify
this.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 8 Aug 2022 12:57:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 08 08:57:19 2022
Received: from localhost ([127.0.0.1]:39437 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oL2Jq-00036l-Mr
	for submit <at> debbugs.gnu.org; Mon, 08 Aug 2022 08:57:18 -0400
Received: from mail-pg1-f171.google.com ([209.85.215.171]:34561)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oL2Jh-00036O-Rl
 for 57003 <at> debbugs.gnu.org; Mon, 08 Aug 2022 08:57:17 -0400
Received: by mail-pg1-f171.google.com with SMTP id 12so8509624pga.1
 for <57003 <at> debbugs.gnu.org>; Mon, 08 Aug 2022 05:57:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version; bh=SgASz3SRFAxPU2mjpGHaLYvhjRTUJ6yG6p2+yAQLFj8=;
 b=Gh+qDv56zxEUw+mNxmcMaaeRtU4/sRGCvFNwaSOLXmQfixlq71BBens9gl/vLA0hGz
 Fpxj8rlPY0Cokj/w+86MLg868Xc9fU+dYHzCiIFj62qjTf6bwxaUsTn+BW7EtEqYc0hs
 79yeaTqQv3WtV1Q8UW3BGSaIa8flxTxNzuQwhJE6B4oyMt4wW5cyLxfG0x1hGp1r8kcj
 1OP/OcXeThQcaAv1u4OqUEN2CRNhiQqYgea/RVrWQDY+lRaSVBJ7TDCKhP17oPCwxfkN
 UQCKOh+D96rdNcfZmGPhH03N4mlGdtLgOB0y7GHtjRdrx3Czl7iQs9dFRHqGdD0h65Py
 rQ6A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date
 :message-id:mime-version;
 bh=SgASz3SRFAxPU2mjpGHaLYvhjRTUJ6yG6p2+yAQLFj8=;
 b=zdZyYjbzEeDaWzO3ABMFzZ43n3EDYrkTp/vlHBftRVryx4r73PGoOOjn16Vd+n9kCZ
 J3+rJyzBeBSOU0jM6VBJzjeR9OpQQKms0D1OoMP6ssC709cxAu9newjFkYNTbqaeJebp
 K73Ku9j7NI1WLepAOZV4tR+pSRUXx6QL9FNOZZqdgUJ1QUYGP9vbYUCsB7ycWtM8bBvH
 dC5ZvSIz5/Cqbr1jMvExIlHwtsshXjHvUa5I4nGk1Hh/kngRZ0I39E8iYvefeY80MXd3
 FYpw3eoQvSLj9LmftcOZPrgUtufGPj3XQUZz4tGN5OVdKZqQR96qR7fir+w6XQcz70ct
 6nsg==
X-Gm-Message-State: ACgBeo32IEPOjVMeq8GDzM6A/3DVQXo+9uZhuqcKOisxPfHKNfz8O7Fl
 jR21z953dyPWB+phIgLWyMkWaW4rqYw=
X-Google-Smtp-Source: AA6agR43E7z+Ua0xPKfvkdMwqJ0ZtpqjQaC0R6Xwz4zf3o6jHyodKAgZu0wp+rBC3SQUeeTOqDxrSw==
X-Received: by 2002:a62:1c04:0:b0:52e:d2b4:c029 with SMTP id
 c4-20020a621c04000000b0052ed2b4c029mr13276073pfc.60.1659963424086; 
 Mon, 08 Aug 2022 05:57:04 -0700 (PDT)
Received: from localhost ([2409:8a70:2b5:4040:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 l14-20020a170903244e00b001709f01c423sm3423615pls.32.2022.08.08.05.57.02
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 08 Aug 2022 05:57:03 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87leryzzdl.fsf@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost> <87leryzzdl.fsf@HIDDEN>
Date: Mon, 08 Aug 2022 20:58:04 +0800
Message-ID: <87a68ezycj.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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: -0.8 (/)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Ihor Radchenko <yantar92@HIDDEN> writes:
>
>> Having Emacs support early setting would be much easier.
>
> You could make the relevant Org variables `permanent-local' -- then
> calling `org-mode' won't clear them out.

Could you please elaborate on how it is going to help with loading
file-local variables before loading Org mode?

Best,
Ihor




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 8 Aug 2022 12:36:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 08 08:36:04 2022
Received: from localhost ([127.0.0.1]:39418 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oL1zH-0000OK-W4
	for submit <at> debbugs.gnu.org; Mon, 08 Aug 2022 08:36:04 -0400
Received: from quimby.gnus.org ([95.216.78.240]:39710)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oL1zF-0000Np-KU
 for 57003 <at> debbugs.gnu.org; Mon, 08 Aug 2022 08:36:02 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=U0hP/LB0AT9W+3a4gI7PufiswZ5DhtqEnVTn8K6DvjY=; b=YU6j8FwQ2pzgTRjRYPA3AchkTf
 KaHc6xn47ut5JyLUanfMWER92sbXCP28lFQy39wdu37+i2qhcQOcjDogOAqxsaQzz0YAP/YXNjXBw
 Wctw1uvHwfYCFRLn8z3iSZziDcEpapLm3Yhi6ME4Ruim3+HeTySsOenFZlVnZS+81gjY=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oL1z7-0000XI-Gh; Mon, 08 Aug 2022 14:35:55 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87edxqzzm6.fsf@localhost> (Ihor Radchenko's message of "Mon, 08
 Aug 2022 20:30:41 +0800")
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
 <87edxqzzm6.fsf@localhost>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAElBMVEX9HqDhVq/m3C6r
 ytyWfar////NQ8kVAAAAAWJLR0QF+G/pxwAAAAd0SU1FB+YICAwhGoHqJOwAAAGpSURBVDjLlVQB
 buQwCIRsH4A3fUBN/YBNfQ9ovfz/TWWwY6c96aSzlAgzHgaICRER079XSkm6MT14Md4BsApLHMRu
 E1ZfcGwqt8dJYrqrnogO1QMxhr8je/glBX0uANBgWKRarKUE4G1E3zReZi27cbegUB4pmpkCSI4H
 pRdE2JpmeoXRKVixtdY03K0n1o8jEtxuaJnybjuAx/5os7SdsV6tNLgRSt8fnv8JwGPF1fW91oqa
 eqwXnC+gpd2Bh3dtAFD1uj88mVuth1ebB8PTKs/68O9AiHUFmj2rbOUTlKn+4vm4ip8sX8S1Cg2A
 I1k9/gZc3LU9m2JESGuGQjeeDthPgKOD2LdfgIvn3fN34PMKeBffKAAzuYpHQch/a0VuVwAFhYOL
 M1eBaCfyx/Xia68CQJMc2aG9zRukoT6WzLZTWDz8B87JvHNKJ0VoW/eHcYZPwn1qg5wjo8hs3d6I
 FSMky56x8g+TZcY6+d3ajxUrODwmJ8SCtwYKhLzHcGJEefpzTGdfch3C9T+QPry8/DyAtI0/heYw
 dub4BLLTbZUUBD5Og/5jfQPXSF28tdPdbgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wOC0wOFQx
 MjozMzoyNiswMDowMPYNlsAAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDgtMDhUMTI6MzM6MjYr
 MDA6MDCHUC58AAAAAElFTkSuQmCC
X-Now-Playing: Michael Rother's _Deutsche Elektronische Music 4 (1)_:
 "Flammende Herzen"
Date: Mon, 08 Aug 2022 14:35:50 +0200
Message-ID: <87leryzzdl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Ihor Radchenko <yantar92@HIDDEN> writes: > Having Emacs
 support early setting would be much easier. You could make the relevant Org
 variables `permanent-local' -- then calling `org-mode' won't clear them out.
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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 (---)

Ihor Radchenko <yantar92@HIDDEN> writes:

> Having Emacs support early setting would be much easier.

You could make the relevant Org variables `permanent-local' -- then
calling `org-mode' won't clear them out.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 8 Aug 2022 12:29:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 08 08:29:46 2022
Received: from localhost ([127.0.0.1]:39404 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oL1tC-0000CK-Hl
	for submit <at> debbugs.gnu.org; Mon, 08 Aug 2022 08:29:46 -0400
Received: from mail-pj1-f42.google.com ([209.85.216.42]:38436)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oL1tB-0000C8-5S
 for 57003 <at> debbugs.gnu.org; Mon, 08 Aug 2022 08:29:45 -0400
Received: by mail-pj1-f42.google.com with SMTP id
 q9-20020a17090a2dc900b001f58bcaca95so7602292pjm.3
 for <57003 <at> debbugs.gnu.org>; Mon, 08 Aug 2022 05:29:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version; bh=dbDqOodPCp3I0kOHFF9LIaxPExthsjL2zEdc6cebQ0U=;
 b=f4KKUstKKodEhylwkaB+je8JhHHTTYU+oS225er6N5iG+M64v2TNeFyVcsU7c1UhLf
 ydaSvBr2KPS8CcBUc+P/DKY39q4qrRn0XN8rIOowskxO+38WelQu77FYILwBzy8MVTmo
 o21UTWv2MmZ08LUtcofXOhetkM2UJx9xbznzNOCJ1DelJ0pVMkztfFOQs1yF3jgSpDc0
 oa4I05ZA8DeQAouufF4wDfRFhikJO9YABppoGn4qGwrevU7G1ct3VLwHci6VRN7vMWls
 vcIOFowNzq+CAkAmHGgCypaH6fjMborAmu6lC98giBE41mWd+JQDoIDVUwY+I8Sq41aE
 v4lg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date
 :message-id:mime-version;
 bh=dbDqOodPCp3I0kOHFF9LIaxPExthsjL2zEdc6cebQ0U=;
 b=dhv+IMgiTrpUasDYfFmaPXdyadw7Cn3foiqDgO3lDPAOORlFwT+uohC8du/rVt+etO
 dDSq6EFZzb31p1FwMb+en2HuAFy1n/aOOAMtxh8Z2UuofsuEGwn0SmPjvU9rn2vAcsL0
 urz2PfingxuykI96MMmGILHyLsKlG2aAFvrY17AigQyhz2cYkIXPdqy9pLdpqDniKsS0
 nzokbTnGoMObqePBfP++Ve4cjSYY/qermyjLBZPgZWj2NHfbcB4xkpXhBJGfWvFkGtsn
 r42pSKwaSDe1AEWJcdkJEfTCaK4cZBOosicAc+dLBiamnOQ7agH3zEiDMGjYS5NmWhRU
 2SSw==
X-Gm-Message-State: ACgBeo3IQfmGK+jY/GGxJsAlqEE6GTIESDT5gbfj74RLQvKiS0HhWpjw
 4hj8NJ6Xr0B9AX1rbgp5AbU=
X-Google-Smtp-Source: AA6agR6IyFflOosi9JyR/ECItW8S8k7K4xYSeUaH+L0agzk07GnGS7S+vw/Wzp+I6eIBCGt5VQnHAA==
X-Received: by 2002:a17:902:6ac5:b0:16d:23c9:4fbd with SMTP id
 i5-20020a1709026ac500b0016d23c94fbdmr18242036plt.143.1659961779158; 
 Mon, 08 Aug 2022 05:29:39 -0700 (PDT)
Received: from localhost ([2409:8a70:2b5:4040:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 d18-20020a170902f15200b0016c40f8cb58sm8573906plb.81.2022.08.08.05.29.37
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 08 Aug 2022 05:29:38 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87bksv0ya6.fsf@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost> <87bksv0ya6.fsf@HIDDEN>
Date: Mon, 08 Aug 2022 20:30:41 +0800
Message-ID: <87edxqzzm6.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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: -0.7 (/)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

>> 3. org-startup-folded is just an example. We have numerous variables
>>    like this. I can recall at least several dozens without looking into
>>    source code. Creating a minor mode for each and every single possible
>>    variable like this is not maintainable. We will certainly forget
>>    creating dedicated modes when adding similar variables in future.
>
> There's dozens of variables that have to be set before `org-mode' is
> called?  That sounds like an fragile design.

This is not strictly necessary to set them before the whole Org is
loaded. In some cases, only part of Org has to be reloaded: font-locking
setup; parser; folding state; etc (which is a normal scenario when done
interactively). However, such reloading adds up to file opening time. It
is much faster to set everything once and load Org compared to (1) load
org; (2) load variable and reload org; (3) load another variable and
reload org; and so on.

+ creating a dedicated minor mode for every variable is not maintainable.

Having Emacs support early setting would be much easier.

Best,
Ihor





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 8 Aug 2022 11:29:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 08 07:29:03 2022
Received: from localhost ([127.0.0.1]:39366 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oL0wR-0002qG-5k
	for submit <at> debbugs.gnu.org; Mon, 08 Aug 2022 07:29:03 -0400
Received: from quimby.gnus.org ([95.216.78.240]:39000)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oL0wN-0002pk-PS
 for 57003 <at> debbugs.gnu.org; Mon, 08 Aug 2022 07:29:01 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=D33FBnyFdCL4jA0lk7d6yVmcx5Ho8V5wDblS6XC02JE=; b=m5ksjamYvkQgqZhtHDgeH+NRZQ
 mteZ39Qz7ioTDMpczd7gLUPvHYl2ky79Tt3lJoMeBvsZIOvccoBNQkhCcbwA3dvcpPLFgWv9KQb/z
 woBtyDyVf22vrsM9BoaxAw+5SyG9fx2HwiHUbufC9qXe83r2uS7UxirA+pszajV4ABn0=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oL0wE-0008VF-3b; Mon, 08 Aug 2022 13:28:53 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <871qts6tzy.fsf@localhost> (Ihor Radchenko's message of "Sun, 07
 Aug 2022 21:52:33 +0800")
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
 <871qts6tzy.fsf@localhost>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAG1BMVEX0bKf2R5HqQojO
 tp708uc/QEbDs13EVm7///+cm4WMAAAAAWJLR0QIht6VegAAAAd0SU1FB+YICAsVIY6EKLoAAAGd
 SURBVDjLddNRjuMgDADQRHOBoTeY+dnflUzIAezJHCDjcAAa8jtSm3L9NZQ0kHaRqkq82gbXNI06
 KVkAoJGn2ZIs45VqlDp9JDB6YNdxCSpDx7eZdQQj0LQbOGbL/LNFlDDdVh5fRVhJVcLHA8LK03Oq
 RWBmu0H7ONXMLBHxWIdUssnyuWRoNwDZv2XIqXYIG7RFSyKseK/hyxogJ2Lk7nxsIqCxltYhnapK
 RSDX7u/drUDrNfZjg78FdD8bVDU07VCmMhf4ykBN9deOFAFBQFWpRvq+yiZmaAsYInzpI0wazzGV
 JlRVSyygll8/AXGcuVT9DlsqHW8iS8MhQvfr5Aj7sz5G9M45TVKIoADjBVIqyQTFBY2M7hlfgPch
 uNSna4Y8V362IaanWKKCJViMMFCG/D5CkKmVi/TLhcCU4IabJAd2M4Av4JIKS8P84ipIV6DQ2cVh
 Ce9pH8fOei0PYr9HApxHaaWM27IfN0HHFtJDO0TAmgCNX/YmCmA/mimC9301JU0Iv+ENqA8hFPBY
 p/z9BOol/Cng8z8R/wC8cNOST/ttAgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wOC0wOFQxMToy
 MTozMiswMDowMLZZ0X4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDgtMDhUMTE6MjE6MzIrMDA6
 MDDHBGnCAAAAAElFTkSuQmCC
X-Now-Playing: Et Cetera's _Deutsche Elektronische Music 4 (2)_: "Mellodrama
 2a"
Date: Mon, 08 Aug 2022 13:28:49 +0200
Message-ID: <87bksv0ya6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Ihor Radchenko <yantar92@HIDDEN> writes: > 1. Having a
 need to do the eval is not expected by users. > 2. Allowing eval is not safe
 compared to setting variables. Your > suggestion about `safe-local-eval-forms'
 will not work well because > e [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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 (---)

Ihor Radchenko <yantar92@HIDDEN> writes:

> 1. Having a need to do the eval is not expected by users.
> 2. Allowing eval is not safe compared to setting variables. Your
>    suggestion about `safe-local-eval-forms' will not work well because
>    even in your example it is not just about running
>    (org-startup-folded-mode); org-startup-folded has 7 allowed values -
>    marking each (org-startup-folded-mode value) form as safe sounds
>    awkward.

I'd forgotten that you can just enable minor modes without any of that.
You can just say

((org-mode . ((mode . org-startup-folded-mode))))

Or of there are different types:

((org-mode . ((org-startup-type . foo)
              (mode . org-startup-folded-mode))))

> 3. org-startup-folded is just an example. We have numerous variables
>    like this. I can recall at least several dozens without looking into
>    source code. Creating a minor mode for each and every single possible
>    variable like this is not maintainable. We will certainly forget
>    creating dedicated modes when adding similar variables in future.

There's dozens of variables that have to be set before `org-mode' is
called?  That sounds like an fragile design.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 7 Aug 2022 13:51:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 07 09:51:39 2022
Received: from localhost ([127.0.0.1]:36245 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oKggt-0002NI-6s
	for submit <at> debbugs.gnu.org; Sun, 07 Aug 2022 09:51:39 -0400
Received: from mail-pj1-f51.google.com ([209.85.216.51]:38517)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oKggp-0002N2-UG
 for 57003 <at> debbugs.gnu.org; Sun, 07 Aug 2022 09:51:37 -0400
Received: by mail-pj1-f51.google.com with SMTP id
 q9-20020a17090a2dc900b001f58bcaca95so5437848pjm.3
 for <57003 <at> debbugs.gnu.org>; Sun, 07 Aug 2022 06:51:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version; bh=E7nD50AoF63xeQz8j4TOYvtXuqhXWnxWDQ9jhFTE7M8=;
 b=q5eb2WbJe9X1Vbpu9azJfTVQ0UJ++oKOM+7K8z55FOAo7JT/tgqLD5as+VI7v04voh
 yS+3jlncDVm2ADtU2Pkr3ceJecFsx6qD98usfSJzd+C19cdJ1/6SAlV0EnPwCxcL4ujS
 JVcZHJWUc0ZUWs2I/0JfbEnEO+0tVM3U8YrSChv7zMpLwXopqcpWWLGPHIBpyAEmdgIT
 q681CkBaF8HLoCfPy/JcB07U5qBJagsEL6b7/4FcXTgnCqVcsweH2c2omfKWc1B9MqlN
 DpLMHgluF3zhdYH4XfQFlbWwy20394s9vRoGkNuCz4hadA1DDhehYP8ux/vHJ4aE5zaN
 f8XQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date
 :message-id:mime-version;
 bh=E7nD50AoF63xeQz8j4TOYvtXuqhXWnxWDQ9jhFTE7M8=;
 b=FXdY0IBLWWRrK/e70j7/mR9PniqXVJQgwwi+iPIj+lDs3mD/gUGWTsCGVm+2mk94FQ
 IzDdPZAZu8HBrYYPNIO42eM0Syky20PV7OzaOXGn70vJI5lV9UVaTf2Un1e0i18Sgyor
 c7Ri/mbV8R9Nfl2URYihKn/bihVrlmEE6djqgLcU20Hf0N56CpvBnBmdVpYXT+5BfMJt
 bRit257IOxGw3v8hSjQ3R4HY9S8Rov2IKoHqSLqZgwiRBxgR+jybqYJHG5RomfvF8nTt
 xQom9+oeC1uy/6clW7prraFnxlSn8NtYWHBPkcIJRRgnbq8Czj/1wN2pLj4xC6Uw0EPG
 Ayug==
X-Gm-Message-State: ACgBeo3wClFXfAFdrPmJY48vYJFsG7j5rB47liOgNhsVsNBhari5WYsr
 2D8I/ZzC58A7wYK+x4UNohdtQJmIewI=
X-Google-Smtp-Source: AA6agR5dHICr8p/xsmHi9svnH/3CCGHQGC+nA0bHQ5D27GCdSvmTIF7ODsPYPxOGICWgcYW3qk0FEw==
X-Received: by 2002:a17:903:247:b0:16c:5017:9ad4 with SMTP id
 j7-20020a170903024700b0016c50179ad4mr15204014plh.115.1659880290013; 
 Sun, 07 Aug 2022 06:51:30 -0700 (PDT)
Received: from localhost ([2409:8a70:2b5:4040:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 i23-20020a056a00225700b0052ddccd7b64sm5153721pfu.205.2022.08.07.06.51.28
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 07 Aug 2022 06:51:29 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87k07k18ro.fsf@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost> <87k07k18ro.fsf@HIDDEN>
Date: Sun, 07 Aug 2022 21:52:33 +0800
Message-ID: <871qts6tzy.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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: -0.7 (/)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Ihor Radchenko <yantar92@HIDDEN> writes:
>
>> Agree. However, the file-local variables specifically are not equivalent
>> to the mode hooks. File/directory-local variables can be set on
>> per-file/per-project basis, which is much more convenient compared to
>> explicitly defining a global hook.
>
> I think you can say something like
>
> (eval . (org-startup-folded-mode))
>
> to your .dir-locals (etc) to achieve this.  (And then you have to add
> that to `safe-local-eval-forms' to avoid getting prompted, but Org could
> do that in general.  And, of course, add this functionality as a minor
> mode instead of just a variable.)

I do not think that it is a good idea.

1. Having a need to do the eval is not expected by users.
2. Allowing eval is not safe compared to setting variables. Your
   suggestion about `safe-local-eval-forms' will not work well because
   even in your example it is not just about running
   (org-startup-folded-mode); org-startup-folded has 7 allowed values -
   marking each (org-startup-folded-mode value) form as safe sounds
   awkward.
3. org-startup-folded is just an example. We have numerous variables
   like this. I can recall at least several dozens without looking into
   source code. Creating a minor mode for each and every single possible
   variable like this is not maintainable. We will certainly forget
   creating dedicated modes when adding similar variables in future.
4. We have a somewhat similar approach in org-link settings - each link
   type is activated by evaluating a sexp. The result is slow Org
   startup time.

   If we implement per-file settings like you suggested, each setting
   will require partial re-evaluation of (org-mode). 
   A handful of settings like you suggested will easily degrade Org
   startup time by an order of magnitude.

Best,
Ihor




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 7 Aug 2022 13:30:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 07 09:30:15 2022
Received: from localhost ([127.0.0.1]:36233 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oKgMB-0001ph-Hy
	for submit <at> debbugs.gnu.org; Sun, 07 Aug 2022 09:30:15 -0400
Received: from quimby.gnus.org ([95.216.78.240]:57166)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oKgM9-0001oL-DX
 for 57003 <at> debbugs.gnu.org; Sun, 07 Aug 2022 09:30:13 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=c+er4pfymBRinyd0DTq8DBmoBVJCuuOIl1MWqTIvgnI=; b=DB+hqNDGrxSeuiSdr4bdelJH2n
 IcQn1wkajClHxtdNishqmQJU2pFhUdX2XMY1wDU9ebPqriWXmlwHYlbhjMx10K+fwoLZLQKs/7WK3
 oUWjEjb6jYQlpMRUo9YejOcVwo6jFh84NkINKnW5a464NOVrf5UFdsH/kSTC2RCmzJlo=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oKgM0-0006vm-HO; Sun, 07 Aug 2022 15:30:06 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <874jyo6vd6.fsf@localhost> (Ihor Radchenko's message of "Sun, 07
 Aug 2022 21:23:01 +0800")
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
 <874jyo6vd6.fsf@localhost>
Date: Sun, 07 Aug 2022 15:30:03 +0200
Message-ID: <87k07k18ro.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Ihor Radchenko <yantar92@HIDDEN> writes: > Agree. However,
 the file-local variables specifically are not equivalent > to the mode hooks.
 File/directory-local variables can be set on > per-file/per-project basis,
 which is much more convenient [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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 (---)

Ihor Radchenko <yantar92@HIDDEN> writes:

> Agree. However, the file-local variables specifically are not equivalent
> to the mode hooks. File/directory-local variables can be set on
> per-file/per-project basis, which is much more convenient compared to
> explicitly defining a global hook.

I think you can say something like

(eval . (org-startup-folded-mode))

to your .dir-locals (etc) to achieve this.  (And then you have to add
that to `safe-local-eval-forms' to avoid getting prompted, but Org could
do that in general.  And, of course, add this functionality as a minor
mode instead of just a variable.)





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 7 Aug 2022 13:22:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 07 09:22:07 2022
Received: from localhost ([127.0.0.1]:36228 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oKgEI-0001de-Mw
	for submit <at> debbugs.gnu.org; Sun, 07 Aug 2022 09:22:06 -0400
Received: from mail-pg1-f177.google.com ([209.85.215.177]:41830)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oKgEF-0001d9-UP
 for 57003 <at> debbugs.gnu.org; Sun, 07 Aug 2022 09:22:05 -0400
Received: by mail-pg1-f177.google.com with SMTP id 13so6409704pgc.8
 for <57003 <at> debbugs.gnu.org>; Sun, 07 Aug 2022 06:22:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version; bh=DtG1GDog5Lb8hZPwi5+JdV+Y52cTNCyPCGe4eTwFR7E=;
 b=Pre4Rl2Dc6IjpkRLWDoTB5pGcpqmBwHZnh8HKDwzfMzz6uPm7gQrcczJnzIN5m2l4P
 mCCS8s18jpFlglLBIPhrtZ0/v+g6n/WPXbieqYADg5nXnx+QA83VMN+8QafVgIpIBJF7
 NlOOPEPnq1jQNZn2Dl6w9ZE2IZts1/z/fgdQP8P9A518yExmwU5VL1UAspaAfLSfu8w2
 qJyEAkg4JJW5X2lAW9eUo2BLqLZRCakxO2bv4B8KoAlJYkSLzXy4EUv7PWSrsfX1QHeP
 V2OoNPDD5kFnQJuAVSP1JHahS00U3G3oydcWRu6xdafvpmKVVioZBbH5gaqLIBB7jZTA
 nwww==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date
 :message-id:mime-version;
 bh=DtG1GDog5Lb8hZPwi5+JdV+Y52cTNCyPCGe4eTwFR7E=;
 b=LXHrmcdkSfJSc63g5mBBV7louhb/eRNlBqbupZg3uSsX1EZmpyNprSqkrH93lydyWy
 Uc6YUX+ip9waJ677AmFmJ0Y9LN1Fiq6nO4GvPyvCsZFwk5lyKGvzv0B8S3fWgbjxdhiG
 MaAoI+VaOpdv4IhLiHSe13zZ69eL26A8XcmbeCxWLacFyLDWtZPlEsRJQZlkLErXXpHO
 9K4rsxLX902yKErT/s/Q9ctD/rOULWlRhDxpDLe7JoEbLGvXAJvFHThaONAIxdzscFjd
 7bIPINzPBSQ0fRltgtG6grxPxbcehRsx4oUGz/8ah3wd0pZnLL3tfv3FZS6xgqWoOOfj
 gdKQ==
X-Gm-Message-State: ACgBeo0EGewFwKZYMP+QGOxRe2O0X4xL3PfXLO6Lz15kuR3T4LGhHbA+
 9hiSUJH6//+D9pNONiwOLLI=
X-Google-Smtp-Source: AA6agR77ZGbyWTIrf1IVxGudSuAk+AAO3g4Wrnlk7eKjrG+jUsP/AnrGMcVfTV+ly13s2kCT6/mBBw==
X-Received: by 2002:a63:4182:0:b0:41c:b808:21d2 with SMTP id
 o124-20020a634182000000b0041cb80821d2mr12584953pga.156.1659878517994; 
 Sun, 07 Aug 2022 06:21:57 -0700 (PDT)
Received: from localhost ([2409:8a70:2b5:4040:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 i25-20020aa796f9000000b0052d50e14f1dsm6600174pfq.78.2022.08.07.06.21.56
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 07 Aug 2022 06:21:57 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <875yj443zy.fsf@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <875yj443zy.fsf@HIDDEN>
Date: Sun, 07 Aug 2022 21:23:01 +0800
Message-ID: <874jyo6vd6.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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: -0.7 (/)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> I see.  In that case, it does seem attractive to allow file-local
> variables to set the variables before running the mode.  However, as
> Visuwesh points out, a major mode clears buffer-local variables, so just
> setting them before running the mode won't do anything.

Indeed. I imagine something like :before-hook in `define-derived-mode'
that will run just before the mode body.

Or maybe more direct :hack-local-variables-when defining when to run
`hack-local-variables' in contrast to currently hard-coded call in
`run-mode-hooks'. This is not equivalent to calling
`hack-local-variables' in :before-hook because `run-mode-hooks' would
call `hack-local-variables' second time in such a case.

Or maybe something more user-facing like major-mode-before-init-hook
that will be executed before the major mode body form in
`define-derived-mode'.

> So I think the interface here is just a bit confused and confusing.  It
> would make more sense to allow users to do these things via mode
> hooks/interface functions instead of variables.

Agree. However, the file-local variables specifically are not equivalent
to the mode hooks. File/directory-local variables can be set on
per-file/per-project basis, which is much more convenient compared to
explicitly defining a global hook.

Best,
Ihor





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 7 Aug 2022 12:45:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 07 08:45:02 2022
Received: from localhost ([127.0.0.1]:36135 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oKfeP-0004fw-NI
	for submit <at> debbugs.gnu.org; Sun, 07 Aug 2022 08:45:02 -0400
Received: from quimby.gnus.org ([95.216.78.240]:56596)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oKfeM-0004fi-O8
 for 57003 <at> debbugs.gnu.org; Sun, 07 Aug 2022 08:45:00 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=LTOg4WdfU5c0irnCPJnqSENLIPrRjYZU0FBfV1lnyEk=; b=PjtWPgD6CiHyyWSx/Y+Yg/1cGd
 LYMyhQ6TFxh0xgJiAO4EquLR+iDdcFyScuo7uowRsiOMOMzeIj1Ud/Y+9BbBgYQMO0eXkXhiHMt+z
 vHHVC9+jLDXxqSEaVcP2r+sEC3TrsJ+OPjSo4GcK7ns7Jmy5PVpU3dzAGmA3/gemyFCU=;
Received: from [84.212.220.105] (helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oKfeE-0006Us-5C; Sun, 07 Aug 2022 14:44:52 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <875yj5xzou.fsf@localhost> (Ihor Radchenko's message of "Sat, 06
 Aug 2022 21:35:13 +0800")
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost>
Date: Sun, 07 Aug 2022 14:44:49 +0200
Message-ID: <875yj443zy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Ihor Radchenko <yantar92@HIDDEN> writes: > We have a
 variable
 org-startup-folded: > > Non-nil means entering Org mode will switch to
 OVERVIEW.
 > > This variable controls the initial state of the Org buffer. > When, non-nil,
 headings will be [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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 (---)

Ihor Radchenko <yantar92@HIDDEN> writes:

> We have a variable org-startup-folded:
>
>    Non-nil means entering Org mode will switch to OVERVIEW.
>
> This variable controls the initial state of the Org buffer.
> When, non-nil, headings will be folded at the end of Org initialization.
> This folding happens inside org-mode specification and hence setting the
> variable after Org mode is loaded makes no difference.

I see.  In that case, it does seem attractive to allow file-local
variables to set the variables before running the mode.  However, as
Visuwesh points out, a major mode clears buffer-local variables, so just
setting them before running the mode won't do anything.

So I think the interface here is just a bit confused and confusing.  It
would make more sense to allow users to do these things via mode
hooks/interface functions instead of variables.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 6 Aug 2022 14:34:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 06 10:34:08 2022
Received: from localhost ([127.0.0.1]:35206 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oKKsR-0004Fe-Px
	for submit <at> debbugs.gnu.org; Sat, 06 Aug 2022 10:34:08 -0400
Received: from smtp-2.orcon.net.nz ([60.234.4.43]:48915)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <psainty@HIDDEN>) id 1oKKsQ-0004FW-FS
 for 57003 <at> debbugs.gnu.org; Sat, 06 Aug 2022 10:34:07 -0400
Received: from [10.253.37.70] (port=46417 helo=webmail.orcon.net.nz)
 by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1)
 (envelope-from <psainty@HIDDEN>)
 id 1oKKsL-0006xX-6X; Sun, 07 Aug 2022 02:34:01 +1200
Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135])
 via [10.253.37.253] by webmail.orcon.net.nz
 with HTTP (HTTP/1.1 POST); Sun, 07 Aug 2022 02:34:01 +1200
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Date: Sun, 07 Aug 2022 02:34:01 +1200
From: Phil Sainty <psainty@HIDDEN>
To: Visuwesh <visuweshm@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major =?UTF-8?Q?mode=3F?=
In-Reply-To: <87h72pwjys.fsf@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost> <87h72pwjys.fsf@HIDDEN>
Message-ID: <8c71d52ddab506ff2e040b94db856ff8@HIDDEN>
X-Sender: psainty@HIDDEN
User-Agent: Orcon Webmail
X-GeoIP: --
X-Spam_score: -2.9
X-Spam_score_int: -28
X-Spam_bar: --
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <at> debbugs.gnu.org,
 Ihor Radchenko <yantar92@HIDDEN>
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: -1.0 (-)

On 2022-08-07 02:00, Visuwesh wrote:
> Correct me if I'm wrong, this is about the major-mode definition
> clearing the buffer's local variables before turning on the major-mode,
> right?

To elaborate, every major mode calls `kill-all-local-variables',
and this is pretty much the first thing that happens (although
`change-major-mode-hook' runs before the local variables are
actually clobbered).

https://stackoverflow.com/a/19295380/324105 (specifically the
"Derived modes, and mode hooks" section) might be a useful write-up
if you want to get your head around the sequence of events.

Note that variables which are marked as permanent-local will
retain their values.  Refer to:

M-x elisp-index-search RET kill-all-local-variables


-Phil





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 6 Aug 2022 14:00:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 06 10:00:33 2022
Received: from localhost ([127.0.0.1]:35154 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oKKLx-0001Hg-9E
	for submit <at> debbugs.gnu.org; Sat, 06 Aug 2022 10:00:33 -0400
Received: from mail-pf1-f194.google.com ([209.85.210.194]:45777)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <visuweshm@HIDDEN>) id 1oKKLu-0001HL-FR
 for 57003 <at> debbugs.gnu.org; Sat, 06 Aug 2022 10:00:32 -0400
Received: by mail-pf1-f194.google.com with SMTP id z187so4482688pfb.12
 for <57003 <at> debbugs.gnu.org>; Sat, 06 Aug 2022 07:00:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc;
 bh=LdbF5zg1abOngfC4iLOdmhqLK2GAZLT73YO0L5mlIKI=;
 b=jucU9iTiFB4Y41OLHItghj7OSSUy+Zr2XoO7S0ZspI3hAHUZYwDhSLhWiikv+bapQo
 RFziYCe5V8+C5yJZMH20R4A3NwwoW1PcPP/AueEMcZQybuXOkwSai5+cUj201rM2e9Yx
 CH69l6AENy+N91dKYSawlS5Qv6MH5jR9bKC/y8JwAFyUanIAfTsedwRTnvpg87HpA8C6
 je+jqiYBviNJJUW+jdB1Any2C1/UYFZO/kP2/vg25z4LOgsT+7JoiRap/K5JmocCImA3
 AulTIMHZEvkkYNNiN5cVTWDcTwXeyP8yKxLoeotWVWx3rD2Kv7ctuF2FKeXpSXIfcSM2
 tX+w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc;
 bh=LdbF5zg1abOngfC4iLOdmhqLK2GAZLT73YO0L5mlIKI=;
 b=n2UOUChDLKmi8w/Fx1Ct9BUMfQ03RfNO39/pteri3Hv0oiypaoZCk3qPxSWvXLSBfe
 IzRVNgK5WBxEEeOzDbqA3jdMOOZZYVH37v5GDfobKYumhU/zxZtUoq3EnHQqA47RPQxN
 JlYIPgoIKTAqAd4oNt5iZ3bsLETCFoLaLzSrhUE4JfujliU/tdrYtHMgYnBQPs6gCy7D
 DSdeNxSsp7bu1I5VCQ00fxcgr0oupQ8f+bZPi9KEx1VLYptA2RycU6B4BdXtCsUyJsrs
 7Vi67qKwIJ68WbP5dRKwWO9gcBAXqYclgzs+wsgHYtQuRq7i2XmThJZMKambmzgGMI4b
 QQxg==
X-Gm-Message-State: ACgBeo1vN+BCLlnY4SCe+rLCo1aGWcXCUth4EFB5dycyX2vD/4L8UhDZ
 fSvJYJb9voC7KxYogxJAcRQ=
X-Google-Smtp-Source: AA6agR6IdjPbfql25+d9HjeMESR4nqD+ygV8JW6xZQPjMPB0IA9jWCecbVYZGbL5QiFk404E0JIRPQ==
X-Received: by 2002:a05:6a00:114f:b0:528:2c7a:634c with SMTP id
 b15-20020a056a00114f00b005282c7a634cmr11301350pfm.41.1659794424560; 
 Sat, 06 Aug 2022 07:00:24 -0700 (PDT)
Received: from localhost ([118.185.152.162]) by smtp.gmail.com with ESMTPSA id
 w18-20020a170902e89200b0016efa52d428sm5005680plg.218.2022.08.06.07.00.20
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 06 Aug 2022 07:00:23 -0700 (PDT)
From: Visuwesh <visuweshm@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <875yj5xzou.fsf@localhost> (Ihor Radchenko's message of "Sat, 06
 Aug 2022 21:35:13 +0800")
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
 <875yj5xzou.fsf@localhost>
Date: Sat, 06 Aug 2022 19:30:11 +0530
Message-ID: <87h72pwjys.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 3.6 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  [சனி ஆகஸ்ட் 06, 2022] Ihor Radchenko wrote:
    > Lars Ingebrigtsen writes: > >> Is the problem here that there are defvars
    in the major-mode file being >> loaded that depend on one another? (I'm not
    sure I understand the >> explanation in that b [...] 
 
 Content analysis details:   (3.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [118.185.152.162 listed in zen.spamhaus.org]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (visuweshm[at]gmail.com)
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.210.194 listed in list.dnswl.org]
  0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [209.85.210.194 listed in wl.mailspike.net]
  0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
X-Debbugs-Envelope-To: 57003
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 57003 <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: 2.6 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  [சனி ஆகஸ்ட் 06, 2022] Ihor Radchenko wrote:
    > Lars Ingebrigtsen writes: > >> Is the problem here that there are defvars
    in the major-mode file being >> loaded that depend on one another? (I'm not
    sure I understand the >> explanation in that b [...] 
 
 Content analysis details:   (2.6 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [118.185.152.162 listed in zen.spamhaus.org]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.210.194 listed in list.dnswl.org]
  0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                             [209.85.210.194 listed in wl.mailspike.net]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (visuweshm[at]gmail.com)
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

[=E0=AE=9A=E0=AE=A9=E0=AE=BF =E0=AE=86=E0=AE=95=E0=AE=B8=E0=AF=8D=E0=AE=9F=
=E0=AF=8D 06, 2022] Ihor Radchenko wrote:

> Lars Ingebrigtsen <larsi@HIDDEN> writes:
>
>> Is the problem here that there are defvars in the major-mode file being
>> loaded that depend on one another?  (I'm not sure I understand the
>> explanation in that bug report.)
>
> No.
>
> Let me try to explain a simple case when setting variables before/after
> loading Org mode matters.
>
> We have a variable org-startup-folded:
>
>    Non-nil means entering Org mode will switch to OVERVIEW.
>
> This variable controls the initial state of the Org buffer.
> When, non-nil, headings will be folded at the end of Org initialization.
> This folding happens inside org-mode specification and hence setting the
> variable after Org mode is loaded makes no difference.
>
> There are also less trivial cases like some variables controlling Org
> parser. For example, we have org-todo-keywords. Its value controls how
> the headlines are parsed. Because Org parser is initialized during Org
> loading, setting this variable after loading Org mode can be simply
> disastrous.

Correct me if I'm wrong, this is about the major-mode definition
clearing the buffer's local variables before turning on the major-mode,
right?  If so, I was hit by this for a personal package too where I
needed to expose a local variable for the major-mode-hook but failed
because the function created `define-derived-mode' clears the buffer
local variables before running the major-mode-hook and the major-mode's
BODY.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 6 Aug 2022 13:34:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 06 09:34:20 2022
Received: from localhost ([127.0.0.1]:33079 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oKJwa-00004r-4T
	for submit <at> debbugs.gnu.org; Sat, 06 Aug 2022 09:34:20 -0400
Received: from mail-pg1-f181.google.com ([209.85.215.181]:37646)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oKJwW-0008WH-Sk
 for 57003 <at> debbugs.gnu.org; Sat, 06 Aug 2022 09:34:18 -0400
Received: by mail-pg1-f181.google.com with SMTP id bh13so4855186pgb.4
 for <57003 <at> debbugs.gnu.org>; Sat, 06 Aug 2022 06:34:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version; bh=WKfar4Yh1Pr+YM4hMIVP4gvneiooKLs0G6dUQRCfEw0=;
 b=IoY/Cp23aH4cmUTR344l/rdxG12LeyIu9iNjU1maUVeKkZri8anRkxgWWG2qiPDJrD
 fh6XBx0zaIEmM/6uhL1FfCDAw/4UV3rlXSHNWy751wle3j1omfmQQmh6oHgDzmfNYLwV
 WICjOLOez03KYb4m8+15sAnD6Zhqo8ZCUVXUrgwkoWDlOSk7NtDXcngp8WvHQ836yzJQ
 UsTl/4L852DLfwM2p6OV9W4OB9TQfRorTZRxjH0X9NVPqHFGi2WLh01TGy7fSRAwZcYe
 4hb8bTaNfi9+8KTPA4/681r3ko8FEZ29zI9j2egZgj/N2P7Ib876nJZg5YPLYvrw5xip
 sw5Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date
 :message-id:mime-version;
 bh=WKfar4Yh1Pr+YM4hMIVP4gvneiooKLs0G6dUQRCfEw0=;
 b=UE+vF8IZ4Z3DLH4YJ8hGyqrktGp8SnKn5BymMnBskwDuLLCEKo/CHuBCkUI+Op9Fn3
 VDzvIj8eQKmVUFXvfJdWsLR+0haNQgSuGSY5eA7TEFDNuu7SrgGwFnlagyHSQ1Nt52fQ
 nmi9FvBOjM+ohgl9udEQw1w/xfHsYtPKJmqzbQ6GuWRTPPNJw76jd16p0Ml6l9EyHvPD
 6Oa5oi5r/7ETQOwvUV1aEMLxznnlaElAI2DSzwzQeuBSnPTuZxHVxKCguTZI2Gd1o+Av
 bPI3S1s9hbhxk5vMQS2KOqp6azw8ZVFVYL+6VGZjLz2xgAiDiDaKO5eg1kKT3RgcSOw2
 UsLQ==
X-Gm-Message-State: ACgBeo13oftauabv5423ODNtBxdOFD/Wdut79dtyT0XBscRkgH8yImKx
 pdK3VPDsNCGdeEIoCmHWZ1ndPsCeTYA=
X-Google-Smtp-Source: AA6agR6lFYRKEEusJNJNNHCIskG5puhSZmfNUdckO8m3pGoMlyb2ml7PyxAF+2XmRpZbLGS8jMMTTg==
X-Received: by 2002:a05:6a00:1949:b0:52d:a742:ff9c with SMTP id
 s9-20020a056a00194900b0052da742ff9cmr11158251pfk.10.1659792850754; 
 Sat, 06 Aug 2022 06:34:10 -0700 (PDT)
Received: from localhost ([2409:8a70:2b5:4040:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 y3-20020aa793c3000000b005289fad1bbesm5173975pff.94.2022.08.06.06.34.08
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 06 Aug 2022 06:34:10 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87v8r54j3h.fsf@HIDDEN>
References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@HIDDEN>
Date: Sat, 06 Aug 2022 21:35:13 +0800
Message-ID: <875yj5xzou.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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: -0.7 (/)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Is the problem here that there are defvars in the major-mode file being
> loaded that depend on one another?  (I'm not sure I understand the
> explanation in that bug report.)

No.

Let me try to explain a simple case when setting variables before/after
loading Org mode matters.

We have a variable org-startup-folded:

   Non-nil means entering Org mode will switch to OVERVIEW.

This variable controls the initial state of the Org buffer.
When, non-nil, headings will be folded at the end of Org initialization.
This folding happens inside org-mode specification and hence setting the
variable after Org mode is loaded makes no difference.

There are also less trivial cases like some variables controlling Org
parser. For example, we have org-todo-keywords. Its value controls how
the headlines are parsed. Because Org parser is initialized during Org
loading, setting this variable after loading Org mode can be simply
disastrous.

Best,
Ihor





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.
Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 57003 <at> debbugs.gnu.org:


Received: (at 57003) by debbugs.gnu.org; 6 Aug 2022 13:06:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 06 09:06:38 2022
Received: from localhost ([127.0.0.1]:33028 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oKJVl-0003Xp-OV
	for submit <at> debbugs.gnu.org; Sat, 06 Aug 2022 09:06:38 -0400
Received: from quimby.gnus.org ([95.216.78.240]:46916)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1oKJVj-0003XX-JZ
 for 57003 <at> debbugs.gnu.org; Sat, 06 Aug 2022 09:06:36 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References:
 In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=IgXbeYmwLppiJRrNKBqOfLVJfBMld6ltQpYw7r5xe1U=; b=GNicZfV9k/7O9zLP5JVT9kJaRg
 0Izn8RUtQeFrn7M4PkEvrdkeX4ntDFnzs4X59x4xFXxSUYgvfMbkNHvFYLD8GJe8D1SDpaD5R3SCs
 rKR/kozgN3QtJF/xCXFUt+vDNMKS28pep3YRUfF23yHOUKhrO/fvGZ/jA7iQSk+AAcz8=;
Received: from 2.151.51.97.tmi.telenormobil.no ([2.151.51.97] helo=joga)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1oKJVa-00048G-Ug; Sat, 06 Aug 2022 15:06:29 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57003: 28.1.90; Can local variables be loaded before
 loading major mode?
In-Reply-To: <87czdeoqy7.fsf@localhost> (Ihor Radchenko's message of "Fri, 05
 Aug 2022 19:44:16 +0800")
References: <87czdeoqy7.fsf@localhost>
Date: Sat, 06 Aug 2022 15:06:26 +0200
Message-ID: <87v8r54j3h.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Ihor Radchenko <yantar92@HIDDEN> writes: > Some user
 settings
 in Org mode need to be set before loading the major mode. > Further, some
 people want to set such settings in individual files > using file-local
 variables. > > However, Emacs loa [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 0.0 TVD_RCVD_IP            Message was received from an IP address
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57003
Cc: 57003 <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 (---)

Ihor Radchenko <yantar92@HIDDEN> writes:

> Some user settings in Org mode need to be set before loading the major mode.
> Further, some people want to set such settings in individual files
> using file-local variables.
>
> However, Emacs loads file-local variables only _after_ major mode is
> being loaded.
> As a result, we are getting user requests like
> https://list.orgmode.org/587be554-906c-5370-2cf2-f08b14fa58ff@HIDDEN/T/#u

Is the problem here that there are defvars in the major-mode file being
loaded that depend on one another?  (I'm not sure I understand the
explanation in that bug report.)

If that's the case, then this is inherently fragile, since the user may
have already loaded the .el file otherwise.  So visiting files in a
different order will lead to other results, and eval-ing local variables
before loading the files won't really help, in general.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Aug 2022 11:43:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 05 07:43:18 2022
Received: from localhost ([127.0.0.1]:56395 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oJvjZ-000508-VI
	for submit <at> debbugs.gnu.org; Fri, 05 Aug 2022 07:43:18 -0400
Received: from lists.gnu.org ([209.51.188.17]:35768)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oJvjY-0004zw-2M
 for submit <at> debbugs.gnu.org; Fri, 05 Aug 2022 07:43:16 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41124)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1oJvjX-0006sM-Ts
 for bug-gnu-emacs@HIDDEN; Fri, 05 Aug 2022 07:43:15 -0400
Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:36752)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1oJvjW-0006Sn-7f
 for bug-gnu-emacs@HIDDEN; Fri, 05 Aug 2022 07:43:15 -0400
Received: by mail-pl1-x636.google.com with SMTP id x10so2420797plb.3
 for <bug-gnu-emacs@HIDDEN>; Fri, 05 Aug 2022 04:43:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:subject:date:message-id:mime-version;
 bh=YQ7YPZX3C6ss7FMbM3Vn/+mIybAnf7cqTQ67r4V2/vc=;
 b=VyKXLuyQu7RyfMs5PSZ7KjNBwMbrSeFa0n7KMdjR9/ubxCg18qRTY3H9+Y4P15ploE
 MGeIApD+BTtbBmkbCTtzBHT2KfiSFq7qzmghn5aP2F5XI2p7qI+D5PzsH7zAWOhMFEtr
 POXoz9EsPpQEvzx60YlhArCPyLO0YBKN5EssyzB8OgSl1v7u54ewhmqfVDKlZnAUvCYy
 d/b/SB0ATC0i9q18oqPx1IHnzZs8AXN4YI74Jpc7xy+F71bYp8amd3lyPXT7MTw6KAZo
 MyZ3v3gv8UcDkGDW0ttmwLSpvetuhG6UzwD9maPH1FiLS3AZzTSnr+onsdpA3nz5rXBs
 BFnw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=YQ7YPZX3C6ss7FMbM3Vn/+mIybAnf7cqTQ67r4V2/vc=;
 b=AwmnuzGJFC4UHB61+4B96fdq0mgTW7WLOaM4QaS+pb+WkYTuu9n68PfxUH4Hj8eFEU
 tmUoalYb3jE+EDS0vEKofEYKxglOr7mycxHc4FOMXfuenaANtqj7mA/CBGNX9sA7kGoA
 izEKVCPKcRe7MT11aLpCbmkHdPemCHoBelICdiXiq98oSRhbn0Xr4XP8/63uIc44isaS
 gKf0NH2qzJIhW/76kEh2rgCZB7qyfIWmaVh/1LuN6fcxrz8XkPZ+aKuhioK7wdmtPVTH
 HP1XDdujwdQeyxkN2ItIeRUHNQ96RXCmmx7/mGOU0PkEmPIYShUc3XbfsqR8aJI0pAjR
 Xnqg==
X-Gm-Message-State: ACgBeo1Qd54j6DODkkFj7KxjbtjJFMNs/319n9hCs1cAh/nBOqmoi7fD
 rIF+2EeP/GsQVNOtGm/E8NaUQ46/xnw=
X-Google-Smtp-Source: AA6agR5F+BsG5GFUR4qgkxnW1UXM1Ojyx0cYTLfe6AcRV1nhK4MvDRSqTt933k761WFVjxndvZZLNw==
X-Received: by 2002:a17:902:edc4:b0:16c:d2ef:7fd2 with SMTP id
 q4-20020a170902edc400b0016cd2ef7fd2mr6432243plk.160.1659699791832; 
 Fri, 05 Aug 2022 04:43:11 -0700 (PDT)
Received: from localhost ([2409:8a70:2b5:4040:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 e12-20020a170902784c00b0016d22e6ed57sm2706030pln.293.2022.08.05.04.43.10
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 05 Aug 2022 04:43:11 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 28.1.90; Can local variables be loaded before loading major mode?
Date: Fri, 05 Aug 2022 19:44:16 +0800
Message-ID: <87czdeoqy7.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::636;
 envelope-from=yantar92@HIDDEN; helo=mail-pl1-x636.google.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 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,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.1 (-)
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.1 (--)


Hi,

Some user settings in Org mode need to be set before loading the major mode.
Further, some people want to set such settings in individual files using file-local variables.

However, Emacs loads file-local variables only _after_ major mode is being loaded.
As a result, we are getting user requests like https://list.orgmode.org/587be554-906c-5370-2cf2-f08b14fa58ff@HIDDEN/T/#u

Currently, Elisp allows manual loading of file-local variables via `hack-local-variables'. However, this function itself is too forceful, and it is running, e.g. in non-file buffers. Moreover, calling `hack-local-variables' does not prevent its subsequent call after Org mode is loaded, which sometimes causes double unsafe variable prompts.
See https://list.orgmode.org/87r11wkmew.fsf@HIDDEN/T/#mab6359ed2107d5515c6bb6b266551f0c5049ceca

Would it be possible in Emacs to implement a function or possibly major-mode option that will make Emacs load local variables before loading major mode, not after?

Best,
Ihor




Acknowledgement sent to Ihor Radchenko <yantar92@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#57003; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 3 Sep 2023 09:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.