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

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

multi-line comments in cc-mode


From: Tony Tung
Subject: multi-line comments in cc-mode
Date: Tue, 3 Jun 2003 19:10:10 +0000 (UTC)
User-agent: slrn/0.9.7.4 (FreeBSD)

Background info: GNU Emacs 21.3.1; cc-mode with auto-fill-mode.
c-block-comment-prefix is set to "* "

I posted this a few weeks ago to comp.emacs and gnu.emacs.help, but got no
responses.  I did do a bit more experimentation and got some more data.
Hopefully it'll be useful.

If I have a comment that looks like this:

   /* lot's of text here and so forth blah blah blah ...

When I reach the fill column, I get:

   /* lot's of text here and so forth blah blah blah ...
    * blah blah blah ...

This is expected.  Since this is the first time the comment block is
broken, Emacs doesn't know how to prefix and automagically puts the "* "
(from c-block-comment-prefix) in front.  All is good.  I continue typing
and I get:

   /* lot's of text here and so forth blah blah blah ...
    * blah blah blah ...
   blah blah blah blah

Wow, not good!  How come it didn't understand the prefix from the previous
two lines?  The odd thing is that if the comment starts in column 1, it
works as expected, like this:

/* lot's of text here and so forth blah blah blah ...
 * blah blah blah ...
 * blah blah blah blah

I did a little more experimenting and discovered that if I put two empty
lines in the block comment first, it always works correctly.  That is,

    /* 
     *
     * lot's of text here and so forth blah blah blah ...
     * blah blah blah 

will correctly fill to become:

    /* 
     *
     * lot's of text here and so forth blah blah blah ...
     * blah blah blah ...
     * blah blah blah blah

Any ideas?  Thanks.




reply via email to

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