Previous: Subword Movement, Up: Commands

4.10 Other Commands

Here are the various other commands that didn't fit anywhere else:

C-c . (c-set-style)
Switch to the specified style in the current buffer. Use like this:
          C-c . style-name <RET>

You can use the <TAB> in the normal way to do completion on the style name. Note that all style names are case insensitive, even the ones you define yourself.

Setting a style in this way does not automatically reindent your file. For commands that you can use to view the effect of your changes, see Indentation Commands and Filling and Breaking.

For details of the CC Mode style system, see Styles.

C-c : (c-scope-operator)
In C++, it is also sometimes desirable to insert the double-colon scope operator without performing the electric behavior of colon insertion. C-c : does just this.
C-c C-\ (c-backslash-region)
This function inserts and aligns or deletes end-of-line backslashes in the current region. These are typically used in multi-line macros.

With no prefix argument, it inserts any missing backslashes and aligns them according to the c-backslash-column and c-backslash-max-column variables. With a prefix argument, it deletes any backslashes.

The function does not modify blank lines at the start of the region. If the region ends at the start of a line, it always deletes the backslash (if any) at the end of the previous line.

To customize the precise workings of this command, Custom Macros.

The recommended line breaking function, c-context-line-break (see Filling and Breaking), is especially nice if you edit multiline macros frequently. When used inside a macro, it automatically inserts and adjusts the mandatory backslash at the end of the line to keep the macro together, and it leaves the point at the right indentation column for the code. Thus you can write code inside macros almost exactly as you can elsewhere, without having to bother with the trailing backslashes.

C-c C-e (c-macro-expand)
This command expands C, C++, Objective C or Pike macros in the region, using an appropriate external preprocessor program. Normally it displays its output in a temporary buffer, but if you give it a prefix arg (with C-u C-c C-e) it will overwrite the original region with the expansion.

The command does not work in any of the other modes, and the key sequence is not bound in these other modes.

c-macro-expand isn't actually part of CC Mode, even though it is bound to a CC Mode key sequence. If you need help setting it up or have other problems with it, you can either read its source code or ask for help in the standard (X)Emacs forums.