GNU bug report logs - #75442
31.0.50; c-ts-mode indentation problem

Previous Next

Package: emacs;

Reported by: Uygar KÖSEER <uygarkoseer <at> gmail.com>

Date: Wed, 8 Jan 2025 17:56:01 UTC

Severity: normal

Found in version 31.0.50

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Uygar KÖSEER <uygarkoseer <at> gmail.com>,  75442 <at> debbugs.gnu.org
Cc: Theodor Thornhill <theo <at> thornhill.no>
Subject: bug#75442: 31.0.50; c-ts-mode indentation problem
Date: Sat, 11 Jan 2025 01:20:48 +0000
Uygar KÖSEER <uygarkoseer <at> gmail.com> writes:

> Hi,
>
> I started to use c-ts-mode (tree-sitter) and I think there is a little
> indentation problem when typedef declaration is used.
>
> Wrong indentation case:
>
> typedef struct Point
>         {
>             int x;
>             int y;
>         } Point;
>
> I think this happens because it aligns it with the struct keyword.
>
> Working case:
> typedef struct Point Point;
> struct Point
> {
>     int x;
>     int y;
> } Point;
>
> This case works without problem because the struct keyword is at the
> beginning of the line.
>
> Both of the cases are matched with this part in c-ts-mode.el:
> ((parent-is ,(rx (or "function_definition"
>                                 "struct_specifier"
>                                 "enum_specifier"
>                                 "function_declarator"
>                                 "template_declaration")))
>             parent 0)
>
> I also tried to change this behaviour by adding new rules to my
> c-ts-mode configuration but it always matches with the default
> configuration first. I do not know if there is any way to change this
> behaviour without re-defining all the default configuration.

Theodor, any comments here?




This bug report was last modified 128 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.