bug#80267: CC Mode 5.35.2 (C/*l); C mode comment in signature indentation regression

Arsen Arsenović via CC-Mode-help <[email protected]> Thu, 29 Jan 2026 16:42:53 +0100
Newsgroups gmane.emacs.cc-mode.general
Message-ID <[email protected]>
--===============8548511970274199490==
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Alan Mackenzie <[email protected]> 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 :-)
=2D-=20
Arsen Arsenovi=C4=87

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQECBAEWCgCqFiEE/uKz0RP8AKMWLWBhUsKUMB6ixJMFAml7f/0bFIAAAAAABAAO
bWFudTIsMi41KzEuMTEsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRGRUUyQjNEMTEzRkMwMEEzMTYyRDYw
NjE1MkMyOTQzMDFFQTJDNDkzEBxhcnNlbkBhYXJzZW4ubWUACgkQUsKUMB6ixJOV
hQD/ZT3GaIXlufT+1/FxXjbarOHanVogCYEGgozCl4mBBm4A/RZidFuRxSYafG5A
6OuSfoWd5JHTBB1GtPWpmghbuyQM
=Bqli
-----END PGP SIGNATURE-----
--=-=-=--




--===============8548511970274199490==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============8548511970274199490==--