From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#57003: 28.1.90; Can local variables be loaded before loading major mode? Date: Sun, 30 Oct 2022 02:57:16 +0000 Message-ID: <87pmeaauib.fsf@localhost> References: <87czdeoqy7.fsf@localhost> <87v8r54j3h.fsf@gnus.org> <875yj5xzou.fsf@localhost> <87h6zni1uc.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13293"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , 57003@debbugs.gnu.org, Ihor Radchenko To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 30 03:57:21 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 1ooyVl-0003F0-8Q for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Oct 2022 03:57:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooyVT-00086E-NK; Sat, 29 Oct 2022 22:57: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 1ooyVS-000867-P3 for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 22:57: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 1ooyVS-0005UZ-HZ for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 22:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ooyVS-0001os-5d for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 22:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Oct 2022 02:57: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.16670986066971 (code B ref 57003); Sun, 30 Oct 2022 02:57:02 +0000 Original-Received: (at 57003) by debbugs.gnu.org; 30 Oct 2022 02:56:46 +0000 Original-Received: from localhost ([127.0.0.1]:36968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ooyVB-0001oN-Kl for submit@debbugs.gnu.org; Sat, 29 Oct 2022 22:56:45 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:59587) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ooyV7-0001o3-2d for 57003@debbugs.gnu.org; Sat, 29 Oct 2022 22:56:43 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 21C9F240101 for <57003@debbugs.gnu.org>; Sun, 30 Oct 2022 03:56:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667098595; bh=De0sBDQk0UbinkpLNI0dA9Oma5NrlcNNwo4cKWEy/Ho=; h=From:To:Cc:Subject:Date:From; b=lrx1F+cE7V4tEydu2V1vlCX5JUIbj7j+SbZ3tASCPVCU2DS0HhS51HL5hbt6zFsil 71Vk+k6WjvtDPKQIu9IDsk1NtBanGStV1eNPzTWaCdbm9L20nXa8XxBYYkrlYV3/RG Yz0L1j7gq+tgAjY7gZQWTwqsUJDAgHSaVlEU+ySslvhJ5U643wTUCNf/j+gstS9gMN QUVtN0UDOUuO6QvU8GIKAc0pdCcDhv5Awd0V6bB60JEtKXzoEBKlSZ0/o6JnO27EYd PXhMjMI/6MWoGScB3f0Doynjz/LHSmr+rVzlsnfMu+UpyjGbw6A2tJbw560zkD73Cy w6wC+P/HyXTLw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N0LXK1Twkz9rxF; Sun, 30 Oct 2022 03:56:32 +0100 (CET) In-Reply-To: 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:246580 Archived-At: Stefan Monnier writes: >> However, pretty much all the BODY in Org major mode definition will need >> to go into the hook. It feels awkward. > > The body of a major mode should usually be limited to setting some > variables. All the font-lock highlighting, the imenu scanning, the > syntax-propertizing, etc... is done afterwards (the later the better). One issue I envision is when unsafe variable dialogue is being displayed. If font-locking is not setup prior to that, Emacs will try to fontify the visible part of buffer when displaying the dialogue and later font-lock settings may not fully apply. See https://list.orgmode.org/orgmode/878ro8kqwv.fsf@localhost/T/#u > The act of folding is not part of "defining" the major mode in my > book :-) Indeed. However, a lot more things in Org mode depend on user customizations. For example, buffer-invisibility-spec may be changed depending on user settings, including settings defined in file-local variables. >> Will moving the whole major mode definition into >> `hack-local-variables-hook' be safe? > > Define "safe". I'm sure it'll cause problems in corner cases. > If those problems come down to the fact that `hack-local-variables-hook' > doesn't fit the bill, then we can look at fixing that. I was mostly asking if you are aware about any gotchas. As I stated above, there is at least one gotcha with early fontification when unsafe variable dialogue is being shown. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at