Go to the first, previous, next, last section, table of contents.


C Indentation Styles

A C style is a collection of indentation style customizations. Emacs comes with several predefined indentation styles for C code including gnu, k&r, bsd, stroustrup, linux, python, java, whitesmith, ellemtel, and cc-mode. The default style is gnu.

To choose the style you want, use the command M-x c-set-style. Specify a style name as an argument (case is not significant in C style names). The chosen style only affects newly visited buffers, not those you are already editing.

To define a new C indentation style, call the function c-add-style:

(c-add-style name values use-now)

Here name is the name of the new style (a string), and values is an alist whose elements have the form (variable . value). The variables you specify should be among those documented in section Variables for C Indentation.

If use-now is non-nil, c-add-style switches to the new style after defining it.


Go to the first, previous, next, last section, table of contents.