Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Indent C block comments in Emacs

Tags:

c

comments

emacs

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

like image 419
danielpoe Avatar asked Feb 10 '09 16:02

danielpoe


1 Answers

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.

like image 79
scottfrazer Avatar answered Sep 20 '22 14:09

scottfrazer