Subject: bug#50840: 28.0.50; Support GNU style of multiline comments in C source code

From: Eli Zaretskii <[email-masked]>
Date: Fri, 01 Oct 2021 22:50:11 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked],  Alan Mackenzie <[email-masked]>
> 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.