bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57003: 28.1.90; Can local variables be loaded before loading major m


From: Ihor Radchenko
Subject: bug#57003: 28.1.90; Can local variables be loaded before loading major mode?
Date: Mon, 31 Oct 2022 03:08:36 +0000

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> , 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?
>
> It's run after setting file-local vars, which themselves are set after
> running the mode hooks.

This is unfortunate.

org-mode-hook is "Mode hook for Org mode, run after the mode was turned
on.". But we need to load file-local variables in order to turn on Org
mode + respect file-local settings. So, neither
hack-local-variables-hook nor :after-hook will solve the problem I
suggested solving in this discussion.

For Org mode, it is necessary to complete the setup before org-mode-hook
is loaded (I am not talking about folding; there are more critical parts
like parser setup). Otherwise, the existing third-party packages adding
things to org-mode-hook will be broken.

Outside Org mode peculiarities, the fact that
hack-local-variables-hook is run after *-mode-hook also means that
subtle bugs might be introduced into major modes that are utilizing
hack-local-variables-hook for important setup.

I conclude that my original idea herein about a new option to load local
variables early may be even more important than I initially thought.

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]