/[emacs]/emacs/man/cc-mode.texi
ViewVC logotype

Diff of /emacs/man/cc-mode.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by karl, Wed Oct 2 23:24:30 2002 UTC revision 1.21 by lektu, Tue Feb 4 14:53:27 2003 UTC
# Line 18  Line 18 
18    
19    
20  @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
21  @comment  @comment
22  @comment Texinfo manual for CC Mode  @comment Texinfo manual for CC Mode
23  @comment Generated from the original README file by Krishna Padmasola  @comment Generated from the original README file by Krishna Padmasola
24  @comment <krishna@earth-gw.njit.edu>  @comment <krishna@earth-gw.njit.edu>
# Line 28  Line 28 
28  @comment Martin Stjernholm  @comment Martin Stjernholm
29  @comment  @comment
30  @comment Maintained by Martin Stjernholm <bug-cc-mode@gnu.org>  @comment Maintained by Martin Stjernholm <bug-cc-mode@gnu.org>
31  @comment  @comment
32  @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
33    
34  @copying  @copying
# Line 398  level function block, and is indented re Line 398  level function block, and is indented re
398  which is the brace just after the function header.  which is the brace just after the function header.
399    
400  Here's another example:  Here's another example:
401  @example  @example
402  @group  @group
403    
404    1: int add( int val, int incr, int doit )    1: int add( int val, int incr, int doit )
# Line 889  in: Line 889  in:
889  @example  @example
890  @group  @group
891    
892  void spam( int i )  void spam( int i )
893  @{  @{
894          // this is a comment-only line...          // this is a comment-only line...
895      if( i == 7 )                             // but this is not      if( i == 7 )                             // but this is not
# Line 1480  that bit. Line 1480  that bit.
1480  @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1481    
1482  The following list of commands re-indent C constructs.  Note that when  The following list of commands re-indent C constructs.  Note that when
1483  you change your coding style, either interactively or through some other  you change your coding style, either interactively or through some other
1484  means, your file does @emph{not} automatically get re-indented.  You  means, your file does @emph{not} automatically get re-indented.  You
1485  will need to execute one of the following commands to see the effects of  will need to execute one of the following commands to see the effects of
1486  your changes.  your changes.
1487    
1488  @cindex GNU indent program  @cindex GNU indent program
# Line 1495  among other things. Line 1495  among other things.
1495    
1496  Re-indenting large sections of code can take a long time.  When  Re-indenting large sections of code can take a long time.  When
1497  @ccmode{} reindents a region of code, it is essentially equivalent to  @ccmode{} reindents a region of code, it is essentially equivalent to
1498  hitting @kbd{TAB} on every line of the region.  Especially vulnerable is  hitting @kbd{TAB} on every line of the region.  Especially vulnerable is
1499  code generator output@footnote{In particular, I have had people  code generator output@footnote{In particular, I have had people
1500  complain about the speed with which @code{lex(1)} output is re-indented.  complain about the speed with which @code{lex(1)} output is re-indented.
1501  Lex, yacc, and other code generators usually output some pretty  Lex, yacc, and other code generators usually output some pretty
# Line 1589  in a line's indentation, otherwise only Line 1589  in a line's indentation, otherwise only
1589  @vindex c-progress-interval  @vindex c-progress-interval
1590  @vindex progress-interval (c-)  @vindex progress-interval (c-)
1591  @item c-progress-interval  @item c-progress-interval
1592  When indenting large regions of code, this variable controls how often a  When indenting large regions of code, this variable controls how often a
1593  progress message is displayed.  Set this variable to @code{nil} to  progress message is displayed.  Set this variable to @code{nil} to
1594  inhibit the progress messages, or set it to an integer which is the  inhibit the progress messages, or set it to an integer which is the
1595  interval in seconds that progress messages are displayed.  interval in seconds that progress messages are displayed.
# Line 2355  modes. Line 2355  modes.
2355    
2356  @item  @item
2357  When @code{c-default-style} is an association list, the current major  When @code{c-default-style} is an association list, the current major
2358  mode is looked up to find a style name string.  In this case, this style  mode is looked up to find a style name string.  In this case, this style
2359  is always used exactly as specified and an error will occur if the named  is always used exactly as specified and an error will occur if the named
2360  style does not exist.  style does not exist.
2361    
2362  @item  @item
2363  If @code{c-default-style} is an association list, but the current major  If @code{c-default-style} is an association list, but the current major
2364  mode isn't found, then the special symbol @samp{other} is looked up.  If  mode isn't found, then the special symbol @samp{other} is looked up.  If
2365  this value is found, the associated style is used.  this value is found, the associated style is used.
2366    
2367  @item  @item
2368  If @samp{other} is not found, then the @samp{gnu} style is used.  If @samp{other} is not found, then the @samp{gnu} style is used.
2369    
2370  @item  @item
2371  In all cases, the style described in @code{c-default-style} is installed  In all cases, the style described in @code{c-default-style} is installed
2372  @emph{before} the language hooks are run, so you can always override  @emph{before} the language hooks are run, so you can always override
2373  this setting by including an explicit call to @code{c-set-style} in your  this setting by including an explicit call to @code{c-set-style} in your
2374  language mode hook, or in @code{c-mode-common-hook}.  language mode hook, or in @code{c-mode-common-hook}.
2375    
2376  @end enumerate  @end enumerate
# Line 2533  are simply indented two spaces to the ri Line 2533  are simply indented two spaces to the ri
2533  like @ccmode{} to be a little more intelligent so that it aligns  like @ccmode{} to be a little more intelligent so that it aligns
2534  all the @samp{<<} symbols in lines 3 through 6.  To do this, we have  all the @samp{<<} symbols in lines 3 through 6.  To do this, we have
2535  to write a custom indentation function which finds the column of first  to write a custom indentation function which finds the column of first
2536  stream operator on the first line of the statement.  Here is sample  stream operator on the first line of the statement.  Here is sample
2537  lisp code implementing this:  lisp code implementing this:
2538  @example  @example
2539  @group  @group
# Line 2823  i.e. they want the comments to always in Line 2823  i.e. they want the comments to always in
2823  code, regardless of whether @kbd{TAB} or @kbd{M-;} were used.  This  code, regardless of whether @kbd{TAB} or @kbd{M-;} were used.  This
2824  behavior is controlled by the variable  behavior is controlled by the variable
2825  @code{c-indent-comments-syntactically-p}.  When @code{nil} (the  @code{c-indent-comments-syntactically-p}.  When @code{nil} (the
2826  default), @kbd{M-;} indents comment-only lines to @code{comment-column},  default), @kbd{M-;} indents comment-only lines to @code{comment-column},
2827  otherwise, they are indented just as they would be if @kbd{TAB} were  otherwise, they are indented just as they would be if @kbd{TAB} were
2828  typed.  typed.
2829    
# Line 3374  symbols.  In this example: Line 3374  symbols.  In this example:
3374  @example  @example
3375  @group  @group
3376    
3377     1: extern "C"     1: extern "C"
3378     2: @{     2: @{
3379     3:     int thing_one( int );     3:     int thing_one( int );
3380     4:     int thing_two( double );     4:     int thing_two( double );
# Line 3412  symbols.  In this example: Line 3412  symbols.  In this example:
3412  @noindent  @noindent
3413  line 2 is given the @code{namespace-open} syntax, while line 4 is given  line 2 is given the @code{namespace-open} syntax, while line 4 is given
3414  the @code{namespace-close} syntax.  The analysis for line 3 yields:  the @code{namespace-close} syntax.  The analysis for line 3 yields:
3415  @code{((innamespace) (topmost-intro . 17))}, where @code{innamespace} is  @code{((innamespace) (topmost-intro . 17))}, where @code{innamespace} is
3416  a modifier similar in purpose to @code{inextern-lang} and @code{inclass}.  a modifier similar in purpose to @code{inextern-lang} and @code{inclass}.
3417    
3418  A number of syntactic symbols are associated with parenthesis lists,  A number of syntactic symbols are associated with parenthesis lists,
# Line 3423  calls.  This example illustrates these: Line 3423  calls.  This example illustrates these:
3423    
3424     1: void a_function( int line1,     1: void a_function( int line1,
3425     2:                  int line2 );     2:                  int line2 );
3426     3:     3:
3427     4: void a_longer_function(     4: void a_longer_function(
3428     5:     int line1,     5:     int line1,
3429     6:     int line2     6:     int line2
3430     7:     );     7:     );
3431     8:     8:
3432     9: void call_them( int line1, int line2 )     9: void call_them( int line1, int line2 )
3433    10: @{    10: @{
3434    11:     a_function(    11:     a_function(
3435    12:         line1,    12:         line1,
3436    13:         line2    13:         line2
3437    14:         );    14:         );
3438    15:    15:
3439    16:     a_longer_function( line1,    16:     a_longer_function( line1,
3440    17:                        line2 );    17:                        line2 );
3441    18: @}    18: @}
# Line 3475  covered are illustrated by this C++ exam Line 3475  covered are illustrated by this C++ exam
3475     3: @{     3: @{
3476     4:     /* this line starts a multi-line     4:     /* this line starts a multi-line
3477     5:      * comment.  This line should get `c' syntax */     5:      * comment.  This line should get `c' syntax */
3478     6:     6:
3479     7:     char* a_multiline_string = "This line starts a multi-line \     7:     char* a_multiline_string = "This line starts a multi-line \
3480     8: string.  This line should get `string' syntax.";     8: string.  This line should get `string' syntax.";
3481     9:     9:
3482    10:   note:    10:   note:
3483    11:     @{    11:     @{
3484    12: #ifdef LOCK    12: #ifdef LOCK
# Line 3567  example: Line 3567  example:
3567  @end example  @end example
3568  @noindent  @noindent
3569  line 1 is given the syntactic symbol @code{cpp-macro}.  This first line  line 1 is given the syntactic symbol @code{cpp-macro}.  This first line
3570  of a macro is always given this symbol.  The second and subsequent lines  of a macro is always given this symbol.  The second and subsequent lines
3571  (e.g. lines 2 through 5) are given the @code{cpp-macro-cont} syntactic  (e.g. lines 2 through 5) are given the @code{cpp-macro-cont} syntactic
3572  symbol, with a relative buffer position pointing to the @code{#} which  symbol, with a relative buffer position pointing to the @code{#} which
3573  starts the macro definition.  starts the macro definition.
# Line 3778  indentation is added.  E.g: Line 3778  indentation is added.  E.g:
3778  @group  @group
3779    
3780  main (int,  main (int,
3781        char **                  char **
3782       )                   // c-lineup-close-paren       )                   // c-lineup-close-paren
3783    
3784  @end group  @end group
# Line 3857  E.g: Line 3857  E.g:
3857  @group  @group
3858    
3859  class Foo  class Foo
3860      extends                extends
3861          Bar              // c-lineup-java-inher          Bar              // c-lineup-java-inher
3862    
3863      <--> c-basic-offset      <--> c-basic-offset
# Line 3921  Indent a one line block @code{c-basic-of Line 3921  Indent a one line block @code{c-basic-of
3921    
3922  if (n > 0)  if (n > 0)
3923      @{m+=n; n=0;@}         // c-indent-one-line-block      @{m+=n; n=0;@}         // c-indent-one-line-block
3924                              
3925  <--> c-basic-offset          <--> c-basic-offset
3926    
3927  @end group  @end group
3928  @end example  @end example
# Line 3954  Indent a multi line block @code{c-basic- Line 3954  Indent a multi line block @code{c-basic-
3954  @group  @group
3955    
3956  int *foo[] = @{  int *foo[] = @{
3957      NULL,                      NULL,
3958      @{17@},                // c-indent-multi-line-block      @{17@},                // c-indent-multi-line-block
3959    
3960  @end group  @end group
# Line 4440  in the @file{README} file. Line 4440  in the @file{README} file.
4440  XEmacs since 19.16.  XEmacs since 19.16.
4441    
4442  Due to release schedule skew, it is likely that all of these Emacsen  Due to release schedule skew, it is likely that all of these Emacsen
4443  have old versions of @ccmode{} and so should be upgraded.  Access to the  have old versions of @ccmode{} and so should be upgraded.  Access to the
4444  @ccmode{} source code, as well as more detailed information on Emacsen  @ccmode{} source code, as well as more detailed information on Emacsen
4445  compatibility, etc. are all available via the Web at:  compatibility, etc. are all available via the Web at:
4446    

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26