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


Message #13 received at 75442-done <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Theodor Thornhill <theo <at> thornhill.no>,
 Uygar KÖSEER <uygarkoseer <at> gmail.com>,
 75442-done <at> debbugs.gnu.org
Subject: Re: bug#75442: 31.0.50; c-ts-mode indentation problem
Date: Sun, 12 Jan 2025 22:25:31 -0800

> On Jan 10, 2025, at 5:20 PM, Stefan Kangas <stefankangas <at> gmail.com> wrote:
> 
> 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 is caused by some recent changes I made. I pushed a fix to master.

Yuan



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.