From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#57003: 28.1.90; Can local variables be loaded before loading major mode? Date: Sat, 06 Aug 2022 19:30:11 +0530 Message-ID: <87h72pwjys.fsf@gmail.com> References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@gnus.org> <875yj5xzou.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14247"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , 57003@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 06 16:01:34 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oKKMv-0003Vo-Kx for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Aug 2022 16:01:33 +0200 Original-Received: from localhost ([::1]:35752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKKMu-0007Ic-M1 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Aug 2022 10:01:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKKMQ-0007IH-Tr for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 10:01:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45405) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKKMQ-0005Lq-Ax for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 10:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKKMQ-0001IY-1m for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 10:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Aug 2022 14:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57003 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 57003-submit@debbugs.gnu.org id=B57003.16597944334944 (code B ref 57003); Sat, 06 Aug 2022 14:01:02 +0000 Original-Received: (at 57003) by debbugs.gnu.org; 6 Aug 2022 14:00:33 +0000 Original-Received: from localhost ([127.0.0.1]:35154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKKLx-0001Hg-9E for submit@debbugs.gnu.org; Sat, 06 Aug 2022 10:00:33 -0400 Original-Received: from mail-pf1-f194.google.com ([209.85.210.194]:45777) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKKLu-0001HL-FR for 57003@debbugs.gnu.org; Sat, 06 Aug 2022 10:00:32 -0400 Original-Received: by mail-pf1-f194.google.com with SMTP id z187so4482688pfb.12 for <57003@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) Original-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) In-Reply-To: <875yj5xzou.fsf@localhost> (Ihor Radchenko's message of "Sat, 06 Aug 2022 21:35:13 +0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:238988 Archived-At: [=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 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.