GNU Emacs Manual - Variables for C Indent

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

#### Variables for C Indentation

This section describes additional variables which control the indentation behavior of C mode and related mode.

`c-offsets-alist`
  Association list of syntactic symbols and their indentation offsets. You should not set this directly, only with `c-set-offset`. See section Changing Indentation Style, for details.
`c-style-alist`
  Variable for defining indentation styles; see below.
`c-basic-offset`
  Amount of basic offset used by `+` and `-` symbols in `c-offsets-alist`.
`c-special-indent-hook`
  Hook for user-defined special indentation adjustments. This hook is called after a line is indented by C mode and related modes.

The variable `c-style-alist` specifies the predefined indentation styles. Each element has form `(name variable-setting...)`, where name is the name of the style. Each variable-setting has the form `(variable . value)`; variable is one of the customization variables used by C mode, and value is the value for that variable when using the selected style.

When variable is `c-offsets-alist`, that is a special case: value is appended to the front of the value of `c-offsets-alist` instead of replacing that value outright. Therefore, it is not necessary for value to specify each and every syntactic symbol--only those for which the style differs from the default.

The indentation of lines containing only comments is also affected by the variable `c-comment-only-line-offset` (see section Comments in C Modes).

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