CC MODE Version 5 Documentation. Node: Clean-ups

PREV Other electric commands UP Auto-newline insertion next

4.1.5: Clean-ups

Clean-ups are a mechanism complementary to colon and brace hanging. On the surface, it would seem that clean-ups overlap the functionality provided by the c-hanging-*-alist variables, and similarly, clean-ups are only enabled when auto-newline minor mode is enabled. Clean-ups are used however to adjust code ``after-the-fact'', i.e. to eliminate some whitespace that is inserted by electric commands, or whitespace that contains intervening constructs.

You can configure CC Mode's clean-ups by setting the variable c-cleanup-list, which is a list of clean-up symbols. By default, CC Mode cleans up only the scope-operator construct, which is necessary for proper C++ support. Note that clean-ups are only performed when the construct does not occur within a literal (see Auto-newline insertion), and when there is nothing but whitespace appearing between the individual components of the construct.

There are currently only five specific constructs that CC Mode can clean up, as indicated by these symbols:


[1] Certain C++ constructs introduce ambiguous situations, so scope-operator clean-ups may not always be correct. This usually only occurs when scoped identifiers appear in switch label tags.

PREV Other electric commands UP Auto-newline insertion next