Commit d7bd46ed authored by Gerd Moellmann's avatar Gerd Moellmann
Browse files

Installed cc-mode version 5.26.

parent 03d218b4
......@@ -4,15 +4,12 @@
@comment %**start of header (This is for running Texinfo on a region)
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@setfilename ../info/ccmode
@settitle CC MODE Version 5 Documentation
@footnotestyle end
@comment No overfull hbox marks in the dvi file.
@finalout
@dircategory Editors
@direntry
* CC mode: (ccmode). The GNU Emacs mode for editing C, C++, Objective-C
and Java code.
@end direntry
@setfilename ../info/cc-mode.info
@settitle CC Mode Version 5 Documentation
@footnotestyle end
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@comment @setchapternewpage odd !! we don't want blank pages !!
......@@ -26,7 +23,8 @@
@comment Generated from the original README file by Krishna Padmasola
@comment <krishna@earth-gw.njit.edu>
@comment
@comment Maintained by Barry A. Warsaw <cc-mode-help@python.org>
@comment Maintained by Barry A. Warsaw and Martin Stjernholm
@comment <bug-cc-mode@gnu.org> (or <cc-mode-help@python.org>)
@comment
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
......@@ -37,7 +35,7 @@
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ifinfo
Copyright @copyright{} 1995,96,97,98 Free Software Foundation, Inc.
Copyright @copyright{} 1995-1999 Free Software Foundation, Inc.
@end ifinfo
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
......@@ -52,11 +50,12 @@ Copyright @copyright{} 1995,96,97,98 Free Software Foundation, Inc.
@comment The title is printed in a large font.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@center @titlefont{CC Mode 5.21}
@center @titlefont{CC Mode 5.26}
@sp 2
@center @subtitlefont{A GNU Emacs mode for editing C and C-like languages}
@sp 2
@center Barry A. Warsaw
@center Martin Stjernholm
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
......@@ -66,7 +65,7 @@ Copyright @copyright{} 1995,96,97,98 Free Software Foundation, Inc.
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1995,96,97,98 Free Software Foundation, Inc.
Copyright @copyright{} 1995-1999 Free Software Foundation, Inc.
@end titlepage
......@@ -75,65 +74,132 @@ Copyright @copyright{} 1995,96,97,98 Free Software Foundation, Inc.
@comment This appears only in the Info file, not the printed manual.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Top, Introduction, (dir), (dir)
@comment node-name, next, previous, up
@node Top, Introduction, (dir), (dir)
@comment node-name, next, previous, up
@macro ccmode
CC Mode
@end macro
@ifinfo
@top @ccmode{}
@ccmode{} is a GNU Emacs mode for editing files containing C, C++,
Objective-C, Java, CORBA IDL, and Pike code. It provides syntax-based
indentation and has several handy commands and some minor modes to make
the editing easier. Note that @ccmode{} does @emph{not} provide
font-locking; there are other Emacs packages for that.
@end ifinfo
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@menu
* Introduction::
* Getting Connected::
* Introduction::
* Getting Connected::
* New Indentation Engine::
* Minor Modes::
* Text Filling and Line Breaking::
* Commands::
* Customizing Indentation::
* Syntactic Symbols::
* Indentation Functions::
* Performance Issues::
* Frequently Asked Questions::
* Getting the latest CC Mode release::
* Getting the Latest CC Mode Release::
* Sample .emacs File::
* Limitations and Known Bugs::
* Mailing Lists and Submitting Bug Reports::
* Concept Index::
* Command Index:: Command Index
* Key Index:: Key Index
* Variable Index:: Variable Index
* Limitations and Known Bugs::
* Mailing Lists and Submitting Bug Reports::
--- Indices ---
* Concept Index::
* Command Index::
* Key Index::
* Variable Index::
--- The Detailed Node Listing ---
New Indentation Engine
* Syntactic Analysis::
* Indentation Calculation::
Minor Modes
* Auto-newline Insertion::
* Hungry-deletion of Whitespace::
Auto-newline Insertion
* Hanging Braces::
* Hanging Colons::
* Hanging Semi-colons and Commas::
* Other Electric Commands::
* Clean-ups::
Commands
* Indentation Commands::
* Movement Commands::
* Other Commands::
Customizing Indentation
* Interactive Customization::
* Permanent Customization::
* Hooks::
* Styles::
* Advanced Customizations::
Styles
* Built-in Styles::
* Adding Styles::
* File Styles::
Advanced Customizations
* Custom Indentation Functions::
* Custom Brace and Colon Hanging::
* Customizing Semi-colons and Commas::
* Other Special Indentations::
@end menu
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Introduction, Getting Connected, Top, Top
@comment node-name, next, previous, up
@chapter Introduction
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Introduction, Getting Connected, Top, Top
@comment node-name, next, previous, up
@chapter Introduction
@cindex Introduction
@macro ccmode
CC Mode
@end macro
@cindex BOCM
Welcome to @ccmode{}. This is a GNU Emacs mode for editing files
containing C, C++, Objective-C, Java, and CORBA IDL code. This
incarnation of the mode is descendant from @file{c-mode.el} (also called
"Boring Old C Mode" or BOCM @code{:-)}, and @file{c++-mode.el} version
2, which I have been maintaining since 1992. @ccmode{} represents a
significant milestone in the mode's life. It has been fully merged back
with Emacs 19's @file{c-mode.el}. Also a new, more intuitive and
flexible mechanism for controlling indentation has been developed.
Welcome to @ccmode{}, a GNU Emacs mode for editing files containing C,
C++, Objective-C, Java, CORBA IDL, and Pike code. This incarnation of
the mode is descendant from @file{c-mode.el} (also called "Boring Old C
Mode" or BOCM @t{:-)}, and @file{c++-mode.el} version 2, which Barry has
been maintaining since 1992. @ccmode{} represents a significant
milestone in the mode's life. It has been fully merged back with Emacs
19's @file{c-mode.el}. Also a new, more intuitive and flexible mechanism
for controlling indentation has been developed. Late in 1997, Martin
joined the @ccmode{} Maintainers Team, and implemented the Pike support.
This manual describes @ccmode{}
@comment The following line must appear on its own, so that the automated
version 5.26.
@comment Release.py script can update the version number automatically
@ccmode{} supports the editing of K&R and ANSI C, @dfn{ARM}
@footnote{``The Annotated C++ Reference Manual'', by Ellis and
Stroustrup.} C++, Objective-C, Java and CORBA's Interface
Definition Language files. In this way, you can
easily set up consistent coding styles for use in editing all C, C++,
Objective-C, Java and IDL programs. @ccmode{} does @emph{not} handle
font-locking (a.k.a. syntax coloring, keyword highlighting) or anything
of that nature, for any of these modes. Font-locking is handled by other
Emacs packages.
@footnote{@cite{The Annotated C++ Reference Manual}, by Ellis and
Stroustrup.} C++, Objective-C, Java, CORBA's Interface Definition
Language, and Pike@footnote{A C-like scripting language with its roots
in the LPC language used in some MUD engines. See
@uref{http://pike.idonex.se/}.} files. In this way, you can easily set
up consistent coding styles for use in editing all of these languages.
@ccmode{} does @emph{not} handle font-locking (a.k.a. syntax coloring,
keyword highlighting) or anything of that nature, for any of these
modes. Font-locking is handled by other Emacs packages.
This manual will describe the following:
......@@ -154,12 +220,14 @@ How to customize the new indentation engine.
@findex objc-mode
@findex java-mode
@findex idl-mode
@findex pike-mode
Note that the name of this package is ``@ccmode{}'', but there is no top
level @code{cc-mode} entry point. All of the variables, commands, and
functions in @ccmode{} are prefixed with @code{c-@var{<thing>}}, and
@code{c-mode}, @code{c++-mode}, @code{objc-mode}, @code{java-mode}, and
@code{idl-mode} entry points are provided. This file is intended to be
a replacement for @file{c-mode.el} and @file{c++-mode.el}.
@code{c-mode}, @code{c++-mode}, @code{objc-mode}, @code{java-mode},
@code{idl-mode}, and @code{pike-mode} entry points are provided. This
package is intended to be a replacement for @file{c-mode.el} and
@file{c++-mode.el}.
@cindex @file{cc-compat.el} file
This distribution also contains a file
......@@ -178,12 +246,9 @@ early beta stages of @ccmode{}'s development.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Getting Connected, New Indentation Engine, Introduction, Top
@comment node-name, next, previous, up
@chapter Getting Connected
@cindex Getting Connected
@node Getting Connected, New Indentation Engine, Introduction, Top
@comment node-name, next, previous, up
@chapter Getting Connected
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
If you got this version of @ccmode{} with Emacs or XEmacs, it should
......@@ -194,12 +259,12 @@ If you are upgrading an existing @ccmode{} installation, please see the
@file{README} file for installation details. @ccmode{} may not work
with older versions of Emacs or XEmacs. See the @ccmode{} release notes
Web pages for the latest information on Emacs version and package
compatibility (see @ref{Getting the latest CC Mode release}).
compatibility (@pxref{Getting the Latest CC Mode Release}).
@cindex @file{cc-mode-18.el} file
@emph{Note that @ccmode{} no longer works with Emacs 18!} The
@file{cc-mode-18.el} file is no longer distributed with @ccmode{}. If
you haven't upgraded from Emacs 18 by now, you are out of luck.
@emph{Note that @ccmode{} no longer
works with Emacs 18!}, so if you haven't upgraded from Emacs 18 by now,
you are out of luck.
@findex c-version
@findex version (c-)
......@@ -217,11 +282,10 @@ where @samp{XX} is the minor release number.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node New Indentation Engine, Minor Modes, Getting Connected, Top
@comment node-name, next, previous, up
@chapter New Indentation Engine
@cindex New Indentation Engine
@node New Indentation Engine, Minor Modes, Getting Connected, Top
@comment node-name, next, previous, up
@chapter New Indentation Engine
@cindex indentation engine
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ccmode{} has a new indentation engine, providing a simplified, yet
......@@ -243,41 +307,36 @@ your personal coding style.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Syntactic Analysis, Indentation Calculation, , New Indentation Engine
@comment node-name, next, previous,up
@section Syntactic Analysis
@cindex Syntactic Analysis
@node Syntactic Analysis, Indentation Calculation, , New Indentation Engine
@comment node-name, next, previous, up
@section Syntactic Analysis
@cindex syntactic analysis
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@vindex c-offsets-alist
@vindex offsets-alist (c-)
@cindex relative buffer position
@cindex syntactic symbol
@cindex syntactic component
@cindex syntactic component list
@cindex relative buffer position
The first thing @ccmode{} does when indenting a line of code, is to
analyze the line, determining the @dfn{syntactic component list} of the
construct on that line. A syntactic component consists of a pair
of information (in lisp parlance, a @emph{cons cell}), where the first
part is a @dfn{syntactic symbol}, and the second part is a @dfn{relative
construct on that line. A syntactic component consists of a pair of
information (in lisp parlance, a @emph{cons cell}), where the first part
is a @dfn{syntactic symbol}, and the second part is a @dfn{relative
buffer position}. Syntactic symbols describe elements of C code
@footnote{or C++, Objective-C, Java or IDL code. In general, for the rest
of this manual I'll use the term ``C code'' to refer to all the C-like
dialects, unless otherwise noted.}, e.g. @code{statement},
@code{substatement}, @code{class-open}, @code{class-close}, etc.
@xref{Syntactic Symbols}, for a complete list of currently recognized
syntactic symbols and their semantics. The variable
@code{c-offsets-alist} also contains the list of currently supported
syntactic symbols.
@footnote{Unless otherwise noted, the term ``C code'' to refers to all
the C-like languages.}, e.g. @code{statement}, @code{substatement},
@code{class-open}, @code{class-close}, etc. @xref{Syntactic Symbols},
for a complete list of currently recognized syntactic symbols and their
semantics. The style variable @code{c-offsets-alist} also contains the
list of currently supported syntactic symbols.
Conceptually, a line of C code is always indented relative to the
indentation of some line higher up in the buffer. This is represented
by the relative buffer position in the syntactic component.
Here is an example. Suppose we had the following code as the only thing
in a @code{c++-mode} buffer @footnote{The line numbers in this and
future examples don't actually appear in the buffer, of course!}:
in a C++ buffer @footnote{The line numbers in this and future examples
don't actually appear in the buffer, of course!}:
@example
@group
......@@ -346,7 +405,7 @@ Hitting @kbd{C-c C-s} on line 4 gives us:
@end example
@cindex substatement
@cindex substatment block
@cindex substatement block
@noindent
which tells us that this is a brace that @emph{opens} a substatement
block. @footnote{A @dfn{substatement} is the line after a
......@@ -389,22 +448,20 @@ components. Also notice that the first component,
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Indentation Calculation, , Syntactic Analysis, New Indentation Engine
@comment node-name, next, previous,up
@section Indentation Calculation
@cindex Indentation Calculation
@node Indentation Calculation, , Syntactic Analysis, New Indentation Engine
@comment node-name, next, previous, up
@section Indentation Calculation
@cindex indentation calculation
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@vindex c-offsets-alist
@vindex offsets-alist (c-)
Indentation for a line is calculated using the syntactic
component list derived in step 1 above (see @ref{Syntactic Analysis}).
component list derived in step 1 above (@pxref{Syntactic Analysis}).
Each component contributes to the final total indentation of the line in
two ways.
First, the syntactic symbols are looked up in the @code{c-offsets-alist}
variable, which is an association list of syntactic symbols and the
offsets to apply for those symbols. These offsets are added to a
style variable, which is an association list of syntactic symbols and
the offsets to apply for those symbols. These offsets are added to a
running total.
Second, if the component has a relative buffer position, @ccmode{}
......@@ -427,7 +484,6 @@ our first example again:
@end group
@end example
@kindex TAB
Let's say point is on line 3 and we hit the @kbd{TAB} key to re-indent
the line. Remember that the syntactic component list for that
line is:
......@@ -439,9 +495,9 @@ line is:
@noindent
@ccmode{} looks up @code{defun-block-intro} in the
@code{c-offsets-alist} variable. Let's say it finds the value @samp{4};
it adds this to the running total (initialized to zero), yielding a
running total indentation of 4 spaces.
@code{c-offsets-alist} style variable. Let's say it finds the value
@samp{4}; it adds this to the running total (initialized to zero),
yielding a running total indentation of 4 spaces.
Next @ccmode{} goes to buffer position 29 and asks for the current
column. This brace is in column zero, so @ccmode{}
......@@ -491,7 +547,6 @@ being used.
@vindex c-echo-syntactic-information-p
@vindex echo-syntactic-information-p (c-)
@cindex TAB
As you configure @ccmode{}, you might want to set the variable
@code{c-echo-syntactic-information-p} to non-@code{nil} so that the
syntactic component list and calculated offset will always be echoed in
......@@ -499,11 +554,9 @@ the minibuffer when you hit @kbd{TAB}.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Minor Modes, Commands, New Indentation Engine, Top
@comment node-name, next, previous,up
@chapter Minor Modes
@cindex Minor Modes
@node Minor Modes, Text Filling and Line Breaking, New Indentation Engine, Top
@comment node-name, next, previous, up
@chapter Minor Modes
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ccmode{} contains two minor-mode-like features that you should
......@@ -516,11 +569,11 @@ are turned off.
The state of the minor modes is always reflected in the minor mode list
on the modeline of the @ccmode{} buffer. When auto-newline mode is
enabled, you will see @samp{C/a} on the mode line @footnote{Remember
that the @samp{C} could be replaced with @samp{C++}, @samp{ObjC},
@samp{Java} or @samp{IDL}.}. When hungry delete mode is enabled you
would see @samp{C/h} and when both modes are enabled, you'd see
@samp{C/ah}.
enabled, you will see @samp{C/a} on the mode line @footnote{The @samp{C}
would be replaced with @samp{C++}, @samp{ObjC}, @samp{Java}, @samp{IDL},
or @samp{Pike} for the respective languages.}. When hungry delete mode
is enabled you would see @samp{C/h} and when both modes are enabled,
you'd see @samp{C/ah}.
@kindex C-c C-a
@kindex C-c C-d
......@@ -560,17 +613,16 @@ to your @file{.emacs} file:
@cindex electric characters
@menu
* Auto-newline insertion::
* Hungry-deletion of whitespace::
* Auto-fill mode interaction::
* Auto-newline Insertion::
* Hungry-deletion of Whitespace::
@end menu
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Auto-newline insertion, Hungry-deletion of whitespace, , Minor Modes
@comment node-name, next, previous,up
@section Auto-newline insertion
@cindex Auto-newline insertion
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Auto-newline Insertion, Hungry-deletion of Whitespace, , Minor Modes
@comment node-name, next, previous, up
@section Auto-newline Insertion
@cindex auto-newline insertion
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@cindex electric commands
......@@ -604,25 +656,23 @@ normal, with no @kbd{C-u} prefix).
@menu
* Hanging Braces::
* Hanging Colons::
* Hanging Semi-colons and commas::
* Other electric commands::
* Hanging Semi-colons and Commas::
* Other Electric Commands::
* Clean-ups::
@end menu
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Hanging Braces, Hanging Colons, , Auto-newline insertion
@comment node-name, next, previous,up
@subsection Hanging Braces
@cindex Hanging Braces
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Hanging Braces, Hanging Colons, , Auto-newline Insertion
@comment node-name, next, previous, up
@subsection Hanging Braces
@cindex hanging braces
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@findex c-electric-brace
@findex electric-brace (c-)
@vindex c-hanging-braces-alist
@vindex hanging-braces-alist (c-)
@vindex c-offsets-alist
@vindex offsets-alist (c-)
When you type either an open or close brace (i.e. @kbd{@{} or @kbd{@}}),
the electric command @code{c-electric-brace} gets run. This command has
two electric formatting behaviors. First, it will perform some
......@@ -641,32 +691,47 @@ on, then that line is also re-indented.
@cindex brace-list-open syntactic symbol
@cindex brace-list-close syntactic symbol
@cindex brace-list-intro syntactic symbol
@cindex brace-list-entry syntactic symbol
@cindex brace-entry-open syntactic symbol
@cindex block-open syntactic symbol
@cindex block-close syntactic symbol
@cindex substatement-open syntactic symbol
@cindex statement-case-open syntactic symbol
@cindex extern-lang-open syntactic symbol
@cindex extern-lang-close syntactic symbol
@cindex namespace-open symbol
@cindex namespace-close symbol
The insertion of newlines is controlled by the
@code{c-hanging-braces-alist} variable. This variable contains a
@cindex namespace-open syntactic symbol
@cindex namespace-close syntactic symbol
@cindex inexpr-class-open symbol
@cindex inexpr-class-close symbol
The default in auto-newline mode is to insert newlines both before and
after a brace, but that can be controlled by the
@code{c-hanging-braces-alist} style variable. This variable contains a
mapping between syntactic symbols related to braces, and a list of
places to insert a newline. The syntactic symbols that are useful for
this list are: @code{class-open}, @code{class-close}, @code{defun-open},
@code{defun-close}, @code{inline-open}, @code{inline-close},
@code{brace-list-open}, @code{brace-list-close},
@code{brace-list-intro}, @code{brace-list-entry}, @code{block-open},
@code{block-close}, @code{substatement-open},
@code{statement-case-open},
@code{extern-lang-open}, @code{extern-lang-close},
@code{namespace-open}, and @code{namespace-close}.
@xref{Syntactic Symbols}, for a more
detailed description of these syntactic symbols.
@cindex Custom Indentation Functions
@code{brace-list-intro}, @code{brace-entry-open}, @code{block-open},
@code{block-close}, @code{substatement-open},
@code{statement-case-open}, @code{extern-lang-open},
@code{extern-lang-close}, @code{namespace-open}, @code{namespace-close},
@code{inexpr-class-open}, and @code{inexpr-class-close}@footnote{Note
that the aggregate constructs in Pike mode, @samp{(@{}, @samp{@})},
@samp{([}, @samp{])}, and @samp{(<}, @samp{>)}, do not count as brace
lists in this regard, even though they do for normal indentation
purposes. It's currently not possible to set automatic newlines on
these constructs.}. @xref{Syntactic Symbols}, for a more detailed
description of these syntactic symbols, except for
@code{inexpr-class-open} and @code{inexpr-class-close}, which aren't
actual syntactic symbols.
The braces of anonymous inner classes in Java are given the special
symbols @code{inexpr-class-open} and @code{inexpr-class-close}, so that
they can be distinguished from the braces of normal classes@footnote{The
braces of anonymous classes produces a combination of
@code{inexpr-class}, and @code{class-open} or @code{class-close} in
normal indentation analysis.}.
The value associated with each syntactic symbol in this association list
is called an @var{ACTION} which can be either a function or a list.
@xref{Custom Brace and Colon Hanging}, for a more detailed discussion of
......@@ -696,45 +761,55 @@ will appear on a line by themselves, as shown by the close braces in the
above example. The list can also be empty, in which case no newlines
are added either before or after the brace.
If a syntactic symbol is missing entirely from
@code{c-hanging-braces-alist}, it's treated in the same way as an
@var{ACTION} with a list containing @code{before} and @code{after}, so
that braces by default end up on their own line.
For example, the default value of @code{c-hanging-braces-alist} is:
@example
@group
(defvar c-hanging-braces-alist '((brace-list-open)
(substatement-open after)
(block-close . c-snug-do-while)
(extern-lang-open after)))
((brace-list-open)
(brace-entry-open)
(substatement-open after)
(block-close . c-snug-do-while)
(extern-lang-open after)
(inexpr-class-open after)
(inexpr-class-close before))
@end group
@end example
@noindent
which says that @code{brace-list-open} braces should both hang on the
right side, and allow subsequent text to follow on the same line as the
brace. Also, @code{substatement-open} and @code{extern-lang-open}
braces should hang on the right side, but subsequent text should follow
on the next line. Here, in the @code{block-close} entry, you also see
an example of using a function as an @var{ACTION}.
@noindent which says that @code{brace-list-open} and
@code{brace-entry-open} braces should both hang on the right side, and
allow subsequent text to follow on the same line as the brace. Also,
@code{substatement-open}, @code{extern-lang-open}, and
@code{inexpr-class-open} braces should hang on the right side, but
subsequent text should follow on the next line. The opposite holds for
@code{inexpr-class-close} braces; they won't hang, but the following
text continues on the same line. Here, in the @code{block-close} entry,
you also see an example of using a function as an @var{ACTION}. In all
other cases, braces are put on a line by themselves.
A word of caution: it is not a good idea to hang top-level construct
introducing braces, such as @code{class-open} or @code{defun-open}.
Emacs makes an assumption that such braces will always appear in column
zero, hanging such braces can introduce performance problems.
zero, hanging them can introduce performance problems.
@xref{Performance Issues}, for more information.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Hanging Colons, Hanging Semi-colons and commas, Hanging Braces, Auto-newline insertion
@comment node-name, next, previous,up
@subsection Hanging Colons
@cindex Hanging Colons
@node Hanging Colons, Hanging Semi-colons and Commas, Hanging Braces, Auto-newline Insertion
@comment node-name, next, previous, up
@subsection Hanging Colons
@cindex hanging colons
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@vindex hanging-colons-alist (c-)
@vindex c-hanging-colons-alist
Using a mechanism similar to brace hanging (see @ref{Hanging Braces}),
colons can also be made to hang using the variable
Using a mechanism similar to brace hanging (@pxref{Hanging Braces}),
colons can also be made to hang using the style variable
@code{c-hanging-colons-alist}. The syntactic symbols appropriate for
this assocation list are: @code{case-label}, @code{label},
@code{access-label}, @code{member-init-intro}, and @code{inher-intro}.
......@@ -742,7 +817,6 @@ Note however that for @code{c-hanging-colons-alist}, @var{ACTION}s as
functions are not supported. See also @ref{Custom Brace and Colon
Hanging} for details.
@cindex Clean-ups
In C++, double-colons are used as a scope operator but because these
colons always appear right next to each other, newlines before and after
them are controlled by a different mechanism, called @dfn{clean-ups} in
......@@ -750,11 +824,11 @@ them are controlled by a different mechanism, called @dfn{clean-ups} in
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Hanging Semi-colons and commas, Other electric commands, Hanging Colons, Auto-newline insertion
@comment node-name, next, previous,up
@subsection Hanging Semi-colons and commas
@cindex Hanging Semi-colons and commas
@node Hanging Semi-colons and Commas, Other Electric Commands, Hanging Colons, Auto-newline Insertion
@comment node-name, next, previous, up
@subsection Hanging Semi-colons and Commas
@cindex hanging semi-colons
@cindex hanging commas
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Semicolons and commas are also electric in @ccmode{}, but since
......@@ -765,11 +839,9 @@ Semi-colons and Commas}, for details.
@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@node Other electric commands, Clean-ups, Hanging Semi-colons and commas, Auto-newline insertion
@comment node-name, next, previous,up