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

Previous Next

Package: emacs;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Fri, 23 Dec 2022 18:02:01 UTC

Severity: minor

Found in version 29.0.60

Full log


View this message in rfc822 format

From: Yuan Fu <casouri <at> gmail.com>
To: sadiq <at> sadiqpk.org
Cc: 60280 <at> debbugs.gnu.org
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 <at> 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




This bug report was last modified 1 year and 282 days ago.

Previous Next


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