* Re: Update to programs.texi for CC Mode 5.30, and incidental amendments.
[not found] <E1BKF0Z-0007LZ-Kh@fencepost.gnu.org>
@ 2004-05-15 21:51 ` Alan Mackenzie
2004-05-16 0:20 ` Thien-Thi Nguyen
0 siblings, 1 reply; 4+ messages in thread
From: Alan Mackenzie @ 2004-05-15 21:51 UTC (permalink / raw)
On Sun, 2 May 2004, Richard Stallman wrote (to me, not the list):
>Thanks for working on this. I have corrections for a few small points.
[8 corrections applied and incorporated into the attached patch.]
> ! is, then the comment on the starting line is terminated and a new
> ! comment is started on the new following line. If
>It would be nice to rewrite that as active too.
I've tried hard to do this, but failed. All my attempts come up looking
awkward and contrived, with subjects like "the function" or "C-M-j or M-j
or the the action of filling". In this paragraph, the focus must be on
"the comment" or on "comment-multi-line", and this can only really be
done with a verb in the passive voice. Setting something up as the
subject of an active verb would make that subject almost as weak as the
"It" in the sentence "It's raining.".
I'd love somebody to prove me wrong here, and reconstruct this sentence
and one or two others around it as robust active-voice sentences.
Sometimes, I think, a passive verb is the right way of expressing
something, just as sometimes a `goto' statement in C or even (dons
asbestos longjohns) a split infinitive in English prose is.
> @node Comments in C
> @subsection Comments in C Modes
> ! Here are the user options you can set to control the format of
> ! comments in C and related modes. These are all C @dfn{style
> ! variables} (@pxref{Styles,,, ccmode, the CC Mode Manual}).
>To make the Emacs manual smaller, I think we should delete this section
>entirely. The information is available in the ccmode info file.
>It's not essential for the printed Emacs manual.
DONE! I've not even put any extra reference to the CC Mode manual
anywhere, as I consider that the "*Note CC Mode ... for a more extensive
description ..." is adequate.
Here is the (amended) patch:
2004-05-15 Alan Mackenzie <acm@muc.de>
* Programs.texi: Updated for CC Mode 5.30 and incidental
amendments.
("AWK"): is consistently thus spelt throughout.
(AWK, Pike): documented as "C-like modes".
(@kbd{M-j}): documented as alternative to @kbd{C-M-j}.
(M-x man): supersedes M-x manual-entry.
Added numerous index entries. Corrected "ESC a/e" to "M-a/e".
("Comments in C"): This node has been removed, the level of detail
it once gave now being considered excessive in the Emacs manual.
(C-c., C-cC-c): 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,
....): definitions have been amended.
(c-beginning-of-defun, c-end-of-defun, c-context-line-break): new
function definitions.
(c-comment-only-line-offset): Description removed (considered
excessive)
(c-comment-start-regexp, c-hanging-comment-ender-p,
c-hanging-comment-starter-p): obsolete definitions removed.
* emacs.texi: Remove the menu entry "Comments in C".
*** emacs-1.78.texi Sat May 15 19:14:06 2004
--- emacs-1.78.acm.texi Sat May 15 19:53:20 2004
***************
*** 541,547 ****
* Hungry Delete:: A more powerful DEL command.
* Other C Commands:: Filling comments, viewing expansion of macros,
and other neat features.
- * Comments in C:: Options for customizing comment style.
Fortran Mode
--- 541,546 ----
*** programs-1.80.texi Thu Apr 22 18:36:49 2004
--- programs-1.80.acm.texi Sat May 15 21:45:24 2004
***************
*** 65,71 ****
@cindex Perl mode
@cindex Icon mode
- @cindex Awk mode
@cindex Makefile mode
@cindex Tcl mode
@cindex CPerl mode
--- 65,70 ----
***************
*** 82,88 ****
@cindex PostScript mode
The existing programming language major modes include Lisp, Scheme (a
variant of Lisp) and the Scheme-based DSSSL expression language, Ada,
! Awk, C, C++, Delphi (Object Pascal), Fortran (free format and fixed
format), Icon, IDL (CORBA), IDLWAVE, Java, Metafont (@TeX{}'s
companion for font creation), Modula2, Objective-C, Octave, Pascal,
Perl, Pike, PostScript, Prolog, Simula, Tcl, and VHDL. There is
--- 81,87 ----
@cindex PostScript mode
The existing programming language major modes include Lisp, Scheme (a
variant of Lisp) and the Scheme-based DSSSL expression language, Ada,
! AWK, C, C++, Delphi (Object Pascal), Fortran (free format and fixed
format), Icon, IDL (CORBA), IDLWAVE, Java, Metafont (@TeX{}'s
companion for font creation), Modula2, Objective-C, Octave, Pascal,
Perl, Pike, PostScript, Prolog, Simula, Tcl, and VHDL. There is
***************
*** 104,110 ****
tab character before point, in these modes.
Separate manuals are available for the modes for Ada (@pxref{Top, , Ada
! Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL
(@pxref{Top, , CC Mode, ccmode, CC Mode}) and the IDLWAVE modes
(@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}).
--- 103,109 ----
tab character before point, in these modes.
Separate manuals are available for the modes for Ada (@pxref{Top, , Ada
! Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL/Pike/AWK
(@pxref{Top, , CC Mode, ccmode, CC Mode}) and the IDLWAVE modes
(@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}).
***************
*** 446,460 ****
reindents the current line as usual, then reindents by the same amount
all the lines in the parenthetical grouping starting on the current
line. It is clever, though, and does not alter lines that start
! inside strings, or C preprocessor lines when in C mode.
@findex indent-code-rigidly
You can also perform this operation on the region, using the command
@kbd{M-x indent-code-rigidly}. It rigidly shifts all the lines in the
region sideways, like @code{indent-rigidly} does (@pxref{Indentation
Commands}). It doesn't alter the indentation of lines that start
! inside a comment or a string, unless the region starts inside that
! comment or string.
@node Lisp Indent
@subsection Customizing Lisp Indentation
--- 445,460 ----
reindents the current line as usual, then reindents by the same amount
all the lines in the parenthetical grouping starting on the current
line. It is clever, though, and does not alter lines that start
! inside strings. Neither does it alter C preprocessor lines when in C
! mode, but it does reindent any continuation lines that may be attached
! to them.
@findex indent-code-rigidly
You can also perform this operation on the region, using the command
@kbd{M-x indent-code-rigidly}. It rigidly shifts all the lines in the
region sideways, like @code{indent-rigidly} does (@pxref{Indentation
Commands}). It doesn't alter the indentation of lines that start
! inside a string, unless the region also starts inside that string.
@node Lisp Indent
@subsection Customizing Lisp Indentation
***************
*** 507,520 ****
@kindex C-M-q @r{(C mode)}
@findex c-indent-exp
Reindent each line in the balanced expression that follows point
! (@code{c-indent-exp}). A prefix argument inhibits error checking and
! warning messages about invalid syntax.
@item @key{TAB}
@findex c-indent-command
Reindent the current line, and/or in some cases insert a tab character
(@code{c-indent-command}).
If @code{c-tab-always-indent} is @code{t}, this command always reindents
the current line and does nothing else. This is the default.
--- 507,521 ----
@kindex C-M-q @r{(C mode)}
@findex c-indent-exp
Reindent each line in the balanced expression that follows point
! (@code{c-indent-exp}). A prefix argument inhibits warning messages
! about invalid syntax.
@item @key{TAB}
@findex c-indent-command
Reindent the current line, and/or in some cases insert a tab character
(@code{c-indent-command}).
+ @vindex c-tab-always-indent
If @code{c-tab-always-indent} is @code{t}, this command always reindents
the current line and does nothing else. This is the default.
***************
*** 524,531 ****
if @code{indent-tabs-mode} is @code{nil}).
Any other value (not @code{nil} or @code{t}) means always reindent the
! line, and also insert a tab if within a comment, a string, or a
! preprocessor directive.
@end table
To reindent the whole current buffer, type @kbd{C-x h C-M-\}. This
--- 525,531 ----
if @code{indent-tabs-mode} is @code{nil}).
Any other value (not @code{nil} or @code{t}) means always reindent the
! line, and also insert a tab if within a comment or a string.
@end table
To reindent the whole current buffer, type @kbd{C-x h C-M-\}. This
***************
*** 539,556 ****
@subsection Customizing C Indentation
@cindex style (for indentation)
! C mode and related modes use a simple yet flexible mechanism for
! customizing indentation. The mechanism works in two steps: first it
! classifies the line syntactically according to its contents and context;
! second, it associates each kind of syntactic construct with an
! indentation offset based on your selected @dfn{style}.
@table @kbd
! @item M-x c-set-style @key{RET} @var{style} @key{RET}
! Select predefined indentation style @var{style}.
@end table
! A style is a named collection of indentation customizations that can
be used in C mode and the related modes. Emacs comes with several
predefined styles, including @code{gnu}, @code{k&r}, @code{bsd},
@code{stroustrup}, @code{linux}, @code{python}, @code{java},
--- 539,557 ----
@subsection Customizing C Indentation
@cindex style (for indentation)
! C mode and related modes use a flexible mechanism for customizing
! indentation. C mode indents a source line in two steps: first it
! classifies the line syntactically according to its contents and
! context; second, it determines the indentation offset associated by
! your selected @dfn{style} with the syntactic construct and adds this
! onto the indentation of the @dfn{anchor statement}.
@table @kbd
! @item C-c . @key{RET} @var{style} @key{RET}
! Select a predefined style @var{style} (@code{c-set-style}).
@end table
! A @dfn{style} is a named collection of customizations that can
be used in C mode and the related modes. Emacs comes with several
predefined styles, including @code{gnu}, @code{k&r}, @code{bsd},
@code{stroustrup}, @code{linux}, @code{python}, @code{java},
***************
*** 561,579 ****
some code, e.g., by typing @key{C-M-q} at the start of a function
definition.
@findex c-set-style
! To choose a style for the current buffer, use the command @kbd{M-x
! c-set-style}. Specify a style name as an argument (case is not
! significant). This command affects the current buffer only, and it
! affects only future invocations of the indentation commands; it does
! not reindent the code in the buffer. To reindent the whole buffer in
! the new style, you can type @kbd{C-x h C-M-\}.
@vindex c-default-style
You can also set the variable @code{c-default-style} to specify the
! default style for various major modes. Its value should be an alist,
! in which each element specifies one major mode and which indentation
! style to use for it. For example,
@example
(setq c-default-style
--- 562,582 ----
some code, e.g., by typing @key{C-M-q} at the start of a function
definition.
+ @kindex C-c . @r{(C mode)}
@findex c-set-style
! To choose a style for the current buffer, use the command @kbd{C-c
! .}. Specify a style name as an argument (case is not significant).
! This command affects the current buffer only, and it affects only
! future invocations of the indentation commands; it does not reindent
! the code in the buffer. To reindent the whole buffer in the new
! style, you can type @kbd{C-x h C-M-\}.
@vindex c-default-style
You can also set the variable @code{c-default-style} to specify the
! default style for various major modes. Its value should be either the
! style's name (a string) or an alist, in which each element specifies
! one major mode and which indentation style to use for it. For
! example,
@example
(setq c-default-style
***************
*** 848,865 ****
The comment commands in this table insert, kill and align comments.
They are described in this section and following sections.
! @table @kbd
! @item M-;
Insert or realign comment on current line; alternatively, comment or
uncomment the region (@code{comment-dwim}).
! @item C-u M-;
Kill comment on current line (@code{comment-kill}).
! @item C-x ;
Set comment column (@code{comment-set-column}).
! @item C-M-j
Like @key{RET} followed by inserting and aligning a comment
(@code{comment-indent-new-line}).
! @item M-x comment-region
Add or remove comment delimiters on all the lines in the region.
@end table
--- 851,870 ----
The comment commands in this table insert, kill and align comments.
They are described in this section and following sections.
! @table @asis
! @item @kbd{M-;}
Insert or realign comment on current line; alternatively, comment or
uncomment the region (@code{comment-dwim}).
! @item @kbd{C-u M-;}
Kill comment on current line (@code{comment-kill}).
! @item @kbd{C-x ;}
Set comment column (@code{comment-set-column}).
! @item @kbd{C-M-j}
! @itemx @kbd{M-j}
Like @key{RET} followed by inserting and aligning a comment
(@code{comment-indent-new-line}).
! @item @kbd{M-x comment-region}
! @itemx @kbd{C-c C-c} (in C-like modes)
Add or remove comment delimiters on all the lines in the region.
@end table
***************
*** 937,953 ****
@subsection Multiple Lines of Comments
@kindex C-M-j
@cindex blank lines in programs
@findex comment-indent-new-line
If you are typing a comment and wish to continue it on another line,
! you can use the command @kbd{C-M-j} (@code{comment-indent-new-line}).
! This terminates the comment you are typing, creates a new blank line
! afterward, and begins a new comment indented under the old one. When
! Auto Fill mode is on, going past the fill column while typing a comment
! causes the comment to be continued in just this fashion. If point is
! not at the end of the line when @kbd{C-M-j} is typed, the text on
! the rest of the line becomes part of the new comment line.
@findex comment-region
To turn existing lines into comment lines, use the @kbd{M-x
comment-region} command. It adds comment delimiters to the lines that start
--- 942,961 ----
@subsection Multiple Lines of Comments
@kindex C-M-j
+ @kindex M-j
@cindex blank lines in programs
@findex comment-indent-new-line
If you are typing a comment and wish to continue it on another line,
! you can use the command @kbd{C-M-j} or @kbd{M-j}
! (@code{comment-indent-new-line}). This terminates the comment you are
! typing, creates a new blank line afterward, and begins a new comment
! indented under the old one. When Auto Fill mode is on, going past the
! fill column while typing a comment causes the comment to be continued
! in just this fashion. If point is not at the end of the line when you
! type the command, the text on the rest of the line becomes part of the
! new comment line.
+ @kindex C-c C-c (C mode)
@findex comment-region
To turn existing lines into comment lines, use the @kbd{M-x
comment-region} command. It adds comment delimiters to the lines that start
***************
*** 970,981 ****
@vindex comment-column
@kindex C-x ;
@findex comment-set-column
! The comment column is stored in the variable @code{comment-column}. You
! can set it to a number explicitly. Alternatively, the command @kbd{C-x ;}
! (@code{comment-set-column}) sets the comment column to the column point is
! at. @kbd{C-u C-x ;} sets the comment column to match the last comment
! before point in the buffer, and then does a @kbd{M-;} to align the
! current line's comment under the previous one.
The variable @code{comment-column} is per-buffer: setting the variable
in the normal fashion affects only the current buffer, but there is a
--- 978,990 ----
@vindex comment-column
@kindex C-x ;
@findex comment-set-column
! The @dfn{comment column}, the column at which Emacs tries to place
! comments, is stored in the variable @code{comment-column}. You can
! set it to a number explicitly. Alternatively, the command @kbd{C-x ;}
! (@code{comment-set-column}) sets the comment column to the column
! point is at. @kbd{C-u C-x ;} sets the comment column to match the
! last comment before point in the buffer, and then does a @kbd{M-;} to
! align the current line's comment under the previous one.
The variable @code{comment-column} is per-buffer: setting the variable
in the normal fashion affects only the current buffer, but there is a
***************
*** 990,996 ****
than the comment starting delimiter in the strictest sense of the word;
for example, in C mode the value of the variable is
@c This stops M-q from breaking the line inside that @code.
! @code{@w{"/\\*+ *\\|//+ *""}}, which matches extra stars and spaces
after the @samp{/*} itself, and accepts C++ style comments also.
(Note that @samp{\\} is needed in Lisp syntax to include a @samp{\} in
the string, which is needed to deny the first star its special meaning
--- 999,1005 ----
than the comment starting delimiter in the strictest sense of the word;
for example, in C mode the value of the variable is
@c This stops M-q from breaking the line inside that @code.
! @code{@w{"/\\*+ *\\|//+ *"}}, which matches extra stars and spaces
after the @samp{/*} itself, and accepts C++ style comments also.
(Note that @samp{\\} is needed in Lisp syntax to include a @samp{\} in
the string, which is needed to deny the first star its special meaning
***************
*** 1006,1026 ****
@vindex comment-padding
The variable @code{comment-padding} specifies how many spaces
! @code{comment-region} should insert on each line between the
! comment delimiter and the line's original text. The default is 1,
! to insert one space.
@vindex comment-multi-line
! The variable @code{comment-multi-line} controls how @kbd{C-M-j}
! (@code{indent-new-comment-line}) behaves when used inside a comment. If
! @code{comment-multi-line} is @code{nil}, as it normally is, then the
! comment on the starting line is terminated and a new comment is started
! on the new following line. If @code{comment-multi-line} is not
! @code{nil}, then the new following line is set up as part of the same
! comment that was found on the starting line. This is done by not
! inserting a terminator on the old line, and not inserting a starter on
! the new line. In languages where multi-line comments work, the choice
! of value for this variable is a matter of taste.
@vindex comment-indent-function
The variable @code{comment-indent-function} should contain a function
--- 1015,1037 ----
@vindex comment-padding
The variable @code{comment-padding} specifies how many spaces
! @code{comment-region} should insert on each line between the comment
! delimiter and the line's original text. The default is 1, to insert
! one space. @code{nil} means 0. Alternatively, @code{comment-padding}
! can hold the actual string to insert.
@vindex comment-multi-line
! The variable @code{comment-multi-line} controls how @kbd{C-M-j} or
! @kbd{M-j} (@code{indent-new-comment-line}) behaves when used inside a
! comment. If @code{comment-multi-line} is @code{nil}, as it normally
! is, then the comment on the starting line is terminated and a new
! comment is started on the new following line. If
! @code{comment-multi-line} is not @code{nil}, then the new following
! line is set up as part of the same comment that was found on the
! starting line. This is done by not inserting a terminator on the old
! line, and not inserting a starter on the new line. In languages where
! multi-line comments work, the choice of value for this variable is a
! matter of taste.
@vindex comment-indent-function
The variable @code{comment-indent-function} should contain a function
***************
*** 1064,1070 ****
You can also use @kbd{M-x info-lookup-file} to look for documentation
for a file name.
! This feature currently supports the modes Awk, Autoconf, Bison, C,
Emacs Lisp, LaTeX, M4, Makefile, Octave, Perl, Scheme, and Texinfo,
provided you have installed the relevant Info files, which are
typically available with the appropriate GNU package.
--- 1075,1081 ----
You can also use @kbd{M-x info-lookup-file} to look for documentation
for a file name.
! This feature currently supports the modes AWK, Autoconf, Bison, C,
Emacs Lisp, LaTeX, M4, Makefile, Octave, Perl, Scheme, and Texinfo,
provided you have installed the relevant Info files, which are
typically available with the appropriate GNU package.
***************
*** 1081,1087 ****
@findex manual-entry
You can read the man page for an operating system command, library
! function, or system call, with the @kbd{M-x manual-entry} command. It
runs the @code{man} program to format the man page; if the system
permits, it runs @code{man} asynchronously, so that you can keep on
editing while the page is being formatted. (On MS-DOS and MS-Windows
--- 1092,1098 ----
@findex manual-entry
You can read the man page for an operating system command, library
! function, or system call, with the @kbd{M-x man} command. It
runs the @code{man} program to format the man page; if the system
permits, it runs @code{man} asynchronously, so that you can keep on
editing while the page is being formatted. (On MS-DOS and MS-Windows
***************
*** 1393,1417 ****
@cindex CORBA IDL mode
@cindex Objective C mode
@cindex C++ mode
@cindex mode, Java
@cindex mode, C
@cindex mode, Objective C
@cindex mode, CORBA IDL
@cindex mode, Pike
This section gives a brief description of the special features
! available in C, C++, Objective-C, Java, CORBA IDL, and Pike modes.
(These are called ``C mode and related modes.'') @xref{Top, , CC Mode,
ccmode, CC Mode}, for a more extensive description of these modes
and their special features.
@menu
! * Motion in C:: Commands to move by C statements, etc.
! * Electric C:: Colon and other chars can automatically reindent.
! * Hungry Delete:: A more powerful DEL command.
! * Other C Commands:: Filling comments, viewing expansion of macros,
! and other neat features.
! * Comments in C:: Options for customizing comment style.
@end menu
@node Motion in C
--- 1404,1430 ----
@cindex CORBA IDL mode
@cindex Objective C mode
@cindex C++ mode
+ @cindex AWK mode
@cindex mode, Java
@cindex mode, C
+ @cindex mode, C++
@cindex mode, Objective C
@cindex mode, CORBA IDL
@cindex mode, Pike
+ @cindex mode, AWK
This section gives a brief description of the special features
! available in C, C++, Objective-C, Java, CORBA IDL, Pike and AWK modes.
(These are called ``C mode and related modes.'') @xref{Top, , CC Mode,
ccmode, CC Mode}, for a more extensive description of these modes
and their special features.
@menu
! * Motion in C:: Commands to move by C statements, etc.
! * Electric C:: Colon and other chars can automatically reindent.
! * Hungry Delete:: A more powerful DEL command.
! * Other C Commands:: Filling comments, viewing expansion of macros,
! and other neat features.
@end menu
@node Motion in C
***************
*** 1421,1435 ****
related modes.
@table @code
@item C-c C-u
@kindex C-c C-u @r{(C mode)}
@findex c-up-conditional
Move point back to the containing preprocessor conditional, leaving the
mark behind. A prefix argument acts as a repeat count. With a negative
argument, move point forward to the end of the containing
! preprocessor conditional. When going backwards, @code{#elif} is treated
! like @code{#else} followed by @code{#if}. When going forwards,
! @code{#elif} is ignored.@refill
@item C-c C-p
@kindex C-c C-p @r{(C mode)}
--- 1434,1462 ----
related modes.
@table @code
+ @item M-x c-beginning-of-defun
+ @itemx M-x c-end-of-defun
+ @findex c-beginning-of-defun
+ @findex c-end-of-defun
+ Move point to the beginning or end of the current function or
+ top-level definition. These are found by searching for the least
+ enclosing braces. (By contrast, @code{beginning-of-defun} and
+ @code{end-of-defun} search for braces in column zero.) If you are
+ editing code where the opening brace of a function isn't placed in
+ column zero, you may wish to bind @code{C-M-a} and @code{C-M-e} to
+ these commands. @xref{Moving by Defuns}.
+
@item C-c C-u
@kindex C-c C-u @r{(C mode)}
@findex c-up-conditional
Move point back to the containing preprocessor conditional, leaving the
mark behind. A prefix argument acts as a repeat count. With a negative
argument, move point forward to the end of the containing
! preprocessor conditional.
!
! @samp{#elif} is equivalent to @samp{#else} followed by @samp{#if}, so
! the function will stop at a @samp{#elif} when going backward, but not
! when going forward.
@item C-c C-p
@kindex C-c C-p @r{(C mode)}
***************
*** 1446,1472 ****
argument, move backward.
@item M-a
! @kindex ESC a
@findex c-beginning-of-statement
Move point to the beginning of the innermost C statement
(@code{c-beginning-of-statement}). If point is already at the beginning
of a statement, move to the beginning of the preceding statement. With
prefix argument @var{n}, move back @var{n} @minus{} 1 statements.
! If point is within a string or comment, or next to a comment (only
! whitespace between them), this command moves by sentences instead of
! statements.
!
! When called from a program, this function takes three optional
! arguments: the numeric prefix argument, a buffer position limit
! (don't move back before that place), and a flag that controls whether
! to do sentence motion when inside of a comment.
@item M-e
! @kindex ESC e
@findex c-end-of-statement
! Move point to the end of the innermost C statement; like @kbd{M-a}
! except that it moves in the other direction (@code{c-end-of-statement}).
@item M-x c-backward-into-nomenclature
@findex c-backward-into-nomenclature
--- 1473,1494 ----
argument, move backward.
@item M-a
! @kindex M-a (C mode)
@findex c-beginning-of-statement
Move point to the beginning of the innermost C statement
(@code{c-beginning-of-statement}). If point is already at the beginning
of a statement, move to the beginning of the preceding statement. With
prefix argument @var{n}, move back @var{n} @minus{} 1 statements.
! In comments or in strings which span more than one line, this command
! moves by sentences instead of statements.
@item M-e
! @kindex M-e (C mode)
@findex c-end-of-statement
! Move point to the end of the innermost C statement or sentence; like
! @kbd{M-a} except that it moves in the other direction
! (@code{c-end-of-statement}).
@item M-x c-backward-into-nomenclature
@findex c-backward-into-nomenclature
***************
*** 1530,1541 ****
--- 1552,1565 ----
line or adding any newlines (@code{c-scope-operator}).
@end table
+ @vindex c-electric-pound-behavior
The electric @kbd{#} key reindents the line if it appears to be the
beginning of a preprocessor directive. This happens when the value of
@code{c-electric-pound-behavior} is @code{(alignleft)}. You can turn
this feature off by setting @code{c-electric-pound-behavior} to
@code{nil}.
+ @vindex c-hanging-braces-alist
The variable @code{c-hanging-braces-alist} controls the insertion of
newlines before and after inserted braces. It is an association list
with elements of the following form: @code{(@var{syntactic-symbol}
***************
*** 1550,1555 ****
--- 1574,1580 ----
after, or both. If not found, the default is to insert a newline both
before and after braces.
+ @vindex c-hanging-colons-alist
The variable @code{c-hanging-colons-alist} controls the insertion of
newlines before and after inserted colons. It is an association list
with elements of the following form: @code{(@var{syntactic-symbol}
***************
*** 1562,1567 ****
--- 1587,1593 ----
If the syntactic symbol is not found in this list, no newlines are
inserted.
+ @vindex c-cleanup-list
Electric characters can also delete newlines automatically when the
auto-newline feature is enabled. This feature makes auto-newline more
acceptable, by deleting the newlines in the most common cases where you
***************
*** 1613,1618 ****
--- 1639,1645 ----
@node Hungry Delete
@subsection Hungry Delete Feature in C
+ @cindex hungry deletion (C Mode)
When the @dfn{hungry-delete} feature is enabled (indicated by
@samp{/h} or @samp{/ah} in the mode line after the mode name), a single
***************
*** 1642,1647 ****
--- 1669,1689 ----
@subsection Other Commands for C Mode
@table @kbd
+ @item M-x c-context-line-break
+ @findex c-context-line-break
+ This command inserts a line break and indents the new line in a manner
+ appropriate to the context. In normal code, it does the work of
+ @kbd{C-j} (@code{newline-and-indent}), in a C preprocessor line it
+ additionally inserts a @samp{\} at the line break, and within comments
+ it's like @kbd{M-j} (@code{c-indent-new-comment-line}).
+
+ @code{c-context-line-break} isn't bound to a key by default, but it
+ needs a binding to be useful. The following code will bind it to
+ @kbd{C-j}.
+ @example
+ (define-key c-mode-base-map "\C-j" 'c-context-line-break)
+ @end example
+
@item C-M-h
Put mark at the end of a function definition, and put point at the
beginning (@code{c-mark-function}).
***************
*** 1702,1707 ****
--- 1744,1750 ----
@itemx M-x global-cwarn-mode
@findex cwarn-mode
@findex global-cwarn-mode
+ @vindex global-cwarn-mode
@cindex CWarn mode
@cindex suspicious constructions in C, C++
CWarn minor mode highlights certain suspicious C and C++ constructions:
***************
*** 1739,1780 ****
to a C/C++ source file, or vice versa. The variable
@code{ff-related-file-alist} specifies how to compute related file
names.
- @end table
-
- @node Comments in C
- @subsection Comments in C Modes
-
- C mode and related modes use a number of variables for controlling
- comment format.
-
- @table @code
- @item c-comment-only-line-offset
- @vindex c-comment-only-line-offset
- Extra offset for line which contains only the start of a comment. It
- can be either an integer or a cons cell of the form
- @code{(@var{non-anchored-offset} . @var{anchored-offset})}, where
- @var{non-anchored-offset} is the amount of offset given to
- non-column-zero anchored comment-only lines, and @var{anchored-offset}
- is the amount of offset to give column-zero anchored comment-only lines.
- Just an integer as value is equivalent to @code{(@var{val} . 0)}.
-
- @item c-comment-start-regexp
- @vindex c-comment-start-regexp
- This buffer-local variable specifies how to recognize the start of a comment.
-
- @item c-hanging-comment-ender-p
- @vindex c-hanging-comment-ender-p
- If this variable is @code{nil}, @code{c-fill-paragraph} leaves the
- comment terminator of a block comment on a line by itself. The default
- value is @code{t}, which puts the comment-end delimiter @samp{*/} at the
- end of the last line of the comment text.
-
- @item c-hanging-comment-starter-p
- @vindex c-hanging-comment-starter-p
- If this variable is @code{nil}, @code{c-fill-paragraph} leaves the
- starting delimiter of a block comment on a line by itself. The default
- value is @code{t}, which puts the comment-start delimiter @samp{/*} at
- the beginning of the first line of the comment text.
@end table
@node Fortran
--- 1782,1787 ----
--
Alan Mackenzie (Munich, Germany)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Update to programs.texi for CC Mode 5.30, and incidental amendments.
2004-05-15 21:51 ` Update to programs.texi for CC Mode 5.30, and incidental amendments Alan Mackenzie
@ 2004-05-16 0:20 ` Thien-Thi Nguyen
2004-05-17 11:04 ` Richard Stallman
0 siblings, 1 reply; 4+ messages in thread
From: Thien-Thi Nguyen @ 2004-05-16 0:20 UTC (permalink / raw)
Cc: emacs-devel
Alan Mackenzie <acm@muc.de> writes:
reconstruct this sentence
here's a reconstruction that uses "Emacs", which is at least accurate,
even if not mellifluous:
@vindex comment-multi-line
The variable @code{comment-multi-line} controls how @kbd{C-M-j}
(@code{indent-new-comment-line}) behaves when used inside a comment.
Specifically, when @code{comment-multi-line} is @code{nil} (the
default value), Emacs inserts a @dfn{comment terminator}, begins a new
line, and finally inserts a @dfn{comment starter}. For a non-@code{nil}
value, Emacs omits inserting the terminator and starter, effectively
continuing the current comment across multiple lines. In languages
where multi-line comments work, the choice of value for this
variable is a matter of taste.
i put @dfn{} around the two terms i was not able to find in
programs.texi (perhaps they are @dfn{}ed properly elsewhere).
thi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Update to programs.texi for CC Mode 5.30, and incidental amendments.
2004-05-16 0:20 ` Thien-Thi Nguyen
@ 2004-05-17 11:04 ` Richard Stallman
0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2004-05-17 11:04 UTC (permalink / raw)
Cc: acm, emacs-devel
I'd prefer this way:
@vindex comment-multi-line
The variable @code{comment-multi-line} controls how @kbd{C-M-j}
(@code{indent-new-comment-line}) behaves when used inside a comment.
Specifically, when @code{comment-multi-line} is @code{nil} (the
default value), the command inserts a comment terminator, begins a new
line, and finally inserts a comment starter. Otherwise it does
not insert the terminator and starter, so it effectively
continues the current comment across multiple lines. In languages
where multi-line comments work, the choice of value for this
variable is a matter of taste.
To use @dfn here is a mistake because the text is not written so as to
define the concepts of "comment starter" and "comment terminator".
The first actual reference to these things is above, where the
variables comment-start and comment-end are defined. Perhaps that
text ought to introduce and explain the terms "comment starter" and
"comment terminator", using @dfn.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Update to programs.texi for CC Mode 5.30, and incidental amendments.
@ 2004-04-29 21:47 Alan Mackenzie
0 siblings, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2004-04-29 21:47 UTC (permalink / raw)
Hi, folks!
Partly as a response to RMS's plea from 2004/4/11:
> However, this reminds me that we need to update the Emacs Manual. I
> updated the Emacs Lisp manual myself some 6 months ago, but aside from
> Luc Teirlink who has done a lot of work, most of you have not helped me
> check it. Now it is out of print. But I don't know if I can update
> the Emacs Manual. I can barely keep up with my work, and I am injured.
, and partly since I'm the only native speaker of English on the CC Mode
team, here is a patch to programs.texi. Would somebody please check my
patch over, then commit it. Thanks.
Two comments:
(1) "AWK" is the spelling preferred by Arnold Robbins (the maintainer of
gawk) in the gawk man page, and is the form consistently used in the CC
Mode manual. A, W, and K didn't seem to have strong feelings about
capitalization in the original AWK book, and neither did anybody on
comp.lang.awk when I asked a few days ago.
(2) I raised the issue of M-j vs. C-M-j on this mailing list recently.
Since nobody replied, I've assumed it's OK to document both key sequences
in programs.texi, as I proposed.
2004-04-29 Alan Mackenzie <acm@muc.de>
* Programs.texi: Updated for CC Mode 5.30 and incidental
amendments.
("AWK"): is consistently thus spelt throughout.
(AWK, Pike): documented as "C-like modes".
(@kbd{M-j}): documented as alternative to @kbd{C-M-j}.
(M-x man): supersedes M-x manual-entry.
Added numerous index entries.
("Comments in C"): Almost wholly rewritten, due to changes in CC
Mode.
(C-c., C-cC-c): 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,
c-comment-only-line-offset, ....): definitions have been amended.
(c-beginning-of-defun, c-end-of-defun, c-context-line-break,
c-comment-only-line-offset, c-indent-comments-syntactically-p,
c-indent-comment-alist, c-block-comment-prefix,
c-comment-prefix-regexp): new function/variable definitions.
(c-comment-start-regexp, c-hanging-comment-ender-p,
c-hanging-comment-starter-p): obsolete definitions removed.
*** programs-1.80.texi Thu Apr 22 18:36:49 2004
--- programs-1.80.acm.texi Thu Apr 29 21:25:31 2004
***************
*** 65,71 ****
@cindex Perl mode
@cindex Icon mode
- @cindex Awk mode
@cindex Makefile mode
@cindex Tcl mode
@cindex CPerl mode
--- 65,70 ----
***************
*** 82,88 ****
@cindex PostScript mode
The existing programming language major modes include Lisp, Scheme (a
variant of Lisp) and the Scheme-based DSSSL expression language, Ada,
! Awk, C, C++, Delphi (Object Pascal), Fortran (free format and fixed
format), Icon, IDL (CORBA), IDLWAVE, Java, Metafont (@TeX{}'s
companion for font creation), Modula2, Objective-C, Octave, Pascal,
Perl, Pike, PostScript, Prolog, Simula, Tcl, and VHDL. There is
--- 81,87 ----
@cindex PostScript mode
The existing programming language major modes include Lisp, Scheme (a
variant of Lisp) and the Scheme-based DSSSL expression language, Ada,
! AWK, C, C++, Delphi (Object Pascal), Fortran (free format and fixed
format), Icon, IDL (CORBA), IDLWAVE, Java, Metafont (@TeX{}'s
companion for font creation), Modula2, Objective-C, Octave, Pascal,
Perl, Pike, PostScript, Prolog, Simula, Tcl, and VHDL. There is
***************
*** 104,110 ****
tab character before point, in these modes.
Separate manuals are available for the modes for Ada (@pxref{Top, , Ada
! Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL
(@pxref{Top, , CC Mode, ccmode, CC Mode}) and the IDLWAVE modes
(@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}).
--- 103,109 ----
tab character before point, in these modes.
Separate manuals are available for the modes for Ada (@pxref{Top, , Ada
! Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL/Pike/AWK
(@pxref{Top, , CC Mode, ccmode, CC Mode}) and the IDLWAVE modes
(@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}).
***************
*** 446,460 ****
reindents the current line as usual, then reindents by the same amount
all the lines in the parenthetical grouping starting on the current
line. It is clever, though, and does not alter lines that start
! inside strings, or C preprocessor lines when in C mode.
@findex indent-code-rigidly
You can also perform this operation on the region, using the command
@kbd{M-x indent-code-rigidly}. It rigidly shifts all the lines in the
region sideways, like @code{indent-rigidly} does (@pxref{Indentation
Commands}). It doesn't alter the indentation of lines that start
! inside a comment or a string, unless the region starts inside that
! comment or string.
@node Lisp Indent
@subsection Customizing Lisp Indentation
--- 445,460 ----
reindents the current line as usual, then reindents by the same amount
all the lines in the parenthetical grouping starting on the current
line. It is clever, though, and does not alter lines that start
! inside strings. Neither does it alter C preprocessor lines when in C
! mode, but it does reindent any continuation lines which may be
! attached to them.
@findex indent-code-rigidly
You can also perform this operation on the region, using the command
@kbd{M-x indent-code-rigidly}. It rigidly shifts all the lines in the
region sideways, like @code{indent-rigidly} does (@pxref{Indentation
Commands}). It doesn't alter the indentation of lines that start
! inside a string, unless the region also starts inside that string.
@node Lisp Indent
@subsection Customizing Lisp Indentation
***************
*** 507,520 ****
@kindex C-M-q @r{(C mode)}
@findex c-indent-exp
Reindent each line in the balanced expression that follows point
! (@code{c-indent-exp}). A prefix argument inhibits error checking and
! warning messages about invalid syntax.
@item @key{TAB}
@findex c-indent-command
Reindent the current line, and/or in some cases insert a tab character
(@code{c-indent-command}).
If @code{c-tab-always-indent} is @code{t}, this command always reindents
the current line and does nothing else. This is the default.
--- 507,521 ----
@kindex C-M-q @r{(C mode)}
@findex c-indent-exp
Reindent each line in the balanced expression that follows point
! (@code{c-indent-exp}). A prefix argument inhibits warning messages
! about invalid syntax.
@item @key{TAB}
@findex c-indent-command
Reindent the current line, and/or in some cases insert a tab character
(@code{c-indent-command}).
+ @vindex c-tab-always-indent
If @code{c-tab-always-indent} is @code{t}, this command always reindents
the current line and does nothing else. This is the default.
***************
*** 524,531 ****
if @code{indent-tabs-mode} is @code{nil}).
Any other value (not @code{nil} or @code{t}) means always reindent the
! line, and also insert a tab if within a comment, a string, or a
! preprocessor directive.
@end table
To reindent the whole current buffer, type @kbd{C-x h C-M-\}. This
--- 525,531 ----
if @code{indent-tabs-mode} is @code{nil}).
Any other value (not @code{nil} or @code{t}) means always reindent the
! line, and also insert a tab if within a comment or a string.
@end table
To reindent the whole current buffer, type @kbd{C-x h C-M-\}. This
***************
*** 539,556 ****
@subsection Customizing C Indentation
@cindex style (for indentation)
! C mode and related modes use a simple yet flexible mechanism for
! customizing indentation. The mechanism works in two steps: first it
! classifies the line syntactically according to its contents and context;
! second, it associates each kind of syntactic construct with an
! indentation offset based on your selected @dfn{style}.
@table @kbd
! @item M-x c-set-style @key{RET} @var{style} @key{RET}
! Select predefined indentation style @var{style}.
@end table
! A style is a named collection of indentation customizations that can
be used in C mode and the related modes. Emacs comes with several
predefined styles, including @code{gnu}, @code{k&r}, @code{bsd},
@code{stroustrup}, @code{linux}, @code{python}, @code{java},
--- 539,557 ----
@subsection Customizing C Indentation
@cindex style (for indentation)
! C mode and related modes use a flexible mechanism for customizing
! indentation. C mode indents a source line in two steps: first it
! classifies the line syntactically according to its contents and
! context; second, it determines the indentation offset associated by
! your selected @dfn{style} with the syntactic construct and adds this
! onto the indentation of the @dfn{anchor statement}.
@table @kbd
! @item C-c . @key{RET} @var{style} @key{RET}
! Select a predefined style @var{style}. (@code{c-set-style})
@end table
! A @dfn{style} is a named collection of customizations that can
be used in C mode and the related modes. Emacs comes with several
predefined styles, including @code{gnu}, @code{k&r}, @code{bsd},
@code{stroustrup}, @code{linux}, @code{python}, @code{java},
***************
*** 561,579 ****
some code, e.g., by typing @key{C-M-q} at the start of a function
definition.
@findex c-set-style
! To choose a style for the current buffer, use the command @kbd{M-x
! c-set-style}. Specify a style name as an argument (case is not
! significant). This command affects the current buffer only, and it
! affects only future invocations of the indentation commands; it does
! not reindent the code in the buffer. To reindent the whole buffer in
! the new style, you can type @kbd{C-x h C-M-\}.
@vindex c-default-style
You can also set the variable @code{c-default-style} to specify the
! default style for various major modes. Its value should be an alist,
! in which each element specifies one major mode and which indentation
! style to use for it. For example,
@example
(setq c-default-style
--- 562,582 ----
some code, e.g., by typing @key{C-M-q} at the start of a function
definition.
+ @kindex C-c . @r{(C mode)}
@findex c-set-style
! To choose a style for the current buffer, use the command @kbd{C-c
! .}. Specify a style name as an argument (case is not significant).
! This command affects the current buffer only, and it affects only
! future invocations of the indentation commands; it does not reindent
! the code in the buffer. To reindent the whole buffer in the new
! style, you can type @kbd{C-x h C-M-\}.
@vindex c-default-style
You can also set the variable @code{c-default-style} to specify the
! default style for various major modes. Its value should be either the
! style's name (a string) or an alist, in which each element specifies
! one major mode and which indentation style to use for it. For
! example,
@example
(setq c-default-style
***************
*** 848,865 ****
The comment commands in this table insert, kill and align comments.
They are described in this section and following sections.
! @table @kbd
! @item M-;
Insert or realign comment on current line; alternatively, comment or
uncomment the region (@code{comment-dwim}).
! @item C-u M-;
Kill comment on current line (@code{comment-kill}).
! @item C-x ;
Set comment column (@code{comment-set-column}).
! @item C-M-j
Like @key{RET} followed by inserting and aligning a comment
(@code{comment-indent-new-line}).
! @item M-x comment-region
Add or remove comment delimiters on all the lines in the region.
@end table
--- 851,870 ----
The comment commands in this table insert, kill and align comments.
They are described in this section and following sections.
! @table @asis
! @item @kbd{M-;}
Insert or realign comment on current line; alternatively, comment or
uncomment the region (@code{comment-dwim}).
! @item @kbd{C-u M-;}
Kill comment on current line (@code{comment-kill}).
! @item @kbd{C-x ;}
Set comment column (@code{comment-set-column}).
! @item @kbd{C-M-j}
! @itemx @kbd{M-j}
Like @key{RET} followed by inserting and aligning a comment
(@code{comment-indent-new-line}).
! @item @kbd{M-x comment-region}
! @itemx @kbd{C-c C-c} (in C-like modes)
Add or remove comment delimiters on all the lines in the region.
@end table
***************
*** 937,953 ****
@subsection Multiple Lines of Comments
@kindex C-M-j
@cindex blank lines in programs
@findex comment-indent-new-line
If you are typing a comment and wish to continue it on another line,
! you can use the command @kbd{C-M-j} (@code{comment-indent-new-line}).
! This terminates the comment you are typing, creates a new blank line
! afterward, and begins a new comment indented under the old one. When
! Auto Fill mode is on, going past the fill column while typing a comment
! causes the comment to be continued in just this fashion. If point is
! not at the end of the line when @kbd{C-M-j} is typed, the text on
! the rest of the line becomes part of the new comment line.
@findex comment-region
To turn existing lines into comment lines, use the @kbd{M-x
comment-region} command. It adds comment delimiters to the lines that start
--- 942,961 ----
@subsection Multiple Lines of Comments
@kindex C-M-j
+ @kindex M-j
@cindex blank lines in programs
@findex comment-indent-new-line
If you are typing a comment and wish to continue it on another line,
! you can use the command @kbd{C-M-j} or @kbd{M-j}
! (@code{comment-indent-new-line}). This terminates the comment you are
! typing, creates a new blank line afterward, and begins a new comment
! indented under the old one. When Auto Fill mode is on, going past the
! fill column while typing a comment causes the comment to be continued
! in just this fashion. If point is not at the end of the line when the
! command is typed, the text on the rest of the line becomes part of the
! new comment line.
+ @kindex C-c C-c (C mode)
@findex comment-region
To turn existing lines into comment lines, use the @kbd{M-x
comment-region} command. It adds comment delimiters to the lines that start
***************
*** 970,981 ****
@vindex comment-column
@kindex C-x ;
@findex comment-set-column
! The comment column is stored in the variable @code{comment-column}. You
! can set it to a number explicitly. Alternatively, the command @kbd{C-x ;}
! (@code{comment-set-column}) sets the comment column to the column point is
! at. @kbd{C-u C-x ;} sets the comment column to match the last comment
! before point in the buffer, and then does a @kbd{M-;} to align the
! current line's comment under the previous one.
The variable @code{comment-column} is per-buffer: setting the variable
in the normal fashion affects only the current buffer, but there is a
--- 978,990 ----
@vindex comment-column
@kindex C-x ;
@findex comment-set-column
! The @dfn{comment column}, the column at which Emacs tries to place
! comments, is stored in the variable @code{comment-column}. You can
! set it to a number explicitly. Alternatively, the command @kbd{C-x ;}
! (@code{comment-set-column}) sets the comment column to the column
! point is at. @kbd{C-u C-x ;} sets the comment column to match the
! last comment before point in the buffer, and then does a @kbd{M-;} to
! align the current line's comment under the previous one.
The variable @code{comment-column} is per-buffer: setting the variable
in the normal fashion affects only the current buffer, but there is a
***************
*** 990,996 ****
than the comment starting delimiter in the strictest sense of the word;
for example, in C mode the value of the variable is
@c This stops M-q from breaking the line inside that @code.
! @code{@w{"/\\*+ *\\|//+ *""}}, which matches extra stars and spaces
after the @samp{/*} itself, and accepts C++ style comments also.
(Note that @samp{\\} is needed in Lisp syntax to include a @samp{\} in
the string, which is needed to deny the first star its special meaning
--- 999,1005 ----
than the comment starting delimiter in the strictest sense of the word;
for example, in C mode the value of the variable is
@c This stops M-q from breaking the line inside that @code.
! @code{@w{"/\\*+ *\\|//+ *"}}, which matches extra stars and spaces
after the @samp{/*} itself, and accepts C++ style comments also.
(Note that @samp{\\} is needed in Lisp syntax to include a @samp{\} in
the string, which is needed to deny the first star its special meaning
***************
*** 1006,1026 ****
@vindex comment-padding
The variable @code{comment-padding} specifies how many spaces
! @code{comment-region} should insert on each line between the
! comment delimiter and the line's original text. The default is 1,
! to insert one space.
@vindex comment-multi-line
! The variable @code{comment-multi-line} controls how @kbd{C-M-j}
! (@code{indent-new-comment-line}) behaves when used inside a comment. If
! @code{comment-multi-line} is @code{nil}, as it normally is, then the
! comment on the starting line is terminated and a new comment is started
! on the new following line. If @code{comment-multi-line} is not
! @code{nil}, then the new following line is set up as part of the same
! comment that was found on the starting line. This is done by not
! inserting a terminator on the old line, and not inserting a starter on
! the new line. In languages where multi-line comments work, the choice
! of value for this variable is a matter of taste.
@vindex comment-indent-function
The variable @code{comment-indent-function} should contain a function
--- 1015,1037 ----
@vindex comment-padding
The variable @code{comment-padding} specifies how many spaces
! @code{comment-region} should insert on each line between the comment
! delimiter and the line's original text. The default is 1, to insert
! one space. @code{nil} means 0. Alternatively, @code{comment-padding}
! can hold the actual string to insert.
@vindex comment-multi-line
! The variable @code{comment-multi-line} controls how @kbd{C-M-j} or
! @kbd{M-j} (@code{indent-new-comment-line}) behaves when used inside a
! comment. If @code{comment-multi-line} is @code{nil}, as it normally
! is, then the comment on the starting line is terminated and a new
! comment is started on the new following line. If
! @code{comment-multi-line} is not @code{nil}, then the new following
! line is set up as part of the same comment that was found on the
! starting line. This is done by not inserting a terminator on the old
! line, and not inserting a starter on the new line. In languages where
! multi-line comments work, the choice of value for this variable is a
! matter of taste.
@vindex comment-indent-function
The variable @code{comment-indent-function} should contain a function
***************
*** 1064,1070 ****
You can also use @kbd{M-x info-lookup-file} to look for documentation
for a file name.
! This feature currently supports the modes Awk, Autoconf, Bison, C,
Emacs Lisp, LaTeX, M4, Makefile, Octave, Perl, Scheme, and Texinfo,
provided you have installed the relevant Info files, which are
typically available with the appropriate GNU package.
--- 1075,1081 ----
You can also use @kbd{M-x info-lookup-file} to look for documentation
for a file name.
! This feature currently supports the modes AWK, Autoconf, Bison, C,
Emacs Lisp, LaTeX, M4, Makefile, Octave, Perl, Scheme, and Texinfo,
provided you have installed the relevant Info files, which are
typically available with the appropriate GNU package.
***************
*** 1081,1087 ****
@findex manual-entry
You can read the man page for an operating system command, library
! function, or system call, with the @kbd{M-x manual-entry} command. It
runs the @code{man} program to format the man page; if the system
permits, it runs @code{man} asynchronously, so that you can keep on
editing while the page is being formatted. (On MS-DOS and MS-Windows
--- 1092,1098 ----
@findex manual-entry
You can read the man page for an operating system command, library
! function, or system call, with the @kbd{M-x man} command. It
runs the @code{man} program to format the man page; if the system
permits, it runs @code{man} asynchronously, so that you can keep on
editing while the page is being formatted. (On MS-DOS and MS-Windows
***************
*** 1393,1406 ****
@cindex CORBA IDL mode
@cindex Objective C mode
@cindex C++ mode
@cindex mode, Java
@cindex mode, C
@cindex mode, Objective C
@cindex mode, CORBA IDL
@cindex mode, Pike
This section gives a brief description of the special features
! available in C, C++, Objective-C, Java, CORBA IDL, and Pike modes.
(These are called ``C mode and related modes.'') @xref{Top, , CC Mode,
ccmode, CC Mode}, for a more extensive description of these modes
and their special features.
--- 1404,1420 ----
@cindex CORBA IDL mode
@cindex Objective C mode
@cindex C++ mode
+ @cindex AWK mode
@cindex mode, Java
@cindex mode, C
+ @cindex mode, C++
@cindex mode, Objective C
@cindex mode, CORBA IDL
@cindex mode, Pike
+ @cindex mode, AWK
This section gives a brief description of the special features
! available in C, C++, Objective-C, Java, CORBA IDL, Pike and AWK modes.
(These are called ``C mode and related modes.'') @xref{Top, , CC Mode,
ccmode, CC Mode}, for a more extensive description of these modes
and their special features.
***************
*** 1421,1435 ****
related modes.
@table @code
@item C-c C-u
@kindex C-c C-u @r{(C mode)}
@findex c-up-conditional
Move point back to the containing preprocessor conditional, leaving the
mark behind. A prefix argument acts as a repeat count. With a negative
argument, move point forward to the end of the containing
! preprocessor conditional. When going backwards, @code{#elif} is treated
! like @code{#else} followed by @code{#if}. When going forwards,
! @code{#elif} is ignored.@refill
@item C-c C-p
@kindex C-c C-p @r{(C mode)}
--- 1435,1462 ----
related modes.
@table @code
+ @item M-x c-beginning-of-defun
+ @itemx M-x c-end-of-defun
+ @findex c-beginning-of-defun
+ @findex c-end-of-defun
+ Move point to the beginning or end of the current function or
+ top-level definition. These are found by searching for the least
+ enclosing braces. (By contrast, @code{beginning-of-defun} and
+ @code{end-of-defun} search for braces in column zero.) If you are
+ editing code where the opening brace of a function isn't placed in
+ column zero, you may wish to bind @code{C-M-a} and @code{C-M-e} to
+ these commands. @xref{Moving by Defuns}.
+
@item C-c C-u
@kindex C-c C-u @r{(C mode)}
@findex c-up-conditional
Move point back to the containing preprocessor conditional, leaving the
mark behind. A prefix argument acts as a repeat count. With a negative
argument, move point forward to the end of the containing
! preprocessor conditional.
!
! @samp{#elif} is treated like @samp{#else} followed by @samp{#if}, so the
! function stops at them when going backward, but not when going forward.
@item C-c C-p
@kindex C-c C-p @r{(C mode)}
***************
*** 1447,1472 ****
@item M-a
@kindex ESC a
@findex c-beginning-of-statement
Move point to the beginning of the innermost C statement
(@code{c-beginning-of-statement}). If point is already at the beginning
of a statement, move to the beginning of the preceding statement. With
prefix argument @var{n}, move back @var{n} @minus{} 1 statements.
! If point is within a string or comment, or next to a comment (only
! whitespace between them), this command moves by sentences instead of
! statements.
!
! When called from a program, this function takes three optional
! arguments: the numeric prefix argument, a buffer position limit
! (don't move back before that place), and a flag that controls whether
! to do sentence motion when inside of a comment.
@item M-e
@kindex ESC e
@findex c-end-of-statement
! Move point to the end of the innermost C statement; like @kbd{M-a}
! except that it moves in the other direction (@code{c-end-of-statement}).
@item M-x c-backward-into-nomenclature
@findex c-backward-into-nomenclature
--- 1474,1496 ----
@item M-a
@kindex ESC a
+ @kindex M-a (C mode)
@findex c-beginning-of-statement
Move point to the beginning of the innermost C statement
(@code{c-beginning-of-statement}). If point is already at the beginning
of a statement, move to the beginning of the preceding statement. With
prefix argument @var{n}, move back @var{n} @minus{} 1 statements.
! In comments or in strings which span more than one line, this command
! moves by sentences instead of statements.
@item M-e
@kindex ESC e
+ @kindex M-e (C mode)
@findex c-end-of-statement
! Move point to the end of the innermost C statement or sentence; like
! @kbd{M-a} except that it moves in the other direction
! (@code{c-end-of-statement}).
@item M-x c-backward-into-nomenclature
@findex c-backward-into-nomenclature
***************
*** 1530,1541 ****
--- 1554,1567 ----
line or adding any newlines (@code{c-scope-operator}).
@end table
+ @vindex c-electric-pound-behavior
The electric @kbd{#} key reindents the line if it appears to be the
beginning of a preprocessor directive. This happens when the value of
@code{c-electric-pound-behavior} is @code{(alignleft)}. You can turn
this feature off by setting @code{c-electric-pound-behavior} to
@code{nil}.
+ @vindex c-hanging-braces-alist
The variable @code{c-hanging-braces-alist} controls the insertion of
newlines before and after inserted braces. It is an association list
with elements of the following form: @code{(@var{syntactic-symbol}
***************
*** 1550,1555 ****
--- 1576,1582 ----
after, or both. If not found, the default is to insert a newline both
before and after braces.
+ @vindex c-hanging-colons-alist
The variable @code{c-hanging-colons-alist} controls the insertion of
newlines before and after inserted colons. It is an association list
with elements of the following form: @code{(@var{syntactic-symbol}
***************
*** 1562,1567 ****
--- 1589,1595 ----
If the syntactic symbol is not found in this list, no newlines are
inserted.
+ @vindex c-cleanup-list
Electric characters can also delete newlines automatically when the
auto-newline feature is enabled. This feature makes auto-newline more
acceptable, by deleting the newlines in the most common cases where you
***************
*** 1613,1618 ****
--- 1641,1647 ----
@node Hungry Delete
@subsection Hungry Delete Feature in C
+ @cindex hungry deletion (C Mode)
When the @dfn{hungry-delete} feature is enabled (indicated by
@samp{/h} or @samp{/ah} in the mode line after the mode name), a single
***************
*** 1642,1647 ****
--- 1671,1691 ----
@subsection Other Commands for C Mode
@table @kbd
+ @item M-x c-context-line-break
+ @findex c-context-line-break
+ This command inserts a line break and indents the new line in a manner
+ appropriate to the context. In normal code, it does the work of
+ @kbd{C-j} (@code{newline-and-indent}), in a C preprocessor line it
+ additionally inserts a @samp{\} at the line break, and within comments
+ it's like @kbd{M-j} (@code{c-indent-new-comment-line}).
+
+ @code{c-context-line-break} isn't bound to a key by default, but it's
+ intended to be used on the @kbd{RET} key. The following code will
+ create this binding.
+ @example
+ (define-key c-mode-base-map "\C-m" 'c-context-line-break)
+ @end example
+
@item C-M-h
Put mark at the end of a function definition, and put point at the
beginning (@code{c-mark-function}).
***************
*** 1702,1707 ****
--- 1746,1752 ----
@itemx M-x global-cwarn-mode
@findex cwarn-mode
@findex global-cwarn-mode
+ @vindex gloabl-cwarn-mode
@cindex CWarn mode
@cindex suspicious constructions in C, C++
CWarn minor mode highlights certain suspicious C and C++ constructions:
***************
*** 1744,1780 ****
@node Comments in C
@subsection Comments in C Modes
! C mode and related modes use a number of variables for controlling
! comment format.
@table @code
@item c-comment-only-line-offset
@vindex c-comment-only-line-offset
! Extra offset for line which contains only the start of a comment. It
! can be either an integer or a cons cell of the form
@code{(@var{non-anchored-offset} . @var{anchored-offset})}, where
@var{non-anchored-offset} is the amount of offset given to
! non-column-zero anchored comment-only lines, and @var{anchored-offset}
! is the amount of offset to give column-zero anchored comment-only lines.
! Just an integer as value is equivalent to @code{(@var{val} . 0)}.
!
! @item c-comment-start-regexp
! @vindex c-comment-start-regexp
! This buffer-local variable specifies how to recognize the start of a comment.
!
! @item c-hanging-comment-ender-p
! @vindex c-hanging-comment-ender-p
! If this variable is @code{nil}, @code{c-fill-paragraph} leaves the
! comment terminator of a block comment on a line by itself. The default
! value is @code{t}, which puts the comment-end delimiter @samp{*/} at the
! end of the last line of the comment text.
!
! @item c-hanging-comment-starter-p
! @vindex c-hanging-comment-starter-p
! If this variable is @code{nil}, @code{c-fill-paragraph} leaves the
! starting delimiter of a block comment on a line by itself. The default
! value is @code{t}, which puts the comment-start delimiter @samp{/*} at
! the beginning of the first line of the comment text.
@end table
@node Fortran
--- 1789,1858 ----
@node Comments in C
@subsection Comments in C Modes
! Here are the user options you can set to control the format of
! comments in C and related modes. These are all C @dfn{style
! variables} (@pxref{Styles,,, ccmode, the CC Mode Manual}).
@table @code
@item c-comment-only-line-offset
@vindex c-comment-only-line-offset
! Extra offset for a line which contains only the start of a comment.
! It can be either an integer or a cons cell of the form
@code{(@var{non-anchored-offset} . @var{anchored-offset})}, where
@var{non-anchored-offset} is the amount of offset given to
! comment-only lines which start after column-zero, and
! @var{anchored-offset} is the amount of offset to give comment-only
! lines which start at column-zero. Just an integer as value is
! equivalent to @code{(@var{val} . -1000)}.
!
! @item c-indent-comments-syntactically-p
! @vindex c-indent-comments-syntactically-p
! Normally, when this variable is @code{nil}, @kbd{M-;} will indent
! comment-only lines according to @code{c-indent-comment-alist}, just as
! it does with lines where other code precedes the comments. However,
! if you want @kbd{M-;} to act just like @key{TAB} for comment-only
! lines you can get that by setting
! @code{c-indent-comments-syntactically-p} to non-@code{nil}.
!
! If @code{c-indent-comments-syntactically-p} is non-@code{nil} then
! @code{c-indent-comment-alist} won't be consulted at all for
! comment-only lines.
!
! @item c-indent-comment-alist
! @vindex c-indent-comment-alist
! This variable gives you fine control over which column @kbd{M-;}
! indents the comment to. It can depend on the preceding code and the
! indentation of a similar comment, if any, on the preceding line. It
! is an association list that maps different types of lines to actions
! describing how they should be handled. If a certain line type isn't
! present on the list then the line is indented to the column specified
! by @code{comment-column}. See the documentation string for
! @code{c-indent-comment-alist} for a full description of the available
! line types and actions (use @kbd{C-h v c-indent-comment-alist}).
!
! @item c-block-comment-prefix
! @vindex c-block-comment-prefix
! This variable is a string, and is inserted at the beginning of the new
! line created by breaking a c-style (@code{/*}) comment for the first
! time. Typically it is @code{"* "} or the empty string. It shouldn't
! contain leading spaces, since these would be overridden by the
! indentation system anyway.
!
! @item c-comment-prefix-regexp
! @vindex c-comment-prefix-regexp
! This variable contains the regexp used to recognize the @dfn{comment
! line prefix}, which is the line decoration that starts every line in a
! comment. The default is @samp{//+\\|\\**}. Several internal
! variables get initialised from @code{c-comment-prefix-regexp}, so if
! you change its value, whether in a hook or manually, you must call
! @code{(c-setup-paragraph-variables)} for your changes to take effect.
! However, this is not needed after @code{c-set-style}, which does this
! initialisation automatically.
!
! @c Of the variables which were previously described in this node,
! @c c-comment-start-regexp is now determined by CC Mode at byte-compile
! @c time; c-hanging-comment-ender-p and c-hanging-comment-starter-p no
! @c longer exist. (Alan Mackenzie <acm@muc.de>, 2004/4/29)
@end table
@node Fortran
--
Alan Mackenzie (Munich, Germany)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-05-17 11:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <E1BKF0Z-0007LZ-Kh@fencepost.gnu.org>
2004-05-15 21:51 ` Update to programs.texi for CC Mode 5.30, and incidental amendments Alan Mackenzie
2004-05-16 0:20 ` Thien-Thi Nguyen
2004-05-17 11:04 ` Richard Stallman
2004-04-29 21:47 Alan Mackenzie
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).