Seems like most major modes clear all local variables before initializing. It also seems like many major modes read variables while initializing to customize their behavior.
If I want to set a file or directory local variable to determine major mode behavior (for example, overwriting web mode's
.dir-locals.el), how can it be done so that the local variables are written before the major mode actually initializes, but are not cleared?
One way to do it would be to bind/rebind global variables using
((nil . ((eval . ((lambda () (setq name val))))))) in
nil key seems to run before any major-modes are entered. Still, it doesn't seem ideal to overwrite global config. For example, maybe I want to work on multiple projects in the same emacs instance.