CC MODE Version 5 Documentation. Node: Adding Styles

PREV Built-in Styles UP Styles NEXT File Styles

6.3.2: Adding Styles

If none of the built-in styles is appropriate, you'll probably want to add a new style definition. Styles are kept in the c-style-alist variable, but you should never modify this variable directly. Instead, CC Mode provides the function c-add-style that you can use to easily add new styles or change existing styles. This function takes two arguments, a stylename string, and an association list description of style customizations. If stylename is not already in c-style-alist, the new style is added, otherwise the style is changed to the new description. This function also takes an optional third argument, which if non-nil, automatically applies the new style to the current buffer.

The sample `.emacs' file provides a concrete example of how a new style can be added and automatically set. See Sample .emacs File.

PREV Built-in Styles UP Styles NEXT File Styles