bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61208: 29.0.60; treesit-beginning/end-of-defun problem with macros i


From: Theodor Thornhill
Subject: bug#61208: 29.0.60; treesit-beginning/end-of-defun problem with macros in c-ts-mode
Date: Wed, 01 Feb 2023 14:10:48 +0100

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: yang.yingchao@qq.com
>> Date: Wed, 01 Feb 2023 14:33:24 +0800
>> From:  Yang Yingchao via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> 
>> #define SWITCH()
>> #define CASE(name)           case name:
>> 
>> void func(int i)        // LINE_E
>> {
>>     SWITCH(i)           // LINE_D
>>     {
>>         CASE(A)         // LINE_C
>>         {
>>             ;
>>         }
>>         CASE(B)         // LINE_B
>>         {
>>             ;           // LINE_A
>>         }
>>     }
>> }
>> 
>> When cursor is at LINE_A, and stoke `C-M-a`, cursor will go to LINE_B;
>> then `C-M-a` again, cursor goes to LINE_C, then `C-M-a` again, LINE_D,
>> and `C-M-a` again, finally to LINE_E...
>
> Set treesit-defun-tactic to 'top-level, and your problem is solved.
>
> Yuan, Theo: do we want to have that set by default in ts-c-mode?  C
> doesn't have nested functions, so it should be a better default, what
> with all the cpp madness that the C grammar doesn't grok.
>
> Maybe also in C++ and Java -- AFAIU they don't have nested functions
> either.
>
> WDYT?

I'm fine with that change, I think.  Other, "smaller" constructs can be
found as sentences or sexps anyway, I think.

Theo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]