comparison man/cc-mode.texi @ 59996:aac0a33f5772

Change release version from 21.4 to 22.1 throughout. Change development version from 21.3.50 to 22.0.50.
author Kim F. Storm <storm@cua.dk>
date Wed, 09 Feb 2005 15:50:47 +0000
parents b362e981bb86
children 22798b2ebf72 3ebd9bdb4fe5
comparison
equal deleted inserted replaced
59995:8f4938738427 59996:aac0a33f5772
39 @comment %**end of header (This is for running Texinfo on a region) 39 @comment %**end of header (This is for running Texinfo on a region)
40 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 40 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
41 41
42 42
43 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 43 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
44 @comment 44 @comment
45 @comment Texinfo manual for CC Mode 45 @comment Texinfo manual for CC Mode
46 @comment Generated from the original README file by Krishna Padmasola 46 @comment Generated from the original README file by Krishna Padmasola
47 @comment <krishna@earth-gw.njit.edu> 47 @comment <krishna@earth-gw.njit.edu>
48 @comment 48 @comment
49 @comment Authors: 49 @comment Authors:
50 @comment Barry A. Warsaw 50 @comment Barry A. Warsaw
51 @comment Martin Stjernholm 51 @comment Martin Stjernholm
52 @comment 52 @comment
53 @comment Maintained by Martin Stjernholm <bug-cc-mode@gnu.org> 53 @comment Maintained by Martin Stjernholm <bug-cc-mode@gnu.org>
54 @comment 54 @comment
55 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 55 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
56 56
57 @comment Define an index for syntactic symbols. 57 @comment Define an index for syntactic symbols.
58 @defindex ss 58 @defindex ss
59 59
1949 @comment node-name, next, previous,up 1949 @comment node-name, next, previous,up
1950 @section Indentation Commands 1950 @section Indentation Commands
1951 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1951 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1952 1952
1953 The following list of commands reindent C constructs. Note that when 1953 The following list of commands reindent C constructs. Note that when
1954 you change your coding style, either interactively or through some other 1954 you change your coding style, either interactively or through some other
1955 means, your file does @emph{not} automatically get reindented. You 1955 means, your file does @emph{not} automatically get reindented. You
1956 will need to execute one of the following commands to see the effects of 1956 will need to execute one of the following commands to see the effects of
1957 your changes. 1957 your changes.
1958 1958
1959 @cindex GNU indent program 1959 @cindex GNU indent program
1960 Also, variables like @code{c-hanging-*} and @code{c-cleanup-list} 1960 Also, variables like @code{c-hanging-*} and @code{c-cleanup-list}
1961 only affect how on-the-fly code is formatted. Changing the 1961 only affect how on-the-fly code is formatted. Changing the
2863 2863
2864 @item 2864 @item
2865 If @samp{other} is not found then the @samp{gnu} style is used. 2865 If @samp{other} is not found then the @samp{gnu} style is used.
2866 2866
2867 @item 2867 @item
2868 In all cases, the style described in @code{c-default-style} is installed 2868 In all cases, the style described in @code{c-default-style} is installed
2869 @emph{before} the language hooks are run, so you can always override 2869 @emph{before} the language hooks are run, so you can always override
2870 this setting by including an explicit call to @code{c-set-style} in your 2870 this setting by including an explicit call to @code{c-set-style} in your
2871 language mode hook, or in @code{c-mode-common-hook}. 2871 language mode hook, or in @code{c-mode-common-hook}.
2872 @end enumerate 2872 @end enumerate
2873 @end defopt 2873 @end defopt
2874 2874
2875 @defvar c-indentation-style 2875 @defvar c-indentation-style
3049 with a @code{c-basic-offset} of 2, you can see that lines 4 through 6 3049 with a @code{c-basic-offset} of 2, you can see that lines 4 through 6
3050 are simply indented two spaces to the right of line 3. But perhaps we'd 3050 are simply indented two spaces to the right of line 3. But perhaps we'd
3051 like @ccmode{} to be a little more intelligent so that it aligns 3051 like @ccmode{} to be a little more intelligent so that it aligns
3052 all the @samp{<<} symbols in lines 3 through 6. To do this, we have 3052 all the @samp{<<} symbols in lines 3 through 6. To do this, we have
3053 to write a custom indentation function which finds the column of the first 3053 to write a custom indentation function which finds the column of the first
3054 stream operator on the first line of the statement. Here is sample 3054 stream operator on the first line of the statement. Here is sample
3055 lisp code implementing this: 3055 lisp code implementing this:
3056 3056
3057 @example 3057 @example
3058 (defun c-lineup-streamop (langelem) 3058 (defun c-lineup-streamop (langelem)
3059 (save-excursion 3059 (save-excursion
3876 calls. This example illustrates these: 3876 calls. This example illustrates these:
3877 3877
3878 @example 3878 @example
3879 1: void a_function( int line1, 3879 1: void a_function( int line1,
3880 2: int line2 ); 3880 2: int line2 );
3881 3: 3881 3:
3882 4: void a_longer_function( 3882 4: void a_longer_function(
3883 5: int line1, 3883 5: int line1,
3884 6: int line2 3884 6: int line2
3885 7: ); 3885 7: );
3886 8: 3886 8:
3887 9: void call_them( int line1, int line2 ) 3887 9: void call_them( int line1, int line2 )
3888 10: @{ 3888 10: @{
3889 11: a_function( 3889 11: a_function(
3890 12: line1, 3890 12: line1,
3891 13: line2 3891 13: line2
3892 14: ); 3892 14: );
3893 15: 3893 15:
3894 16: a_longer_function( line1, 3894 16: a_longer_function( line1,
3895 17: line2 ); 3895 17: line2 );
3896 18: @} 3896 18: @}
3897 @end example 3897 @end example
3898 3898
3925 1: void Bass::play( int volume ) 3925 1: void Bass::play( int volume )
3926 2: const 3926 2: const
3927 3: @{ 3927 3: @{
3928 4: /* this line starts a multiline 3928 4: /* this line starts a multiline
3929 5: * comment. This line should get `c' syntax */ 3929 5: * comment. This line should get `c' syntax */
3930 6: 3930 6:
3931 7: char* a_multiline_string = "This line starts a multiline \ 3931 7: char* a_multiline_string = "This line starts a multiline \
3932 8: string. This line should get `string' syntax."; 3932 8: string. This line should get `string' syntax.";
3933 9: 3933 9:
3934 10: note: 3934 10: note:
3935 11: @{ 3935 11: @{
3936 12: #ifdef LOCK 3936 12: #ifdef LOCK
3937 13: Lock acquire(); 3937 13: Lock acquire();
3938 14: #endif // LOCK 3938 14: #endif // LOCK
4241 Indent a multiline block @code{c-basic-offset} extra. E.g: 4241 Indent a multiline block @code{c-basic-offset} extra. E.g:
4242 4242
4243 @example 4243 @example
4244 @group 4244 @group
4245 int *foo[] = @{ 4245 int *foo[] = @{
4246 NULL, 4246 NULL,
4247 @{17@}, @hereFn{c-indent-multi-line-block} 4247 @{17@}, @hereFn{c-indent-multi-line-block}
4248 @end group 4248 @end group
4249 @end example 4249 @end example
4250 4250
4251 @noindent 4251 @noindent
4472 indentation is added. E.g: 4472 indentation is added. E.g:
4473 4473
4474 @example 4474 @example
4475 @group 4475 @group
4476 main (int, 4476 main (int,
4477 char ** 4477 char **
4478 ) @hereFn{c-lineup-close-paren} 4478 ) @hereFn{c-lineup-close-paren}
4479 @end group 4479 @end group
4480 @end example 4480 @end example
4481 4481
4482 @noindent 4482 @noindent
4682 E.g: 4682 E.g:
4683 4683
4684 @example 4684 @example
4685 @group 4685 @group
4686 class Foo 4686 class Foo
4687 extends 4687 extends
4688 Bar @hereFn{c-lineup-java-inher} 4688 Bar @hereFn{c-lineup-java-inher}
4689 @sssTBasicOffset{} 4689 @sssTBasicOffset{}
4690 @end group 4690 @end group
4691 @end example 4691 @end example
4692 4692
5546 other top-level block constructs in the @ccmode{} languages). 5546 other top-level block constructs in the @ccmode{} languages).
5547 @xref{Left Margin Paren,,, emacs, The Emacs Editor}, for details 5547 @xref{Left Margin Paren,,, emacs, The Emacs Editor}, for details
5548 (@xref{Defuns,,, emacs, The Emacs Editor}, in the Emacs 20 manual). 5548 (@xref{Defuns,,, emacs, The Emacs Editor}, in the Emacs 20 manual).
5549 5549
5550 This heuristic is built into the core syntax analysis routines in 5550 This heuristic is built into the core syntax analysis routines in
5551 (X)Emacs, so it's not really a @ccmode{} issue. However, in Emacs 21.4 5551 (X)Emacs, so it's not really a @ccmode{} issue. However, in Emacs 22.1
5552 it has become possible to turn it off@footnote{Using the variable 5552 it has become possible to turn it off@footnote{Using the variable
5553 @code{open-paren-in-column-0-is-defun-start}.} and @ccmode{} does so 5553 @code{open-paren-in-column-0-is-defun-start}.} and @ccmode{} does so
5554 there since it got its own system to keep track of blocks. 5554 there since it got its own system to keep track of blocks.
5555 5555
5556 @end itemize 5556 @end itemize