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

From: Ihor Radchenko <[email-masked]>
Date: Wed, 17 Aug 2022 18:08:56 +0800

Richard Stallman <[email-masked]> writes:

>   > 'early-local will apply file/directory-local variables _before_ executing
>   > the major-mode body. In contrast, the variables without this property
>   > are applied _after_ executing the major-mode body.
>
> I suppose you'll do something to protect those local variables from
> `kill-all-local-variables' so it won't kill them.

No. Not killing the _already existing_ local variables is what
'persistent-local is for. What I am proposing here is only relevant to
buffer-local and directory-local variables that are going to be loaded
anyway. The change will only affect _when_ they are loaded.

> Will it distinguish THIS major mode's early local variables from the
> early local variables of the PREVIOUS major mode?  Those ought to be
> killed with all the rest.

I do not propose to keep the local variable values from the previous
major mode. What I suggest is running a part of hack-local-variables
earlier. Either way, file/directory-local variables will be set in the
buffer.

Hope I clarified the confusion.

-- 
Ihor Radchenko,
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