|
From: Arsen A. <ar...@aa...> - 2026-01-29 15:44:09
|
Alan Mackenzie <ac...@mu...> writes:
> Does it? I don't think L X+1 does affect L X. Maybe there's something
> coincidental in some test cases.
Ah, you're right! I just figured out what happened.
1. Enable electric-pair-local-mode
2. Type, without leading whitespace (naturally):
int foo (int a,
/* hello */
int b)
Upon reaching '(', electric-pair will insert ')', and as you keep
typing, it will be carried to the new line. So, when the comment is
opened or closed, the indent engine sees that and figures "ah! there's
more text on this line, I'm a leading comment" and reindents
accordingly.
So, my initial description was indeed incorrect. Sorry about that.
> I've committed the patch to CC Mode, thanks.
>
>> It may be wise to drop in some tests of both leading and non-leading
>> comments. This should prevent future regressions.
>
> I've added a new test case to the CC Mode test suite which tests these
> things. It's called comments-12.c, and looks like this:
>
> #########################################################################
> int foobar (int a,
> /* bar */ int b,
> /* foo */
> int c);
>
> int foobar (
> /* foo */
> /* bar */ int a,
> /* b */ int b,
> int c);
>
> /* Local Variables: */
> /* c-file-offsets: ((arglist-intro . c-lineup-arglist-intro-after-paren)) */
> /* End: */
> #########################################################################
Shouldn't have doubted you! That's nice :-)
--
Arsen Arsenović
|