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

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

bug#60280: 29.0.60; c-ts-mode: Indent content on newline


From: Yuan Fu
Subject: bug#60280: 29.0.60; c-ts-mode: Indent content on newline
Date: Sat, 24 Dec 2022 19:04:46 -0800

Mohammed Sadiq <sadiq@sadiqpk.org> writes:

> The content doesn't seem to indent on newline after the user press
> <Return> as in c-mode. And the user requires to press TAB explicitly
> for this happen (and indentation happens only on non empty content).
>
> Say for example, for the following code, if I press <Return> (| is the
> point)
>
> if (success)|
>
> I get:
>
> if (success)
> |
>
> but I expect the following (with gnu style and 2 space indentation):
>
> if (success)
>   |
>
>
> This is very much broken in do-while loops:
>
> Say if I do:
>
> do
> {
> }
>
> and do TAB (after selecting the whole code), indentation doesn't happen
> (with gnu style), but it seems to happen right once I complete writing
> while(0); (or so). (Or is this a different bug?)

This is because when you haven’t typed out the complete statement, the
parser couldn’t naturally don’t have the complete statement in the parse
tree, so the indent rules didn’t match. Once you completed the
statement, everything works as intended. We would need to add some
clever heuristics to match even when the parse tree is incomplete.

I’ll try to do it when I found some time, thought the priority would be
lower than other stuff.

Yuan





reply via email to

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