Next: Customizing Indentation, Previous: Clean-ups, Up: CC Mode [Contents][Index]
10 Indentation Engine BasicsThis chapter will briefly cover how CC Mode indents lines of code. It is helpful to understand the indentation model being used so that you will know how to customize CC Mode for your personal coding style. All the details are in Customizing Indentation.
CC Mode has an indentation engine that provides a flexible and general mechanism for customizing indentation. When CC Mode indents a line of code, it separates its calculations into two steps:
+
, which means “indent this line one more level” is a typical offset. CC Mode then applies these offset(s) to the anchor position, giving the indentation for the line. The different sorts of offsets are described in c-offsets-alist.In exceptional circumstances, the syntax directed indentation described here may be a nuisance rather than a help. You can disable it by setting c-syntactic-indentation
to nil
. (To set the variable interactively, Minor Modes).
When this is non-nil
(which it is by default), the indentation of code is done according to its syntactic structure. When it’s nil
, every line is just indented to the same level as the previous one, and TAB (c-indent-command
) adjusts the indentation in steps of c-basic-offset
. The current style (see Configuration Basics) then has no effect on indentation, nor do any of the variables associated with indentation, not even c-special-indent-hook
.
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