tags:

views:

791

answers:

2

Hi,

I'm trying to configure emacs to indent my C block comments nicely.

Emacs (22.3) does by default (regardless of the indentation style):

/* My very long comment which spreads over multiple lines
* and thus needs to be filled.
*/

But what I would highly prefer is:

/* My very long comment which spreads over multiple lines
 * and thus needs to be filled.
 */

I tried to play around with c-offset-alist and the syntactical symbol `c', but it didn't help me understand the problem:

(c-add-style "mine"
             '((c-basic-offset . 2)
               (c-block-comment-prefix . "* ")
               (c-offsets-alist
                (c . +)))
             )

Any ideas? Thanks in advance!

Cheers, Daniel

A: 

You can try just changing the c-block-comment-prefix to " * ",

or make sure c-comment-prefix-regexp is '//+\\ | \\**'.

Here is the relevant GNU.org CC Mode man page.

Dortz
Hi, thanks for your comment, but unfortunately this does not work as stated at the end of the description of c-comment-prefix-regexp:> Note that it won't work to adjust the indentation by putting leading spaces in c-block-comment-prefix
danielpoe
+2  A: 

Hm, it works here with 22.3.1 and starting with the '-Q' option which doesn't load any personal or site lisp files. Sorry to not be much help, but I think it's your setup. Try doing 'emacs -Q' and see if you still see the same problem.

scottfrazer
Hm, I can confirm this, with 'emacs -Q' it works for me. Now I just need to find out where I screw up :(Thanks for your help!
danielpoe
Ok I found the problem, 'verilog-mode' seems to mess something up! As this is even a standard module now, I would call this a bug!Cheers,Daniel
danielpoe