Other Electric Commands
-----------------------
A few other keys also provide electric behavior. For example `#'
(`c-electric-pound') is electric when typed as the first non-whitespace
character on a line. In this case, the variable
`c-electric-pound-behavior' is consulted for the electric behavior.
This variable takes a list value, although the only element currently
defined is `alignleft', which tells this command to force the `#'
character into column zero. This is useful for entering C preprocessor
macro definitions.
Stars and slashes (i.e. `*' and `/', `c-electric-star' and
`c-electric-slash' respectively) are also electric under certain
circumstances. If a star is inserted as the second character of a C
style block comment on a comment-only line, then the comment delimiter
is indented as defined by `c-offsets-alist'. A comment-only line is
defined as a line which contains only a comment, as in:
void spam( int i )
{
// this is a comment-only line...
if( i == 7 ) // but this is not
{
dosomething(i);
}
}
Likewise, if a slash is inserted as the second slash in a C++ style
line comment (also only on a comment-only line), then the line is
indented as defined by `c-offsets-alist'.
Less-than and greater-than signs (`c-electric-lt-gt') are also
electric, but only in C++ mode. Hitting the second of two `<' or `>'
keys re-indents the line if it is a C++ style stream operator.
The normal parenthesis characters `(' and `)' also reindent the
current line if they are used in normal code. This is useful for
getting the closing parenthesis of an argument list aligned
automatically.