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

From: Stefan Monnier <[email-masked]>
Date: Tue, 18 Oct 2022 09:29:40 -0400

> We have a variable org-startup-folded:
>
>    Non-nil means entering Org mode will switch to OVERVIEW.
>
> This variable controls the initial state of the Org buffer.
> When, non-nil, headings will be folded at the end of Org initialization.
> This folding happens inside org-mode specification and hence setting the
> variable after Org mode is loaded makes no difference.

The problem is not that the variables are set too late,it's that you
fold too early: the folding should not to take place from within
`org-mode` but instead `org-mode` should add the folding function to
`hack-local-variables-hook`.

What you request is a common need, and `hack-local-variables-hook` is
the standard answer.

        Stefan