aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-06-13 22:14:41 +0000
committerRichard M. Stallman2004-06-13 22:14:41 +0000
commit7ae8ad948e6135155bcfe54a41e09e1eafa1414d (patch)
treea5b0720727c3a04e6140484c25a967c00da05164
parenta67091f2b3b3cca4320852c90fb0b72f7f1ff02f (diff)
downloademacs-7ae8ad948e6135155bcfe54a41e09e1eafa1414d.tar.gz
emacs-7ae8ad948e6135155bcfe54a41e09e1eafa1414d.zip
Update for CC Mode 5.30 and incidental amendments.
("AWK"): Is consistently thus spelt throughout. (AWK, Pike): Document as "C-like modes". (@kbd{M-j}): Document as alternative to @kbd{C-M-j}. (M-x man): Supersedes M-x manual-entry. Add numerous index entries. Correct "ESC a/e" to "M-a/e". ("Comments in C"): Delete node; the info is in CC Mode manual. (c-comment-only-line-offset): Remove description. (C-c ., C-c C-c): Describe new C Mode bindings. (C-u TAB, indent-code-rigidly, c-indent-exp, c-tab-always-indent) (@dfn{Style}, c-default-style, comment-column, comment-padding) (c-up-conditional, c-beginning-of-statement, c-end-of-statement): Amend definitions. (c-beginning-of-defun, c-end-of-defun, c-context-line-break): Describe functions. (c-comment-start-regexp, c-hanging-comment-ender-p) (c-hanging-comment-starter-p): Remove obsolete definitions.
-rw-r--r--man/programs.texi245
1 files changed, 125 insertions, 120 deletions
diff --git a/man/programs.texi b/man/programs.texi
index 84f3e6f14f8..9c081a7315b 100644
--- a/man/programs.texi
+++ b/man/programs.texi
@@ -65,7 +65,6 @@ and you can select it by typing @kbd{M-x @var{l}-mode @key{RET}}.
65 65
66@cindex Perl mode 66@cindex Perl mode
67@cindex Icon mode 67@cindex Icon mode
68@cindex Awk mode
69@cindex Makefile mode 68@cindex Makefile mode
70@cindex Tcl mode 69@cindex Tcl mode
71@cindex CPerl mode 70@cindex CPerl mode
@@ -82,7 +81,7 @@ and you can select it by typing @kbd{M-x @var{l}-mode @key{RET}}.
82@cindex PostScript mode 81@cindex PostScript mode
83 The existing programming language major modes include Lisp, Scheme (a 82 The existing programming language major modes include Lisp, Scheme (a
84variant of Lisp) and the Scheme-based DSSSL expression language, Ada, 83variant of Lisp) and the Scheme-based DSSSL expression language, Ada,
85Awk, C, C++, Delphi (Object Pascal), Fortran (free format and fixed 84AWK, C, C++, Delphi (Object Pascal), Fortran (free format and fixed
86format), Icon, IDL (CORBA), IDLWAVE, Java, Metafont (@TeX{}'s 85format), Icon, IDL (CORBA), IDLWAVE, Java, Metafont (@TeX{}'s
87companion for font creation), Modula2, Objective-C, Octave, Pascal, 86companion for font creation), Modula2, Objective-C, Octave, Pascal,
88Perl, Pike, PostScript, Prolog, Simula, Tcl, and VHDL. There is 87Perl, Pike, PostScript, Prolog, Simula, Tcl, and VHDL. There is
@@ -104,7 +103,7 @@ whitespace consists of spaces or tabs. Use @kbd{C-b C-d} to delete a
104tab character before point, in these modes. 103tab character before point, in these modes.
105 104
106 Separate manuals are available for the modes for Ada (@pxref{Top, , Ada 105 Separate manuals are available for the modes for Ada (@pxref{Top, , Ada
107Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL 106Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL/Pike/AWK
108(@pxref{Top, , CC Mode, ccmode, CC Mode}) and the IDLWAVE modes 107(@pxref{Top, , CC Mode, ccmode, CC Mode}) and the IDLWAVE modes
109(@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}). 108(@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}).
110 109
@@ -446,15 +445,16 @@ modes and C and related modes.) @key{TAB} with a numeric argument
446reindents the current line as usual, then reindents by the same amount 445reindents the current line as usual, then reindents by the same amount
447all the lines in the parenthetical grouping starting on the current 446all the lines in the parenthetical grouping starting on the current
448line. It is clever, though, and does not alter lines that start 447line. It is clever, though, and does not alter lines that start
449inside strings, or C preprocessor lines when in C mode. 448inside strings. Neither does it alter C preprocessor lines when in C
449mode, but it does reindent any continuation lines that may be attached
450to them.
450 451
451@findex indent-code-rigidly 452@findex indent-code-rigidly
452 You can also perform this operation on the region, using the command 453 You can also perform this operation on the region, using the command
453@kbd{M-x indent-code-rigidly}. It rigidly shifts all the lines in the 454@kbd{M-x indent-code-rigidly}. It rigidly shifts all the lines in the
454region sideways, like @code{indent-rigidly} does (@pxref{Indentation 455region sideways, like @code{indent-rigidly} does (@pxref{Indentation
455Commands}). It doesn't alter the indentation of lines that start 456Commands}). It doesn't alter the indentation of lines that start
456inside a comment or a string, unless the region starts inside that 457inside a string, unless the region also starts inside that string.
457comment or string.
458 458
459@node Lisp Indent 459@node Lisp Indent
460@subsection Customizing Lisp Indentation 460@subsection Customizing Lisp Indentation
@@ -507,14 +507,15 @@ declaration (@code{c-indent-defun}).
507@kindex C-M-q @r{(C mode)} 507@kindex C-M-q @r{(C mode)}
508@findex c-indent-exp 508@findex c-indent-exp
509Reindent each line in the balanced expression that follows point 509Reindent each line in the balanced expression that follows point
510(@code{c-indent-exp}). A prefix argument inhibits error checking and 510(@code{c-indent-exp}). A prefix argument inhibits warning messages
511warning messages about invalid syntax. 511about invalid syntax.
512 512
513@item @key{TAB} 513@item @key{TAB}
514@findex c-indent-command 514@findex c-indent-command
515Reindent the current line, and/or in some cases insert a tab character 515Reindent the current line, and/or in some cases insert a tab character
516(@code{c-indent-command}). 516(@code{c-indent-command}).
517 517
518@vindex c-tab-always-indent
518If @code{c-tab-always-indent} is @code{t}, this command always reindents 519If @code{c-tab-always-indent} is @code{t}, this command always reindents
519the current line and does nothing else. This is the default. 520the current line and does nothing else. This is the default.
520 521
@@ -524,8 +525,7 @@ otherwise, it inserts a tab (or the equivalent number of spaces,
524if @code{indent-tabs-mode} is @code{nil}). 525if @code{indent-tabs-mode} is @code{nil}).
525 526
526Any other value (not @code{nil} or @code{t}) means always reindent the 527Any other value (not @code{nil} or @code{t}) means always reindent the
527line, and also insert a tab if within a comment, a string, or a 528line, and also insert a tab if within a comment or a string.
528preprocessor directive.
529@end table 529@end table
530 530
531 To reindent the whole current buffer, type @kbd{C-x h C-M-\}. This 531 To reindent the whole current buffer, type @kbd{C-x h C-M-\}. This
@@ -539,18 +539,19 @@ to the front of the block and then reindents it all.
539@subsection Customizing C Indentation 539@subsection Customizing C Indentation
540@cindex style (for indentation) 540@cindex style (for indentation)
541 541
542 C mode and related modes use a simple yet flexible mechanism for 542 C mode and related modes use a flexible mechanism for customizing
543customizing indentation. The mechanism works in two steps: first it 543indentation. C mode indents a source line in two steps: first it
544classifies the line syntactically according to its contents and context; 544classifies the line syntactically according to its contents and
545second, it associates each kind of syntactic construct with an 545context; second, it determines the indentation offset associated by
546indentation offset based on your selected @dfn{style}. 546your selected @dfn{style} with the syntactic construct and adds this
547onto the indentation of the @dfn{anchor statement}.
547 548
548@table @kbd 549@table @kbd
549@item M-x c-set-style @key{RET} @var{style} @key{RET} 550@item C-c . @key{RET} @var{style} @key{RET}
550Select predefined indentation style @var{style}. 551Select a predefined style @var{style} (@code{c-set-style}).
551@end table 552@end table
552 553
553 A style is a named collection of indentation customizations that can 554 A @dfn{style} is a named collection of customizations that can
554be used in C mode and the related modes. Emacs comes with several 555be used in C mode and the related modes. Emacs comes with several
555predefined styles, including @code{gnu}, @code{k&r}, @code{bsd}, 556predefined styles, including @code{gnu}, @code{k&r}, @code{bsd},
556@code{stroustrup}, @code{linux}, @code{python}, @code{java}, 557@code{stroustrup}, @code{linux}, @code{python}, @code{java},
@@ -561,19 +562,21 @@ modes. To find out what a style looks like, select it and reindent
561some code, e.g., by typing @key{C-M-q} at the start of a function 562some code, e.g., by typing @key{C-M-q} at the start of a function
562definition. 563definition.
563 564
565@kindex C-c . @r{(C mode)}
564@findex c-set-style 566@findex c-set-style
565 To choose a style for the current buffer, use the command @kbd{M-x 567 To choose a style for the current buffer, use the command @kbd{C-c
566c-set-style}. Specify a style name as an argument (case is not 568.}. Specify a style name as an argument (case is not significant).
567significant). This command affects the current buffer only, and it 569This command affects the current buffer only, and it affects only
568affects only future invocations of the indentation commands; it does 570future invocations of the indentation commands; it does not reindent
569not reindent the code in the buffer. To reindent the whole buffer in 571the code in the buffer. To reindent the whole buffer in the new
570the new style, you can type @kbd{C-x h C-M-\}. 572style, you can type @kbd{C-x h C-M-\}.
571 573
572@vindex c-default-style 574@vindex c-default-style
573 You can also set the variable @code{c-default-style} to specify the 575 You can also set the variable @code{c-default-style} to specify the
574default style for various major modes. Its value should be an alist, 576default style for various major modes. Its value should be either the
575in which each element specifies one major mode and which indentation 577style's name (a string) or an alist, in which each element specifies
576style to use for it. For example, 578one major mode and which indentation style to use for it. For
579example,
577 580
578@example 581@example
579(setq c-default-style 582(setq c-default-style
@@ -848,18 +851,20 @@ also do spell checking on comments with Flyspell Prog mode
848 The comment commands in this table insert, kill and align comments. 851 The comment commands in this table insert, kill and align comments.
849They are described in this section and following sections. 852They are described in this section and following sections.
850 853
851@table @kbd 854@table @asis
852@item M-; 855@item @kbd{M-;}
853Insert or realign comment on current line; alternatively, comment or 856Insert or realign comment on current line; alternatively, comment or
854uncomment the region (@code{comment-dwim}). 857uncomment the region (@code{comment-dwim}).
855@item C-u M-; 858@item @kbd{C-u M-;}
856Kill comment on current line (@code{comment-kill}). 859Kill comment on current line (@code{comment-kill}).
857@item C-x ; 860@item @kbd{C-x ;}
858Set comment column (@code{comment-set-column}). 861Set comment column (@code{comment-set-column}).
859@item C-M-j 862@item @kbd{C-M-j}
863@itemx @kbd{M-j}
860Like @key{RET} followed by inserting and aligning a comment 864Like @key{RET} followed by inserting and aligning a comment
861(@code{comment-indent-new-line}). 865(@code{comment-indent-new-line}).
862@item M-x comment-region 866@item @kbd{M-x comment-region}
867@itemx @kbd{C-c C-c} (in C-like modes)
863Add or remove comment delimiters on all the lines in the region. 868Add or remove comment delimiters on all the lines in the region.
864@end table 869@end table
865 870
@@ -937,17 +942,20 @@ is indented like a line of code.
937@subsection Multiple Lines of Comments 942@subsection Multiple Lines of Comments
938 943
939@kindex C-M-j 944@kindex C-M-j
945@kindex M-j
940@cindex blank lines in programs 946@cindex blank lines in programs
941@findex comment-indent-new-line 947@findex comment-indent-new-line
942 If you are typing a comment and wish to continue it on another line, 948 If you are typing a comment and wish to continue it on another line,
943you can use the command @kbd{C-M-j} (@code{comment-indent-new-line}). 949you can use the command @kbd{C-M-j} or @kbd{M-j}
944This terminates the comment you are typing, creates a new blank line 950(@code{comment-indent-new-line}). This terminates the comment you are
945afterward, and begins a new comment indented under the old one. When 951typing, creates a new blank line afterward, and begins a new comment
946Auto Fill mode is on, going past the fill column while typing a comment 952indented under the old one. When Auto Fill mode is on, going past the
947causes the comment to be continued in just this fashion. If point is 953fill column while typing a comment causes the comment to be continued
948not at the end of the line when @kbd{C-M-j} is typed, the text on 954in just this fashion. If point is not at the end of the line when you
949the rest of the line becomes part of the new comment line. 955type the command, the text on the rest of the line becomes part of the
950 956new comment line.
957
958@kindex C-c C-c (C mode)
951@findex comment-region 959@findex comment-region
952 To turn existing lines into comment lines, use the @kbd{M-x 960 To turn existing lines into comment lines, use the @kbd{M-x
953comment-region} command. It adds comment delimiters to the lines that start 961comment-region} command. It adds comment delimiters to the lines that start
@@ -970,12 +978,13 @@ if within a defun, it must be three.
970@vindex comment-column 978@vindex comment-column
971@kindex C-x ; 979@kindex C-x ;
972@findex comment-set-column 980@findex comment-set-column
973 The comment column is stored in the variable @code{comment-column}. You 981 The @dfn{comment column}, the column at which Emacs tries to place
974can set it to a number explicitly. Alternatively, the command @kbd{C-x ;} 982comments, is stored in the variable @code{comment-column}. You can
975(@code{comment-set-column}) sets the comment column to the column point is 983set it to a number explicitly. Alternatively, the command @kbd{C-x ;}
976at. @kbd{C-u C-x ;} sets the comment column to match the last comment 984(@code{comment-set-column}) sets the comment column to the column
977before point in the buffer, and then does a @kbd{M-;} to align the 985point is at. @kbd{C-u C-x ;} sets the comment column to match the
978current line's comment under the previous one. 986last comment before point in the buffer, and then does a @kbd{M-;} to
987align the current line's comment under the previous one.
979 988
980 The variable @code{comment-column} is per-buffer: setting the variable 989 The variable @code{comment-column} is per-buffer: setting the variable
981in the normal fashion affects only the current buffer, but there is a 990in the normal fashion affects only the current buffer, but there is a
@@ -990,7 +999,7 @@ Make sure this regexp does not match the null string. It may match more
990than the comment starting delimiter in the strictest sense of the word; 999than the comment starting delimiter in the strictest sense of the word;
991for example, in C mode the value of the variable is 1000for example, in C mode the value of the variable is
992@c This stops M-q from breaking the line inside that @code. 1001@c This stops M-q from breaking the line inside that @code.
993@code{@w{"/\\*+ *\\|//+ *""}}, which matches extra stars and spaces 1002@code{@w{"/\\*+ *\\|//+ *"}}, which matches extra stars and spaces
994after the @samp{/*} itself, and accepts C++ style comments also. 1003after the @samp{/*} itself, and accepts C++ style comments also.
995(Note that @samp{\\} is needed in Lisp syntax to include a @samp{\} in 1004(Note that @samp{\\} is needed in Lisp syntax to include a @samp{\} in
996the string, which is needed to deny the first star its special meaning 1005the string, which is needed to deny the first star its special meaning
@@ -1006,21 +1015,21 @@ into the comment. In C mode, @code{comment-start} has the value
1006 1015
1007@vindex comment-padding 1016@vindex comment-padding
1008 The variable @code{comment-padding} specifies how many spaces 1017 The variable @code{comment-padding} specifies how many spaces
1009@code{comment-region} should insert on each line between the 1018@code{comment-region} should insert on each line between the comment
1010comment delimiter and the line's original text. The default is 1, 1019delimiter and the line's original text. The default is 1, to insert
1011to insert one space. 1020one space. @code{nil} means 0. Alternatively, @code{comment-padding}
1021can hold the actual string to insert.
1012 1022
1013@vindex comment-multi-line 1023@vindex comment-multi-line
1014 The variable @code{comment-multi-line} controls how @kbd{C-M-j} 1024 The variable @code{comment-multi-line} controls how @kbd{C-M-j}
1015(@code{indent-new-comment-line}) behaves when used inside a comment. If 1025(@code{indent-new-comment-line}) behaves when used inside a comment.
1016@code{comment-multi-line} is @code{nil}, as it normally is, then the 1026Specifically, when @code{comment-multi-line} is @code{nil} (the
1017comment on the starting line is terminated and a new comment is started 1027default value), the command inserts a comment terminator, begins a new
1018on the new following line. If @code{comment-multi-line} is not 1028line, and finally inserts a comment starter. Otherwise it does not
1019@code{nil}, then the new following line is set up as part of the same 1029insert the terminator and starter, so it effectively continues the
1020comment that was found on the starting line. This is done by not 1030current comment across multiple lines. In languages that allow
1021inserting a terminator on the old line, and not inserting a starter on 1031multi-line comments, the choice of value for this variable is a matter
1022the new line. In languages where multi-line comments work, the choice 1032of taste.
1023of value for this variable is a matter of taste.
1024 1033
1025@vindex comment-indent-function 1034@vindex comment-indent-function
1026 The variable @code{comment-indent-function} should contain a function 1035 The variable @code{comment-indent-function} should contain a function
@@ -1064,7 +1073,7 @@ symbol---which Info files to look in, and which indices to search.
1064You can also use @kbd{M-x info-lookup-file} to look for documentation 1073You can also use @kbd{M-x info-lookup-file} to look for documentation
1065for a file name. 1074for a file name.
1066 1075
1067 This feature currently supports the modes Awk, Autoconf, Bison, C, 1076 This feature currently supports the modes AWK, Autoconf, Bison, C,
1068Emacs Lisp, LaTeX, M4, Makefile, Octave, Perl, Scheme, and Texinfo, 1077Emacs Lisp, LaTeX, M4, Makefile, Octave, Perl, Scheme, and Texinfo,
1069provided you have installed the relevant Info files, which are 1078provided you have installed the relevant Info files, which are
1070typically available with the appropriate GNU package. 1079typically available with the appropriate GNU package.
@@ -1081,7 +1090,7 @@ still useful to read manual pages.
1081 1090
1082@findex manual-entry 1091@findex manual-entry
1083 You can read the man page for an operating system command, library 1092 You can read the man page for an operating system command, library
1084function, or system call, with the @kbd{M-x manual-entry} command. It 1093function, or system call, with the @kbd{M-x man} command. It
1085runs the @code{man} program to format the man page; if the system 1094runs the @code{man} program to format the man page; if the system
1086permits, it runs @code{man} asynchronously, so that you can keep on 1095permits, it runs @code{man} asynchronously, so that you can keep on
1087editing while the page is being formatted. (On MS-DOS and MS-Windows 1096editing while the page is being formatted. (On MS-DOS and MS-Windows
@@ -1393,25 +1402,27 @@ Mode}). The Foldout package provides folding-editor features
1393@cindex CORBA IDL mode 1402@cindex CORBA IDL mode
1394@cindex Objective C mode 1403@cindex Objective C mode
1395@cindex C++ mode 1404@cindex C++ mode
1405@cindex AWK mode
1396@cindex mode, Java 1406@cindex mode, Java
1397@cindex mode, C 1407@cindex mode, C
1408@cindex mode, C++
1398@cindex mode, Objective C 1409@cindex mode, Objective C
1399@cindex mode, CORBA IDL 1410@cindex mode, CORBA IDL
1400@cindex mode, Pike 1411@cindex mode, Pike
1412@cindex mode, AWK
1401 1413
1402 This section gives a brief description of the special features 1414 This section gives a brief description of the special features
1403available in C, C++, Objective-C, Java, CORBA IDL, and Pike modes. 1415available in C, C++, Objective-C, Java, CORBA IDL, Pike and AWK modes.
1404(These are called ``C mode and related modes.'') @xref{Top, , CC Mode, 1416(These are called ``C mode and related modes.'') @xref{Top, , CC Mode,
1405ccmode, CC Mode}, for a more extensive description of these modes 1417ccmode, CC Mode}, for a more extensive description of these modes
1406and their special features. 1418and their special features.
1407 1419
1408@menu 1420@menu
1409* Motion in C:: Commands to move by C statements, etc. 1421* Motion in C:: Commands to move by C statements, etc.
1410* Electric C:: Colon and other chars can automatically reindent. 1422* Electric C:: Colon and other chars can automatically reindent.
1411* Hungry Delete:: A more powerful DEL command. 1423* Hungry Delete:: A more powerful DEL command.
1412* Other C Commands:: Filling comments, viewing expansion of macros, 1424* Other C Commands:: Filling comments, viewing expansion of macros,
1413 and other neat features. 1425 and other neat features.
1414* Comments in C:: Options for customizing comment style.
1415@end menu 1426@end menu
1416 1427
1417@node Motion in C 1428@node Motion in C
@@ -1421,15 +1432,29 @@ and their special features.
1421related modes. 1432related modes.
1422 1433
1423@table @code 1434@table @code
1435@item M-x c-beginning-of-defun
1436@itemx M-x c-end-of-defun
1437@findex c-beginning-of-defun
1438@findex c-end-of-defun
1439Move point to the beginning or end of the current function or
1440top-level definition. These are found by searching for the least
1441enclosing braces. (By contrast, @code{beginning-of-defun} and
1442@code{end-of-defun} search for braces in column zero.) If you are
1443editing code where the opening brace of a function isn't placed in
1444column zero, you may wish to bind @code{C-M-a} and @code{C-M-e} to
1445these commands. @xref{Moving by Defuns}.
1446
1424@item C-c C-u 1447@item C-c C-u
1425@kindex C-c C-u @r{(C mode)} 1448@kindex C-c C-u @r{(C mode)}
1426@findex c-up-conditional 1449@findex c-up-conditional
1427Move point back to the containing preprocessor conditional, leaving the 1450Move point back to the containing preprocessor conditional, leaving the
1428mark behind. A prefix argument acts as a repeat count. With a negative 1451mark behind. A prefix argument acts as a repeat count. With a negative
1429argument, move point forward to the end of the containing 1452argument, move point forward to the end of the containing
1430preprocessor conditional. When going backwards, @code{#elif} is treated 1453preprocessor conditional.
1431like @code{#else} followed by @code{#if}. When going forwards, 1454
1432@code{#elif} is ignored.@refill 1455@samp{#elif} is equivalent to @samp{#else} followed by @samp{#if}, so
1456the function will stop at a @samp{#elif} when going backward, but not
1457when going forward.
1433 1458
1434@item C-c C-p 1459@item C-c C-p
1435@kindex C-c C-p @r{(C mode)} 1460@kindex C-c C-p @r{(C mode)}
@@ -1446,27 +1471,22 @@ behind. A prefix argument acts as a repeat count. With a negative
1446argument, move backward. 1471argument, move backward.
1447 1472
1448@item M-a 1473@item M-a
1449@kindex ESC a 1474@kindex M-a (C mode)
1450@findex c-beginning-of-statement 1475@findex c-beginning-of-statement
1451Move point to the beginning of the innermost C statement 1476Move point to the beginning of the innermost C statement
1452(@code{c-beginning-of-statement}). If point is already at the beginning 1477(@code{c-beginning-of-statement}). If point is already at the beginning
1453of a statement, move to the beginning of the preceding statement. With 1478of a statement, move to the beginning of the preceding statement. With
1454prefix argument @var{n}, move back @var{n} @minus{} 1 statements. 1479prefix argument @var{n}, move back @var{n} @minus{} 1 statements.
1455 1480
1456If point is within a string or comment, or next to a comment (only 1481In comments or in strings which span more than one line, this command
1457whitespace between them), this command moves by sentences instead of 1482moves by sentences instead of statements.
1458statements.
1459
1460When called from a program, this function takes three optional
1461arguments: the numeric prefix argument, a buffer position limit
1462(don't move back before that place), and a flag that controls whether
1463to do sentence motion when inside of a comment.
1464 1483
1465@item M-e 1484@item M-e
1466@kindex ESC e 1485@kindex M-e (C mode)
1467@findex c-end-of-statement 1486@findex c-end-of-statement
1468Move point to the end of the innermost C statement; like @kbd{M-a} 1487Move point to the end of the innermost C statement or sentence; like
1469except that it moves in the other direction (@code{c-end-of-statement}). 1488@kbd{M-a} except that it moves in the other direction
1489(@code{c-end-of-statement}).
1470 1490
1471@item M-x c-backward-into-nomenclature 1491@item M-x c-backward-into-nomenclature
1472@findex c-backward-into-nomenclature 1492@findex c-backward-into-nomenclature
@@ -1530,12 +1550,14 @@ Insert a double colon scope operator at point, without reindenting the
1530line or adding any newlines (@code{c-scope-operator}). 1550line or adding any newlines (@code{c-scope-operator}).
1531@end table 1551@end table
1532 1552
1553@vindex c-electric-pound-behavior
1533 The electric @kbd{#} key reindents the line if it appears to be the 1554 The electric @kbd{#} key reindents the line if it appears to be the
1534beginning of a preprocessor directive. This happens when the value of 1555beginning of a preprocessor directive. This happens when the value of
1535@code{c-electric-pound-behavior} is @code{(alignleft)}. You can turn 1556@code{c-electric-pound-behavior} is @code{(alignleft)}. You can turn
1536this feature off by setting @code{c-electric-pound-behavior} to 1557this feature off by setting @code{c-electric-pound-behavior} to
1537@code{nil}. 1558@code{nil}.
1538 1559
1560@vindex c-hanging-braces-alist
1539 The variable @code{c-hanging-braces-alist} controls the insertion of 1561 The variable @code{c-hanging-braces-alist} controls the insertion of
1540newlines before and after inserted braces. It is an association list 1562newlines before and after inserted braces. It is an association list
1541with elements of the following form: @code{(@var{syntactic-symbol} 1563with elements of the following form: @code{(@var{syntactic-symbol}
@@ -1550,6 +1572,7 @@ to determine where newlines are inserted: either before the brace,
1550after, or both. If not found, the default is to insert a newline both 1572after, or both. If not found, the default is to insert a newline both
1551before and after braces. 1573before and after braces.
1552 1574
1575@vindex c-hanging-colons-alist
1553 The variable @code{c-hanging-colons-alist} controls the insertion of 1576 The variable @code{c-hanging-colons-alist} controls the insertion of
1554newlines before and after inserted colons. It is an association list 1577newlines before and after inserted colons. It is an association list
1555with elements of the following form: @code{(@var{syntactic-symbol} 1578with elements of the following form: @code{(@var{syntactic-symbol}
@@ -1562,6 +1585,7 @@ where newlines are inserted: either before the brace, after, or both.
1562If the syntactic symbol is not found in this list, no newlines are 1585If the syntactic symbol is not found in this list, no newlines are
1563inserted. 1586inserted.
1564 1587
1588@vindex c-cleanup-list
1565 Electric characters can also delete newlines automatically when the 1589 Electric characters can also delete newlines automatically when the
1566auto-newline feature is enabled. This feature makes auto-newline more 1590auto-newline feature is enabled. This feature makes auto-newline more
1567acceptable, by deleting the newlines in the most common cases where you 1591acceptable, by deleting the newlines in the most common cases where you
@@ -1613,6 +1637,7 @@ whitespace.
1613 1637
1614@node Hungry Delete 1638@node Hungry Delete
1615@subsection Hungry Delete Feature in C 1639@subsection Hungry Delete Feature in C
1640@cindex hungry deletion (C Mode)
1616 1641
1617 When the @dfn{hungry-delete} feature is enabled (indicated by 1642 When the @dfn{hungry-delete} feature is enabled (indicated by
1618@samp{/h} or @samp{/ah} in the mode line after the mode name), a single 1643@samp{/h} or @samp{/ah} in the mode line after the mode name), a single
@@ -1642,6 +1667,21 @@ hungry-delete feature is enabled.
1642@subsection Other Commands for C Mode 1667@subsection Other Commands for C Mode
1643 1668
1644@table @kbd 1669@table @kbd
1670@item M-x c-context-line-break
1671@findex c-context-line-break
1672This command inserts a line break and indents the new line in a manner
1673appropriate to the context. In normal code, it does the work of
1674@kbd{C-j} (@code{newline-and-indent}), in a C preprocessor line it
1675additionally inserts a @samp{\} at the line break, and within comments
1676it's like @kbd{M-j} (@code{c-indent-new-comment-line}).
1677
1678@code{c-context-line-break} isn't bound to a key by default, but it
1679needs a binding to be useful. The following code will bind it to
1680@kbd{C-j}.
1681@example
1682(define-key c-mode-base-map "\C-j" 'c-context-line-break)
1683@end example
1684
1645@item C-M-h 1685@item C-M-h
1646Put mark at the end of a function definition, and put point at the 1686Put mark at the end of a function definition, and put point at the
1647beginning (@code{c-mark-function}). 1687beginning (@code{c-mark-function}).
@@ -1702,6 +1742,7 @@ directs how the line is indented.
1702@itemx M-x global-cwarn-mode 1742@itemx M-x global-cwarn-mode
1703@findex cwarn-mode 1743@findex cwarn-mode
1704@findex global-cwarn-mode 1744@findex global-cwarn-mode
1745@vindex global-cwarn-mode
1705@cindex CWarn mode 1746@cindex CWarn mode
1706@cindex suspicious constructions in C, C++ 1747@cindex suspicious constructions in C, C++
1707CWarn minor mode highlights certain suspicious C and C++ constructions: 1748CWarn minor mode highlights certain suspicious C and C++ constructions:
@@ -1741,42 +1782,6 @@ to a C/C++ source file, or vice versa. The variable
1741names. 1782names.
1742@end table 1783@end table
1743 1784
1744@node Comments in C
1745@subsection Comments in C Modes
1746
1747 C mode and related modes use a number of variables for controlling
1748comment format.
1749
1750@table @code
1751@item c-comment-only-line-offset
1752@vindex c-comment-only-line-offset
1753Extra offset for line which contains only the start of a comment. It
1754can be either an integer or a cons cell of the form
1755@code{(@var{non-anchored-offset} . @var{anchored-offset})}, where
1756@var{non-anchored-offset} is the amount of offset given to
1757non-column-zero anchored comment-only lines, and @var{anchored-offset}
1758is the amount of offset to give column-zero anchored comment-only lines.
1759Just an integer as value is equivalent to @code{(@var{val} . 0)}.
1760
1761@item c-comment-start-regexp
1762@vindex c-comment-start-regexp
1763This buffer-local variable specifies how to recognize the start of a comment.
1764
1765@item c-hanging-comment-ender-p
1766@vindex c-hanging-comment-ender-p
1767If this variable is @code{nil}, @code{c-fill-paragraph} leaves the
1768comment terminator of a block comment on a line by itself. The default
1769value is @code{t}, which puts the comment-end delimiter @samp{*/} at the
1770end of the last line of the comment text.
1771
1772@item c-hanging-comment-starter-p
1773@vindex c-hanging-comment-starter-p
1774If this variable is @code{nil}, @code{c-fill-paragraph} leaves the
1775starting delimiter of a block comment on a line by itself. The default
1776value is @code{t}, which puts the comment-start delimiter @samp{/*} at
1777the beginning of the first line of the comment text.
1778@end table
1779
1780@node Fortran 1785@node Fortran
1781@section Fortran Mode 1786@section Fortran Mode
1782@cindex Fortran mode 1787@cindex Fortran mode