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

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> gmail.com>

Date: Fri, 5 Aug 2022 11:44:02 UTC

Severity: wishlist

Found in version 28.1.90

Full log


View this message in rfc822 format

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 57003 <at> debbugs.gnu.org, Ihor Radchenko <yantar92 <at> gmail.com>
Subject: bug#57003: 28.1.90; Can local variables be loaded before loading major mode?
Date: Sun, 30 Oct 2022 02:57:16 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> 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 <at> localhost/T/#u

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

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

>> Will moving the whole major mode definition into
>> `hack-local-variables-hook' be safe?
>
> Define "safe".  I'm sure it'll cause problems in corner cases.
> If those problems come down to the fact that `hack-local-variables-hook'
> doesn't fit the bill, then we can look at fixing that.

I was mostly asking if you are aware about any gotchas.
As I stated above, there is at least one gotcha with early fontification
when unsafe variable dialogue is being shown.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




This bug report was last modified 1 year and 288 days ago.

Previous Next


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