12.1 Customizing Macro Backslashes

CC Mode provides some tools to help keep the line continuation backslashes in macros neat and tidy. Their precise action is customized with these variables:

User Option: c-backslash-column
User Option: c-backslash-max-column

These variables control the alignment columns for line continuation backslashes in multiline macros. They are used by the functions that automatically insert or align such backslashes, e.g., c-backslash-region and c-context-line-break.

c-backslash-column specifies the minimum column for the backslashes. If any line in the macro goes past this column, then the next tab stop (i.e., next multiple of tab-width) in that line is used as the alignment column for all the backslashes, so that they remain in a single column. However, if any lines go past c-backslash-max-column then the backslashes in the rest of the macro will be kept at that column, so that the lines which are too long “stick out” instead.

Don’t ever set these variables to nil. If you want to disable the automatic alignment of backslashes, use c-auto-align-backslashes.

User Option: c-auto-align-backslashes

Align automatically inserted line continuation backslashes if non-nil. When line continuation backslashes are inserted automatically for line breaks in multiline macros, e.g., by c-context-line-break, they are aligned with the other backslashes in the same macro if this flag is set.

If c-auto-align-backslashes is nil, automatically inserted backslashes are preceded by a single space, and backslashes get aligned only when you explicitly invoke the command c-backslash-region (C-c C-\).