bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Stefan Monnier
Subject: bug#50840: 28.0.50; Support GNU style of multiline comments in C source code
Date: Fri, 01 Oct 2021 16:57:01 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> 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.  */

Ah, now that makes sense, thanks.

>> 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?

I don't think so because it will fail to indent the last 3 lines by the
extra 3 spaces.

>> 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.

Right (though you do want to use a leader on each line, just one of "   "
instead of " * "), but `comment-styles` doesn't have a field to specify
that the comment-continuation should be empty, so I was going for
a cheaper solution.

I'll try again later for something less cheap ;-)


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]