Next: Styles, Previous: Hooks, Up: Configuration Basics [Contents][Index]
6.2 Style VariablesThe variables that CC Mode’s style system control are called style variables. Note that style variables are ordinary Lisp variables, which the style system initializes; you can change their values at any time (e.g., in a hook function). The style system can also set other variables, to some extent. See Styles.
Style variables are handled specially in several ways:
c-style-variables-are-local-p
to nil
before CC Mode is initialized.set-from-style
. When the style system initializes a buffer-local copy of a style variable for a CC Mode buffer, if its global binding is still that symbol then it will be set from the current style. Otherwise it will retain its global default17. This “otherwise” happens, for example, when you’ve set the variable with setq
at the top level of your .emacs (see Configuration Basics).c-offsets-alist
(see c-offsets-alist) is an association list with an element for each syntactic symbol. It’s handled a little differently from the other style variables. Its default global binding is the empty list nil
, rather than set-from-style
. Before the style system is initialized, you can add individual elements to c-offsets-alist
by calling c-set-offset
(see c-offsets-alist) just like you would set other style variables with setq
. Those elements will then prevail when the style system later initializes a buffer-local copy of c-offsets-alist
.c-special-indent-hook
is also handled in a special way. Styles can only add functions to this hook, not remove them, so any global settings you put on it are always preserved18. The value you give this variable in a style definition can be either a function or a list of functions.user
style when the style system is first initialized. See Built-in Styles, for details.The style variables are:c-indent-comment-alist
, c-indent-comments-syntactically-p
(see Indentation Commands);c-doc-comment-style
(see Documentation Comments);c-block-comment-prefix
, c-comment-prefix-regexp
(see Customizing Filling and Line Breaking);c-hanging-braces-alist
(see Hanging Braces);c-hanging-colons-alist
(see Hanging Colons);c-hanging-semi&comma-criteria
(see Hanging Semicolons and Commas);c-cleanup-list
(see Clean-ups);c-basic-offset
(see Customizing Indentation);c-offsets-alist
(see c-offsets-alist);c-comment-only-line-offset
(see Comment Line-Up Functions);c-special-indent-hook
, c-label-minimum-indentation
(see Other Special Indentations);c-backslash-column
, c-backslash-max-column
(see Customizing Macros).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4