[CMake] fill-paragraph command in emacs for comments using cmake-mode.el

James Bigler bigler at cs.utah.edu
Wed Aug 1 12:40:36 EDT 2007


One of the features I like to use in emacs is the fill-paragraph command 
(usually run with M-q).  For different modes this can do different things.  For 
source files, when you run the command on a comment region, this has the effect 
of reorganizing a multi-line comment to make it look pretty.  This is especially 
important if you add or remove large chunks of the text after formatting it.

# This is a really long comment.  It just keeps going and going and
# going and going.  Will it ever end? Possibly, but don't hold your
# breath.  I think I can type 10 millions words per minute, so it will
# take you longer to read it than for me to type it, making it
# impossible for you to catch up.

Instead I get this:

# This is a really long comment.  It just keeps going and going and
going and going.  Will it ever end? Possibly, but don't hold your
breath.  I think I can type 10 millions words per minute, so it will
take you longer to read it than for me to type it, making it
impossible for you to catch up.

You can get it look more like the one on top, by adding a # on the second line 
and running fill-paragraph again, but if your comment doesn't start at the 
begging of the line, this work around doesn't work.

Also, if I have code right after the comment it gets pulled in.

# Comment          # Comment IF(MYVAR)
IF(MYVAR)      =>

I updated to the most current version of cmake-mode.el found here, but that 
didn't help.
http://www.cmake.org/cgi-bin/viewcvs.cgi/Docs/cmake-mode.el?rev=1.31&root=CMake&view=auto

I'm wondering if anyone else has experience this and perhaps found something 
that can make it work.  My emacs-lisp knowledge is somewhat meager, so I'm not 
sure where to look to fix this.

Thanks,
James


More information about the CMake mailing list