GNU bug report logs - #50840
28.0.50; Support GNU style of multiline comments in C source code

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Mon, 27 Sep 2021 07:57:02 UTC

Severity: wishlist

Found in version 28.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #28 received at 50840 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: acm <at> muc.de, 50840 <at> debbugs.gnu.org
Subject: Re: bug#50840: 28.0.50; Support GNU style of multiline comments in
 C source code
Date: Fri, 01 Oct 2021 22:50:11 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: 50840 <at> debbugs.gnu.org,  Alan Mackenzie <acm <at> muc.de>
> Date: Fri, 01 Oct 2021 15:42:32 -0400
> 
> > It sounds like none of the comment styles in 'comment-styles' can
> > produce the style of C code comments that we use in Emacs, i.e.
> >
> >     /* This is the first line of a multi-line comment.
> >        This is the final line of a multi-line comment.  */
> >
> > And I don't see anything in the CC Mode manual to augment that,
> > either.
> 
> I'm not sure exactly what that would mean in practice.
> `comment-style` is used to comment out code rather than to write the
> text of a comment.  I think what you're asking for is what you get by
> setting `comment-multi-line` and then writing your text (e.g. starting
> with M-; and then typing the text in there, maybe with auto-fill set).

The actual use case is to convert a block of comments like this:

    // First line
    // continuation line with more text,
    // more text.  And another sentence
    // which continues here.

to our comment style.  I thought it was easy: first uncomment the
region, then comment the region using the proper style.  But there's
no style to take a sequence of lines like this:

     First line
     continuation line with more text,
     more text.  And another sentence
     which continues here.

and make it look like this:

     /* First line
        continuation line with more text,
        more text.  And another sentence
        which continues here.  */

> If you want comment-region to produce something like the above, then
> maybe a patch like the following would make sense?

It's late down here, so instead of applying the patch and playing with
it, let me ask you: will this patch support the above use case?

> The idea is to add a new value nil to `comment-style` which would
> instruct `comment-region` to refrain from adding `comment-continue` on
> eachline of a multiline comment.

The value nil doesn't sound like a good mnemonic.  I think the style I
have in mind is a multi-line style, just without the "* " leader on
each line.

Thanks.




This bug report was last modified 2 years and 319 days ago.

Previous Next


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