Variable: c-cleanup-list
c-cleanup-list is a customizable and buffer-local variable defined in
cc-vars.el.gz.
Documentation
List of various C/C++/ObjC constructs to "clean up".
The following clean ups only take place when the auto-newline feature
is turned on, as evidenced by the /la appearing next to the mode
name:
brace-else-brace -- Clean up "} else {" constructs by placing
entire construct on a single line. This clean
up only takes place when there is nothing but
white space between the braces and the else.
Clean up occurs when the open brace after the
else is typed.
brace-elseif-brace -- Similar to brace-else-brace, but clean up
"} else if (...) {" constructs. Clean up
occurs after the open parenthesis and the open
brace.
brace-catch-brace -- Similar to brace-elseif-brace, but clean up
"} catch (...) {" constructs.
empty-defun-braces -- Clean up empty defun braces by placing the
braces on the same line. Clean up occurs when
the defun closing brace is typed.
one-liner-defun -- If the code inside a function body can fit in
a single line, then remove any newlines
between that line and the defun braces so that
the whole body becomes a single line.
c-max-one-liner-length gives the maximum
length allowed for the resulting line. Clean
up occurs when the closing brace is typed.
defun-close-semi -- Clean up the terminating semi-colon on defuns
by placing the semi-colon on the same line as
the closing brace. Clean up occurs when the
semi-colon is typed.
list-close-comma -- Clean up commas following braces in array
and aggregate initializers. Clean up occurs
when the comma is typed.
scope-operator -- Clean up double colons which may designate
a C++ scope operator split across multiple
lines. Note that certain C++ constructs can
generate ambiguous situations. This clean up
only takes place when there is nothing but
whitespace between colons. Clean up occurs
when the second colon is typed.
The following clean ups always take place when they are on this list, regardless of the auto-newline feature, since they typically don't involve auto-newline inserted newlines:
space-before-funcall -- Insert exactly one space before the opening
parenthesis of a function call. Clean up
occurs when the opening parenthesis is typed.
compact-empty-funcall -- Clean up any space before the function call
opening parenthesis if and only if the
argument list is empty. This is typically
useful together with space-before-funcall to
get the style "foo (bar)" and "foo()".
Clean up occurs when the closing parenthesis
is typed.
comment-close-slash -- When a slash is typed after the comment prefix
on a bare line in a c-style comment, the comment
is closed by cleaning up preceding space and
inserting a star if needed.
This is a style variable. Apart from the valid values described
above, it can be set to the symbol set-from-style. In that case,
it takes its value from the style system (see c-default-style and
c-style-alist) when a CC Mode buffer is initialized. Otherwise,
the value set here overrides the style system (there is a variable
c-old-style-variable-behavior that changes this, though).
Probably introduced at or before Emacs version 19.23.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-vars.el.gz
(defcustom-c-stylevar c-cleanup-list '(scope-operator)
"List of various C/C++/ObjC constructs to \"clean up\".
The following clean ups only take place when the auto-newline feature
is turned on, as evidenced by the `/la' appearing next to the mode
name:
brace-else-brace -- Clean up \"} else {\" constructs by placing
entire construct on a single line. This clean
up only takes place when there is nothing but
white space between the braces and the `else'.
Clean up occurs when the open brace after the
`else' is typed.
brace-elseif-brace -- Similar to brace-else-brace, but clean up
\"} else if (...) {\" constructs. Clean up
occurs after the open parenthesis and the open
brace.
brace-catch-brace -- Similar to brace-elseif-brace, but clean up
\"} catch (...) {\" constructs.
empty-defun-braces -- Clean up empty defun braces by placing the
braces on the same line. Clean up occurs when
the defun closing brace is typed.
one-liner-defun -- If the code inside a function body can fit in
a single line, then remove any newlines
between that line and the defun braces so that
the whole body becomes a single line.
`c-max-one-liner-length' gives the maximum
length allowed for the resulting line. Clean
up occurs when the closing brace is typed.
defun-close-semi -- Clean up the terminating semi-colon on defuns
by placing the semi-colon on the same line as
the closing brace. Clean up occurs when the
semi-colon is typed.
list-close-comma -- Clean up commas following braces in array
and aggregate initializers. Clean up occurs
when the comma is typed.
scope-operator -- Clean up double colons which may designate
a C++ scope operator split across multiple
lines. Note that certain C++ constructs can
generate ambiguous situations. This clean up
only takes place when there is nothing but
whitespace between colons. Clean up occurs
when the second colon is typed.
The following clean ups always take place when they are on this list,
regardless of the auto-newline feature, since they typically don't
involve auto-newline inserted newlines:
space-before-funcall -- Insert exactly one space before the opening
parenthesis of a function call. Clean up
occurs when the opening parenthesis is typed.
compact-empty-funcall -- Clean up any space before the function call
opening parenthesis if and only if the
argument list is empty. This is typically
useful together with `space-before-funcall' to
get the style \"foo (bar)\" and \"foo()\".
Clean up occurs when the closing parenthesis
is typed.
comment-close-slash -- When a slash is typed after the comment prefix
on a bare line in a c-style comment, the comment
is closed by cleaning up preceding space and
inserting a star if needed."
:type '(set
(const :tag "Put \"} else {\" on one line (brace-else-brace)"
brace-else-brace)
(const :tag "Put \"} else if (...) {\" on one line (brace-elseif-brace)"
brace-elseif-brace)
(const :tag "Put \"} catch (...) {\" on one line (brace-catch-brace)"
brace-catch-brace)
(const :tag "Put empty defun braces on one line (empty-defun-braces)"
empty-defun-braces)
(const :tag "Put short function bodies on one line (one-liner-defun)"
one-liner-defun)
(const :tag "Put \"};\" ending defuns on one line (defun-close-semi)"
defun-close-semi)
(const :tag "Put \"},\" in aggregates on one line (list-close-comma)"
list-close-comma)
(const :tag "Put C++ style \"::\" on one line (scope-operator)"
scope-operator)
(const :tag "Put a space before funcall parens, e.g. \"foo (bar)\" (space-before-funcall)"
space-before-funcall)
(const :tag "Remove space before empty funcalls, e.g. \"foo()\" (compact-empty-funcall)"
compact-empty-funcall)
(const :tag "Make / on a bare line of a C-style comment close it (comment-close-slash)"
comment-close-slash))
:group 'c)