From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#57003: 28.1.90; Can local variables be loaded before loading major mode? Date: Sat, 29 Oct 2022 10:40:06 -0400 Message-ID: References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@gnus.org> <875yj5xzou.fsf@localhost> <87h6zni1uc.fsf@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3878"; 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, Ihor Radchenko To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 29 16:41:14 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 1oon1N-0000oo-87 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Oct 2022 16:41:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oon1D-0000Q6-SZ; Sat, 29 Oct 2022 10:41:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oon1C-0000Pd-Ef for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 10:41:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oon1C-0008HX-0d for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 10:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oon1B-0002tY-Oa for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 10:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Oct 2022 14:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57003 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 57003-submit@debbugs.gnu.org id=B57003.166705441911064 (code B ref 57003); Sat, 29 Oct 2022 14:41:01 +0000 Original-Received: (at 57003) by debbugs.gnu.org; 29 Oct 2022 14:40:19 +0000 Original-Received: from localhost ([127.0.0.1]:36309 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oon0U-0002sO-K2 for submit@debbugs.gnu.org; Sat, 29 Oct 2022 10:40:18 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10936) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oon0T-0002s9-2i for 57003@debbugs.gnu.org; Sat, 29 Oct 2022 10:40:17 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1091D100189; Sat, 29 Oct 2022 10:40:11 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5A1AA1000FF; Sat, 29 Oct 2022 10:40:09 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1667054409; bh=MXRgDCkk2zAoRT8AhGwW1MQyondTHdSMP2UVvNvaJx0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ZKbf7tIk+U6Oknxzs7LKdpdUvxalk/l7/2z9xtQZUq3RpBX2deIWmWgaTNo6ZSMtb UDEG34S9Hv2O6Yq2fLNm5hvJ+jizJIf6g7puzOFHL6ZGqGjHoXp4DzEy58HDCZwmMr 8kfDsbKz8bFYmEGsTSrPeLI2dQTNUYvOXzS7rrNIyIkixhPUubqP5uqlr0GhV6sYYX CNk9kB4mx3hTqUG2nSoryoBwA8nY90IFDz8Dpfwqzy0oxjBy5D4ChL9MvxeacvSZsz Z5/oOttVhJoJR06Xzz4bgevQ3JIqhyJd1z46RLIA/X9PhiQAeFpAASydsA3/fuijsw Q6wJ3sKH2BRaA== Original-Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 23247120EA1; Sat, 29 Oct 2022 10:40:09 -0400 (EDT) In-Reply-To: <87h6zni1uc.fsf@localhost> (Ihor Radchenko's message of "Sat, 29 Oct 2022 06:24:43 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246534 Archived-At: >> The problem is not that the variables are set too late,it's that you >> fold too early: the folding should not to take place from within >> `org-mode` but instead `org-mode` should add the folding function to >> `hack-local-variables-hook`. >> >> What you request is a common need, and `hack-local-variables-hook` is >> the standard answer. > > I guess that it can be an option. Though such hook will also need to be > guarded against repetitive execution (if `hack-local-variables' is > called by some minor mode or a command). > > However, pretty much all the BODY in Org major mode definition will need > to go into the hook. It feels awkward. The body of a major mode should usually be limited to setting some variables. All the font-lock highlighting, the imenu scanning, the syntax-propertizing, etc... is done afterwards (the later the better). The act of folding is not part of "defining" the major mode in my book :-) > Will moving the whole major mode definition into > `hack-local-variables-hook' be safe? Define "safe". I'm sure it'll cause problems in corner cases. If those problems come down to the fact that `hack-local-variables-hook' doesn't fit the bill, then we can look at fixing that. Stefan