CC MODE Version 5 Documentation. Node: Auto-fill mode interaction

PREV Hungry-deletion of whitespace UP Minor Modes next

4.3: Auto-fill mode interaction

One other note about minor modes is worth mentioning here. CC Mode now works much better with auto-fill mode (a standard Emacs minor mode) by correctly auto-filling both line (e.g. C++ style) and block (e.g. C style) oriented comments. When auto-fill-mode is enabled, line oriented comments will also be auto-filled by inserting a newline at the line break, and inserting `//' at the start of the next line.

When auto-filling block oriented comments, the behavior is dependent on the value of the variable c-comment-continuation-stars. When this variable is nil, the old behavior for auto-filling C comments is in effect. In this case, the line is broken by closing the comment and starting a new comment on the next line.

If you set c-comment-continuation-stars to a string, then a long C block comment line is broken by inserting a newline at the line break position, and inserting this string at the beginning of the next comment line. The default value for c-comment-continuation-stars is `* ' (a star followed by a single space)[1].


[1] To get block comment continuation lines indented under the block comment starter (e.g. the `/*'), it is not enough to set c-comment-continuation-stars to the empty string. You need to do this, but you also need to set the offset for the c syntactic symbol to be zero.

PREV Hungry-deletion of whitespace UP Minor Modes next