Previous: Custom Line-Up, Up: Customizing Indentation [Index]
To configure macros which you invoke without a terminating ‘;’, see See Macros with ;.
Here are the remaining odds and ends regarding indentation:
In ‘gnu’ style (see Built-in Styles), a minimum indentation is imposed on lines inside code blocks. This minimum indentation is controlled by this style variable. The default value is 1.
It’s the function c-gnu-impose-minimum
that enforces this minimum
indentation. It must be present on c-special-indent-hook
to
work.
This style variable is a standard hook variable that is called after
every line is indented by CC Mode. It is called only if
c-syntactic-indentation
is non-nil
(which it is by
default (see Indentation Engine Basics)). You can put a function
on this hook to do any special indentation or ad hoc line adjustments
your style dictates, such as adding extra indentation to constructors
or destructor declarations in a class definition, etc. Sometimes it
is better to write a custom Line-up Function instead (see Custom Line-Up).
The indentation engine calls each function on this hook with no
parameters, with point somewhere on the pertinent line, and with the
variable c-syntactic-context
bound to the current syntactic
context (i.e. what you would get by typing C-c C-s on the source
line. See Custom Braces.). Note that you should not change
c-syntactic-context
or point or mark inside a
c-special-indent-hook
function; thus you’ll probably want to
wrap your function in a save-excursion
50.
Setting c-special-indent-hook
in style definitions is handled
slightly differently from other variables—A style can only add
functions to this hook, not remove them. See Style Variables.
The numerical
value returned by point
will change if you change the
indentation of the line within a save-excursion
form, but point
itself will still be over the same piece of text.
Previous: Custom Line-Up, Up: Customizing Indentation [Index]