Skip to content

Fix the options .dir-locals.el couldn't set - #172

Merged
bbatsov merged 3 commits into
mainfrom
fix-local-options
Nov 1, 2026
Merged

bbatsov merged 3 commits into
mainfrom
fix-local-options

Conversation

@bbatsov

@bbatsov bbatsov commented Nov 1, 2026

Copy link
Copy Markdown
Member

clojure-ts-outline-variant and clojure-ts-completion-enabled now work from .dir-locals.el. The options that only take effect when the package loads or the mode creates its parsers are no longer marked safe, since a directory-local value never reaches them; a project that sets one gets the usual prompt instead of being silently ignored. Also drops a thing-settings entry that never took effect, as enabling it would make sexp commands on Emacs 30 jump across docstring words.

@bbatsov
bbatsov force-pushed the fix-local-options branch 2 times, most recently from a5af0a9 to 1772442 Compare November 1, 2026 09:30
The markdown-inline entry of clojure-ts--thing-settings sat in a `when'
form that the backquote didn't evaluate, so it defined the things of a
language called `when' and never took effect.  Making it take effect
isn't an improvement: on Emacs 30, where forward-sexp goes through these
things, C-M-f and C-M-k from a plain word in a docstring would jump to
the end of the next code span, and Emacs 31 moves over atoms without
them.  Remove it.
clojure-ts-outline-variant and clojure-ts-completion-enabled are safe
as directory-local variables, but they were only read while the mode
set itself up, before the directory-local ones are set.  Redo their
part of the setup when they're set locally, like for the indentation
style.  The imenu variant of the outline now gets set up here too,
rather than by treesit-major-mode-setup, so that switching to it works.

Only the two valid values of clojure-ts-outline-variant are safe now,
so a typo in .dir-locals.el doesn't silently select the imenu outline.
clojure-ts-ensure-grammars, clojure-ts-auto-remap and the options that
turn the embedded parsers on and off are read when the package loads or
when the mode sets up its parsers, before any directory-local variables
are set.  Marked safe, they were silently ignored in .dir-locals.el.
@bbatsov
bbatsov merged commit 6a05097 into main Nov 1, 2026
10 checks passed
bbatsov added a commit that referenced this pull request Nov 7, 2026
#172 removed clojure-ts--markdown-inline-sexp-nodes along with its only
use, and #164 brought it back while rebasing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant