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>; Keywords: moreinfo; dated Fri, 5 Aug 2022 11:44:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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: Sat, 13 Aug 2022 12:30:02 UTC

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