Support buffer-local indent specs
DerGuteMoritz opened this issue · 1 comments
Problem
At the moment, indent specs are stored globally via symbol properties. This makes it pretty much impossible to e.g. have project-specific indendation settings via directory local variables.
For example, when visiting a Clojure file in a project which has a .dir-locals.el like this (cribbed from #598):
((clojure-mode
(eval . (put-clojure-indent 'defrecord '(2 :form :form (1))))))Then this indentation spec will be retained as global state even when visiting Clojure files of other projects. Ideally, it would only apply to files in the specific project.
Solution
If indent specs where stored in a buffer-local variable instead, the above scenario should work as expected / desired. If that seems reasonable, I can try to come up with a corresponding patch.
From intuition (which might be wrong) buffer-local variables might have issues of their own. State is tricky!
I'd prefer if we provided a function to reset all built-in specs to their initial values.
Then you could do this:
((clojure-mode
(eval . (reset-clojure-indents))
(eval . (put-clojure-indent 'defrecord '(2 :form :form (1))))))This would have the advantage of being a non-intrusive change - we can know for sure that we aren't introducing subtle issues.
The PR would be super simple: wrap
Line 1651 in c339353