Subject: bug#57003: 28.1.90; Can local variables be loaded before loading major mode?

From: Ihor Radchenko <[email-masked]>
Date: Sun, 30 Oct 2022 04:01:08 +0000

Stefan Monnier <[email-masked]> writes:

>> Not really, no.  I have no doubt that there are various (in addition to
>> the one you mention above).
>
> Looking at some of the related code, I had a feeling of "déjà vu":
> `hack-local-variables-hook' indeed suffers from various gotchas
> (starting with the non-intuitive name and the fact that it only
> applies to file-visiting buffers)

Does it mean that "Major modes can use this to examine user-specified
local variables in order to initialize other data structure based on
them." statement in the docstring of `hack-local-variables-hook' should
be amended?

> , and I think my recommendation was out
> of date: the better answer is to use `after-change-major-mode-hook` the
> `:after-hook` thingy of `define-derived-mode`.

Will it run before or after org-mode-hook?

> And the remaining gotcha (for Org's support of Emacs-25) is that in
> Emacs<26 these were run *before* `hack-local-variables` :-(

This is not a problem. Org officially supports Emacs >=26. No more need
to keep Emacs 25 compatibility. See
https://orgmode.org/worg/org-maintenance.html#emacs-compatibility

-- 
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>