From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: "Eli Zaretskii" <eliz@gnu.org>,
61893@debbugs.gnu.org, "Daniel Martín" <mardani29@yahoo.es>
Subject: bug#61893: 29.0.60; Indentation in c-ts-mode broken again
Date: Mon, 06 Mar 2023 07:03:33 +0100 [thread overview]
Message-ID: <877cvuo1qi.fsf@thornhill.no> (raw)
In-Reply-To: <7CDB5C99-AC13-463A-9B59-B6BB5011E683@gmail.com> (Yuan Fu's message of "Sun, 5 Mar 2023 15:26:45 -0800")
Yuan Fu <casouri@gmail.com> writes:
>> On Mar 5, 2023, at 12:22 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>
>>> From: Yuan Fu <casouri@gmail.com>
>>> Date: Sat, 4 Mar 2023 15:03:46 -0800
>>> Cc: Eli Zaretskii <eliz@gnu.org>,
>>> Daniel Martín <mardani29@yahoo.es>,
>>> 61893@debbugs.gnu.org
>>>
>>>>>>> The elif directive’s and subsequent directives aren’t indented
>>>>>>> properly. Looking at the parsed tree, the elif directives are nested in
>>>>>>> the if directive, and the nesting can be arbitrarily deep. We probably
>>>>>>> need a custom function rather than great-grand-parent to find the anchor,
>>>>>>> like a function that keeps going up the tree until the node isn’t a
>>>>>>> preproc directive anymore.
>>>>>>>
>>>>>>> Yuan
>>>>>>
>>>>>> Yeah, you're right. I'll see what I can do, but bandwidth is a little low at the moment, so if you have some extra time, don't hesitate to improve it :)
>>>>>
>>>>> Absolutely, I’ll work on it.
>>>>>
>>>>> Yuan
>>>>
>>>> Thanks :)
>>>
>>> Done!
>>
>> Thanks.
>>
>> Some problems still remain.
>
> Thanks, there are so many edge cases :-)
>
>>
>> Line 1761 of dispnew.c: type "C-e RET" -- point goes to column 7
>> instead of the expected column 2.
>
> Fixed.
>>
>> Line 3381 of dispnew.c: type "C-e RET" -- point goes to the correct
>> column, but line 3381 is reindented incorrectly.
>
> This is due to it aligning to the previous sibling, aka the comment. Do we want to skip comments for the “align to the prev sibling” rule?
>
>>
>> Line 6611 of dispnew.e: type "C-e RET" -- point goes to column 0
>> instead of the expected column 2. If you type "C-e RET" on the next
>> line 6612, point goes to column 0 and the line is reindented
>> incorrectly.
>
> Fixed.
>>
>> Line 13925 of xdisp.c: type "C-e RET" -- point goes to column 33(!)
>> and line 13925 is reindented incorrectly.
>
> Fixed.
>>
>> Lines 34529 and 34530 of xdisp.c: "C-e RET" produces incorrect column
>> of point and reindents line 34530.
>
> The preproc directive messed the parse tree, and tree-sitter can’t tell that it’s an else statement, so it can’t be easily fixed sadly.
>
> Yuan
Now this isn't indenting how I expect:
int foo
{
| // <-- Now point is indented to column 0
}
It seems like `c-ts-mode--anchor-prev-sibling` isn't handling this?
Theo
next prev parent reply other threads:[~2023-03-06 6:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-01 14:37 bug#61893: 29.0.60; Indentation in c-ts-mode broken again Eli Zaretskii
2023-03-01 16:35 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-01 16:59 ` Eli Zaretskii
2023-03-01 17:13 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-01 18:26 ` Eli Zaretskii
2023-03-01 22:08 ` Yuan Fu
2023-03-02 6:31 ` Eli Zaretskii
2023-03-03 4:07 ` Yuan Fu
2023-03-03 6:07 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-03 22:01 ` Yuan Fu
2023-03-04 8:54 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-04 23:03 ` Yuan Fu
2023-03-05 8:22 ` Eli Zaretskii
2023-03-05 23:26 ` Yuan Fu
2023-03-06 6:03 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-03-06 12:57 ` Eli Zaretskii
2023-03-06 12:58 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877cvuo1qi.fsf@thornhill.no \
--to=bug-gnu-emacs@gnu.org \
--cc=61893@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=mardani29@yahoo.es \
--cc=theo@thornhill.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).