[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dir-local vs major-mode setting
From: |
Phil Sainty |
Subject: |
Re: dir-local vs major-mode setting |
Date: |
Thu, 15 Nov 2018 14:18:08 +1300 |
User-agent: |
Orcon Webmail |
On 2018-11-15 11:19, Stefan Monnier wrote:
I'm thinking of a case where the project says "you should use TABs" so
it sets
((nil . ((indent-tabs-mode . t))))
in the .dir-locals.el file. But TABs in TeX files tend to behave
funny, so tex-mode.el sets indent-tabs-mode to nil. Assuming the
.dir-locals.el setting was meant for "the majority of the files"
and those aren't .tex files, it would make sense to favor the major
mode's setting for the few .tex files.
If the project is expected to contain .tex files then the above would
constitute a bug in the .dir-locals.el file (which should contain mode-
specific entries for exceptions to the global settings).
Users could either fix the .dir-locals.el file, or add their own
custom .dir-locals-2.el file with the necessary overrides.
They can also use `hack-local-variables-hook'.
I guess sometimes you want one and sometimes you want the other.
So maybe to handle that case we'd want to introduce another wildcard
that works like the `nil` above but implies it's applied before running
the major mode's setup function.
If a "hack certain local vars before running hooks" facility was added,
I wouldn't think it should be constrained to the nil case?
Perhaps add something like the string path syntax, under which you
can provide a complete dir-locals spec, which should run early. The
key might be a keyword like :early or some such.
-Phil