Copyright (C) 2000-2012 |
GNU Info (ccmode)Other Special IndentationsOther Special Indentations -------------------------- In `gnu' style (Note: Built-in Styles), a minimum indentation is imposed on lines inside top-level constructs. This minimum indentation is controlled by the style variable `c-label-minimum-indentation'. The default value for this variable is 1. One other customization variable is available in CC Mode: The style variable `c-special-indent-hook'. This is a standard hook variable that is called after every line is indented by CC Mode. You can use it to do any special indentation or line adjustments your style dictates, such as adding extra indentation to constructors or destructor declarations in a class definition, etc. Note however, that you should not change point or mark inside your `c-special-indent-hook' functions (i.e. you'll probably want to wrap your function in a `save-excursion'). Setting `c-special-indent-hook' in your style definition is handled slightly differently than other variables. In your style definition, you should set the value for `c-special-indent-hook' to a function or list of functions, which will be appended to `c-special-indent-hook' using `add-hook'. That way, the current setting for the buffer local value of `c-special-indent-hook' won't be overridden. Normally, the standard Emacs command `M-;' (`indent-for-comment') will indent comment only lines to `comment-column'. Some users however, prefer that `M-;' act just like `TAB' for purposes of indenting comment-only lines; i.e. they want the comments to always indent as they would for normal code, regardless of whether `TAB' or `M-;' were used. This behavior is controlled by the variable `c-indent-comments-syntactically-p'. When `nil' (the default), `M-;' indents comment-only lines to `comment-column', otherwise, they are indented just as they would be if `TAB' were typed. Note that this has no effect for comment lines that are inserted with `M-;' at the end of regular code lines. These comments will always start at `comment-column'. |