The principal variable for customizing indentation is the style
variable 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 Configuration 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
c-basic-offset
:
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
bsd
, linux
, and python
styles).
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 Functions).
Finally, in Other Special Indentations 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.
• c-offsets-alist: | ||
• Interactive Customization: | ||
• Line-Up Functions: | ||
• Custom Line-Up: | ||
• Other Indentation: |