Re: c-ts-mode: How to set indent-style in dir-locals
[email protected] Mon, 18 May 2026 19:09:45 -0400
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
Michael Heerdegen via Users list for the GNU Emacs text editor <[email protected]> writes: > Stéphane Marks <[email protected]> writes: > >> It might be worth trying and adapting something like this in your >> .dir-locals.el or .dir-locals-2.el file: >> >> ( >> (c-mode . ((eval . (setopt-local c-ts-mode-indent-style 'bsd)))) >> ) >> >> 'setopt-local' is new in Emacs 31. > > I don't know if this will behave as expected (I guess not), since the > custom setter loops over all buffers (`c-ts-mode--indent-style-setter'). > > But it looks like all you have to do for a single buffer is calling > `c-ts-mode-set-style'? That's what that setter does. > Should not the solution be that (one day) Emacs will process ‘.dir-locals.el’ files differently than it does now so that variables and user options are set appropriately and transparently so that users can simply write the expressions using the same syntax for both? That is, the following expression would set the user option ‘c-ts-mode-indent-style’: ((c-mode . ((c-ts-mode-indent-style . bsd))))) This would mean that when these expressions are evaluated, Emacs would determine whether ‘c-ts-mode-indent-style’ is a user option or a variable, and set its value using the appropriate mechanism. In the meantime, the user option can either be set interactively using the pre-defined commands or can be set non-interactively the way all user options are (or should be set). -- The lyf so short, the craft so long to lerne. - Geoffrey Chaucer, The Parliament of Birds.