X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ee6c21a72adc7f886ccbc5ddef13b2b2bef818fc..3abebd3ba0fb75c9c116ad7275c95af0948870be:/man/cc-mode.texi diff --git a/man/cc-mode.texi b/man/cc-mode.texi index 088c19e44f..395433bc89 100644 --- a/man/cc-mode.texi +++ b/man/cc-mode.texi @@ -160,7 +160,7 @@ CC Mode This manual is for CC Mode in Emacs. Copyright @copyright{} 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. +2003, 2004, 2005, 2006 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -208,9 +208,9 @@ license to the document, as described in section 6 of the license. @vskip 0pt plus 1filll @insertcopying -This manual was generated from $Revision: 5.241 $ of $RCSfile: cc-mode.texi,v $, which can be +This manual was generated from $Revision$ of $RCSfile$, which can be downloaded from -@url{http://cvs.sf.net/viewcvs.py/cc-mode/cc-mode/cc-mode.texi}. +@url{http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/man/cc-mode.texi}. @end titlepage @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -447,7 +447,7 @@ depending on your needs. It describes the @ccmode{} style system and lists the standard styles that @ccmode{} supplies. @item -The next few chapters, describe in detail how to customize the various +The next few chapters describe in detail how to customize the various features of @ccmode{}. @item @@ -507,7 +507,7 @@ indents nested code. To set this value to 6, customize @item The (indentation) style The basic ``shape'' of indentation created by @ccmode{}---by default, this is @code{gnu} style (except for Java and AWK buffers). A list of -the availables styles and their descriptions can be found in +the available styles and their descriptions can be found in @ref{Built-in Styles}. A complete specification of the @ccmode{} style system, including how to create your own style, can be found in the chapter @ref{Styles}. To set your style to @code{linux}, either @@ -525,7 +525,7 @@ Normally, when you type ``punctuation'' characters such as @samp{;} or be disconcerting until you get used to it. To disable @dfn{electric indentation} in the current buffer, type @kbd{C-c C-l}. Type the same thing to enable it again. To have electric indentation disabled by -default, put the following into your @file{.emacs} mode@footnote{There +default, put the following into your @file{.emacs} file@footnote{There is no ``easy customization'' facility for making this change.}: @example @@ -672,7 +672,7 @@ This command indents the current line. That is all you need to know about it for normal use. @code{c-indent-command} does different things, depending on the -settting of @code{c-syntactic-indentation} (@pxref{Indentation Engine +setting of @code{c-syntactic-indentation} (@pxref{Indentation Engine Basics}): @itemize @bullet @@ -750,7 +750,7 @@ very useful in this case. @item @kbd{C-j} (@code{newline-and-indent}) @kindex C-j @findex newline-and-indent -Inserts a linefeed and indents the new blank line, ready to start +Inserts a newline and indents the new blank line, ready to start typing. This is a standard (X)Emacs command. @item @kbd{C-M-q} (@code{c-indent-exp}) @@ -836,8 +836,9 @@ already. Then reindent the comment according to @code{comment-column} (@pxref{Comments,,, xemacs, XEmacs User's Manual}) @end ifset and the variables below. Finally, position the point after the -comment starter. This is a standard Emacs command, but @ccmode{} -enhances it a bit with two variables: +comment starter. @kbd{C-u M-;} kills any comment on the current line, +together with any whitespace before it. This is a standard Emacs +command, but @ccmode{} enhances it a bit with two variables: @defopt c-indent-comment-alist @vindex indent-comment-alist (c-) @@ -887,12 +888,14 @@ lines. @findex end-of-defun (c-) @findex beginning-of-defun @findex end-of-defun -Move to the start or end of the current top-level definition, this -being the outermost brace pair which encloses point. These functions -are analogous to the Emacs built-in commands @code{beginning-of-defun} -and @code{end-of-defun}, except they eliminate the constraint that the -top-level opening brace of the defun must be in column zero. See -@ref{Defuns,,,@emacsman{}, @emacsmantitle{}}, for more information. +Move to the start or end of the current top-level definition. This is +the outermost brace pair which encloses point, together with the +function header or similar preamble which precedes the opening brace. +These functions are analogous to the Emacs built-in commands +@code{beginning-of-defun} and @code{end-of-defun}, except they +eliminate the constraint that the top-level opening brace of the defun +must be in column zero. See @ref{Defuns,,,@emacsman{}, +@emacsmantitle{}}, for more information. Depending on the coding style you're using, you might prefer these two commands to the standard Emacs ones. If so, consider binding them to @@ -1220,15 +1223,16 @@ turn it (or them) off. Most punctuation keys provide @dfn{electric} behavior - as well as inserting themselves they perform some other action, such as -reindenting the line. A few keywords, such as @code{else}, also -trigger electric action. +reindenting the line. This reindentation saves you from having to +reindent a line manually after typing, say, a @samp{@}}. A few +keywords, such as @code{else}, also trigger electric action. You can inhibit the electric behaviour described here by disabling -electric minor mode (@pxref{Minor Modes}.) +electric minor mode (@pxref{Minor Modes}). -Common to all of them is that they only behave electrically when used -in normal code (as contrasted with getting typed in a string literal -or comment). Those which cause re-indentation do so only when +Common to all these keys is that they only behave electrically when +used in normal code (as contrasted with getting typed in a string +literal or comment). Those which cause re-indentation do so only when @code{c-syntactic-indentation} has a non-@code{nil} value (which it does by default). @@ -1453,8 +1457,6 @@ clean-ups listed by key. @cindex hungry-deletion @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -@kindex C-d - If you want to delete an entire block of whitespace at point, you can use @dfn{hungry deletion}. This deletes all the contiguous whitespace either before point or after point in a single operation. @@ -1468,6 +1470,10 @@ Hungry deletion is a simple feature that some people find extremely useful. In fact, you might find yourself wanting it in @strong{all} your editing modes! +Loosely speaking, in what follows, @dfn{@key{DEL}} means ``the +backspace key'' and @dfn{@key{DELETE}} means ``the forward delete +key''. This is discussed in more detail below. + There are two different ways you can use hungry deletion: @table @asis @@ -1476,7 +1482,7 @@ Here you toggle Hungry Delete minor mode with @kbd{M-x c-toggle-hungry-state}@footnote{Prior to @ccmode{} 5.31, this command was bound to @kbd{C-c C-d}. @kbd{C-c C-d} is now the default binding for @code{c-hungry-delete-forward}.} (@pxref{Minor Modes}.) This -makes @kbd{@key{DEL}} and @kbd{C-d} do forward and backwards hungry +makes @kbd{@key{DEL}} and @kbd{C-d} do backwards and forward hungry deletion. @table @asis @@ -1524,61 +1530,62 @@ default value is @code{delete-char}. @item Using Distinct Bindings The other (newer and recommended) way to use hungry deletion is to -perform @code{c-hungry-backspace} and @code{c-hungry-delete-forward} -directly through their key sequences rather than using the minor mode -toggling. +perform @code{c-hungry-delete-backwards} and +@code{c-hungry-delete-forward} directly through their key sequences +rather than using the minor mode toggling. @table @asis -@item @kbd{C-c C-@key{Backspace}}, @kbd{C-c DEL}, or @kbd{C-c @key{Backspace}} (@code{c-hungry-backspace}) +@item @kbd{C-c C-@key{DEL}}, or @kbd{C-c @key{DEL}} (@code{c-hungry-delete-backwards})@footnote{This command was formerly known as @code{c-hungry-backspace}.} @kindex C-c C- -@kindex C-c DEL @kindex C-c -@findex c-hungry-backspace -@findex hungry-backspace (c-) +@kindex C-c C-DEL +@kindex C-c DEL +@findex c-hungry-delete-backwards +@findex hungry-delete-backwards (c-) Delete any amount of whitespace in the backwards direction (regardless whether hungry-delete mode is enabled or not). This command is bound -to both @kbd{C-c C-@key{Backspace}} and @kbd{C-c @key{Backspace}}, -since the more natural one, @kbd{C-c C-@key{Backspace}}, is sometimes -difficult to type at a character terminal. +to both @kbd{C-c C-@key{DEL}} and @kbd{C-c @key{DEL}}, since the more +natural one, @kbd{C-c C-@key{DEL}}, is sometimes difficult to type at +a character terminal. -@item @kbd{C-c C-@key{Delete}}, @kbd{C-c C-d}, or @kbd{C-c @key{Delete}} (@code{c-hungry-delete-forward}) -@kindex C-c C- +@item @kbd{C-c C-d}, @kbd{C-c C-@key{DELETE}}, or @kbd{C-c @key{DELETE}} (@code{c-hungry-delete-forward}) @kindex C-c C-d -@kindex C-c +@kindex C-c C- +@kindex C-c @findex c-hungry-delete-forward @findex hungry-delete-forward (c-) Delete any amount of whitespace in the forward direction (regardless whether hungry-delete mode is enabled or not). This command is bound -to both @kbd{C-c C-@key{Delete}} and @kbd{C-c @key{Delete}} for the -same reason as for @key{Backspace} above. +to both @kbd{C-c C-@key{DELETE}} and @kbd{C-c @key{DELETE}} for the +same reason as for @key{DEL} above. @end table @end table @kindex @kindex -When we talk about @kbd{DEL}, @kbd{C-d}, @key{Backspace} and -@key{Delete} above, we actually do so without connecting them to the -physical keys commonly known as @key{Backspace} and @key{Delete}. The -default bindings to those two keys depends on the flavor of (X)Emacs -you are using. +When we talk about @kbd{@key{DEL}}, and @kbd{@key{DELETE}} above, we +actually do so without connecting them to the physical keys commonly +known as @key{Backspace} and @key{Delete}. The default bindings to +those two keys depends on the flavor of (X)Emacs you are using. @findex c-electric-delete @findex electric-delete (c-) @findex c-hungry-delete @findex hungry-delete (c-) @vindex delete-key-deletes-forward - In XEmacs 20.3 and beyond, the @key{Backspace} key is bound to @code{c-electric-backspace} and the @key{Delete} key is bound to @code{c-electric-delete}. You control the direction it deletes in by setting the variable @code{delete-key-deletes-forward}, a standard -XEmacs variable. When this variable is non-@code{nil}, -@code{c-electric-delete} will do forward deletion with -@code{c-electric-delete-forward}, otherwise it does backward deletion -with @code{c-electric-backspace}. Similarly, @kbd{C-c @key{Delete}} -and @kbd{C-c C-@key{Delete}} are bound to @code{c-hungry-delete} which -is controlled in the same way by @code{delete-key-deletes-forward}. +XEmacs variable. +@c This variable is encapsulated by XEmacs's (defsubst delete-forward-p ...). +When this variable is non-@code{nil}, @code{c-electric-delete} will do +forward deletion with @code{c-electric-delete-forward}, otherwise it +does backward deletion with @code{c-electric-backspace}. Similarly, +@kbd{C-c @key{Delete}} and @kbd{C-c C-@key{Delete}} are bound to +@code{c-hungry-delete} which is controlled in the same way by +@code{delete-key-deletes-forward}. @findex normal-erase-is-backspace-mode @@ -1617,8 +1624,16 @@ these mixed case symbols @dfn{nomenclatures}. Also, each capitalized @dfn{subword}. Here are some examples: @multitable {@samp{NSGraphicsContext}} {@samp{NS}, @samp{Graphics}, and @samp{Context}} -@headitem Nomenclature +@c This could be converted to @headitem when we require Texinfo 4.7 +@iftex +@item @b{Nomenclature} + @tab @b{Subwords} +@end iftex +@ifnottex +@item Nomenclature @tab Subwords +@item --------------------------------------------------------- +@end ifnottex @item @samp{GtkWindow} @tab @samp{Gtk} and @samp{Window} @item @samp{EmacsFrameClass} @@ -1650,7 +1665,14 @@ nomenclature and treat them as separate words: @findex c-downcase-subword @findex downcase-subword (c-) @multitable @columnfractions .20 .40 .40 -@headitem Key @tab Word oriented command @tab Subword oriented command +@c This could be converted to @headitem when we require Texinfo 4.7 +@iftex +@item @b{Key} @tab @b{Word oriented command} @tab @b{Subword oriented command} +@end iftex +@ifnottex +@item Key @tab Word oriented command @tab Subword oriented command +@item ---------------------------------------------------------------------------- +@end ifnottex @item @kbd{M-f} @tab @code{forward-word} @tab @code{c-forward-subword} @item @kbd{M-b} @tab @code{backward-word} @tab @code{c-backward-subword} @item @kbd{M-@@} @tab @code{mark-word} @tab @code{c-mark-subword} @@ -2121,7 +2143,7 @@ escaped newline. The @samp{\} is highlighted. @chapter Configuration Basics @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -@cindex Emacs Initiliazation File +@cindex Emacs Initialization File @cindex Configuration You configure @ccmode{} by setting Lisp variables and calling (and perhaps writing) Lisp functions@footnote{DON'T PANIC!!! This isn't @@ -2907,7 +2929,7 @@ variable@footnote{In versions before 5.26, this variable was called @ccmode{} still uses the value on that variable if it's set.} is used then as the comment prefix. It defaults to @samp{* }@footnote{Actually, this default setting of -@code{c-block-comment-prefix} typically gets overriden by the default +@code{c-block-comment-prefix} typically gets overridden by the default style @code{gnu}, which sets it to blank. You can see the line splitting effect described here by setting a different style, e.g. @code{k&r} @xref{Choosing a Style}.}, which makes a comment @@ -3202,7 +3224,7 @@ Syntactic symbols aren't the only place where you can customize that @var{action}s are usually a list containing some combination of the symbols @code{before} and @code{after} (@pxref{Hanging Braces}). For more flexibility, you can instead specify brace ``hanginess'' by -giving a synctactic symbol an @dfn{action function} in +giving a syntactic symbol an @dfn{action function} in @code{c-hanging-braces-alist}; this function determines the ``hanginess'' of a brace, usually by looking at the code near it. @@ -3224,9 +3246,9 @@ give @code{c-syntactic-context} a value yourself---this would disrupt the proper functioning of @ccmode{}. This variable is also bound in three other circumstances: -(i)@tie{}when calling a c-hanging-semi&comma-criteria function -(@pxref{Hanging Semicolons and Commas}; (ii)@tie{}when calling a -line-up function (@pxref{Custom Line-Up}; (iii)@tie{}when calling a +(i)@w{ }when calling a c-hanging-semi&comma-criteria function +(@pxref{Hanging Semicolons and Commas}; (ii)@w{ }when calling a +line-up function (@pxref{Custom Line-Up}; (iii)@w{ }when calling a c-special-indent-hook function (@pxref{Other Indentation}). @end defvar @@ -3623,8 +3645,8 @@ Auto-newline minor mode are enabled: @item space-before-funcall Insert a space between the function name and the opening parenthesis of a function call. This produces function calls in the style -mandated by the GNU coding standards, e.g. @samp{signal@tie{}(SIGINT, -SIG_IGN)} and @samp{abort@tie{}()}. Clean up occurs when the opening +mandated by the GNU coding standards, e.g. @samp{signal@w{ }(SIGINT, +SIG_IGN)} and @samp{abort@w{ }()}. Clean up occurs when the opening parenthesis is typed. This clean-up should never be active in AWK Mode, since such a space is syntactically invalid for user defined functions. @@ -4017,7 +4039,7 @@ The line is nested inside a class definition. @ref{Class Symbols}. @item cpp-macro The start of a preprocessor macro definition. @ref{Literal Symbols}. @item cpp-define-intro -The first line inside a multiline preproprocessor macro if +The first line inside a multiline preprocessor macro if @code{c-syntactic-indentation-in-macros} is set. @ref{Multiline Macro Symbols}. @item cpp-macro-cont @@ -5304,7 +5326,7 @@ meaning ``this function is inappropriate in this case - try a different one''. @xref{c-offsets-alist}. The subsections below describe all the standard line-up functions, -categorized by the sort of token the lining-up centres around. For +categorized by the sort of token the lining-up centers around. For each of these functions there is a ``works with'' list that indicates which syntactic symbols the function is intended to be used with. @@ -6426,7 +6448,7 @@ functions to this hook, not remove them. @xref{Style Variables}. @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Normally, the lines in a multi-line macro are indented relative to -eachother as though they were code. You can suppress this behaviour +each other as though they were code. You can suppress this behaviour by setting the following user option: @defopt c-syntactic-indentation-in-macros