bug#68493: Got to be a better way to customize c-ts-mode indentation

Björn Lindqvist <[email protected]> Mon, 3 Aug 2026 17:33:58 +0200
Newsgroups gmane.emacs.bugs
Message-ID <CALG+76deBUWysztOjTbQC86c2vjE1mi8WeFZQt8oTACph7TTJQ@mail.gmail.com>
Den m=C3=A5n 3 aug. 2026 kl 14:46 skrev Tomas Nordin <[email protected]>:
> Is the following description this bug? Or should I talk more about it in
> some other or new report?
>
> Its about indentation of concatanated strings like this (in a c-buffer)
>
> char *lines =3D
>   "line1\n"
>   "line2\n"
>
> The above is what I "get" with c-mode (in emacs -Q). If I switch over to
> c-ts-mode and say C-x h and TAB, I get
>
> char *lines =3D
>   "line1\n"
>     "line2\n"
>
> Further literals will align with "line2\n". I would like it to be
> aligned as with c-mode. Is there a setting for this?
>
> This has been observed with
>
> GNU Emacs 31.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.49, ca=
iro version 1.18.4) of 2026-07-02

Hello Tomas,

I can confirm the bug in 32.0.50. However, my c-ts-mode config I
posted on emacs-devel fixes it:

https://gist.github.com/bjourne/31f53043c72728cb4d8b90feedd0625b

You can take inspiration from that. Specifically, you need to prepend the
rule ((parent-is "concatenated_string") parent 0) to
treesit-simple-indent-rules.


--=20
mvh/best regards Bj=C3=B6rn Lindqvist