The principal variable for customizing indentation is the style
c-offsets-alist, which gives an offset (an
indentation rule) for each syntactic symbol. Its structure and
semantics are completely described in c-offsets-alist. The
various ways you can set the variable, including the use of the
CC Mode style system, are described in Config Basics and its
sections, in particular Style Variables.
The simplest and most used kind of “offset” setting in
c-offsets-alist is in terms of multiples of
This style variable holds the basic offset between indentation levels.
It’s factory default is 4, but all the built-in styles set it
themselves, to some value between 2 (for
gnu style) and 8 (for
The most flexible “offset” setting you can make in
c-offsets-alist is a line-up function (or even a list of them),
either one supplied by CC Mode (see Line-Up Functions) or one
you write yourself (see Custom Line-Up).
Finally, in Other Indentation you’ll find the tool of last resort: a hook which is called after a line has been indented. You can install functions here to make ad-hoc adjustments to any line’s indentation.
|• Interactive Customization:|
|• Line-Up Functions:|
|• Custom Line-Up:|
|• Other Indentation:|