Re: c-ts-mode: How to set indent-style in dir-locals

Dave Marquardt <[email protected]> Tue, 19 May 2026 07:48:13 -0500
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Jean Louis <[email protected]> writes:

> (describe-variable 'c-ts-mode-indent-style)
>
> c-ts-mode-indent-style is a variable defined in ‘c-ts-mode.el’.
>
> Its value is ‘gnu’
>
> Style used for indentation.
>
> The selected style could be one of GNU, K&R, LINUX or BSD.  If the
> supplied styles don’t suffice, the value could be a function instead.
> This function takes no arguments and is expected to return a list of
> indent RULEs as described in ‘treesit-simple-indent-rules’.  Note that
> the list of RULEs doesn’t need to contain the language symbol.
>
>   This variable is safe as a file local variable if its value
>   satisfies the predicate ‘c-ts-indent-style-safep’.
>   This variable was introduced, or its default value was changed, in
>   version 29.1 of Emacs.
>   You can customize this variable.
>   Setting this variable directly with ‘setq’ may not take effect;
>   use either customize or ‘setopt’, or call
>   ‘c-ts-mode--indent-style-setter’.
>
> [back]
>
> You can see the key clue right there in the documentation:
>
> "Setting this variable directly with ‘setq’ may not take effect; use
> either customize or ‘setopt’, or call
> ‘c-ts-mode--indent-style-setter’."

I've read the manual about file variables and directory local variables,
and it isn't clear to me exactly *how* Emacs sets these variables when
it detects them. So to be honest I wouldn't know that this was a setq
vs. setopt issue as described here.

-Dave