@c This is part of the Emacs manual.
-@c Copyright (C) 1985,86,87,93,94,95,97,99,00,2001 Free Software Foundation, Inc.
+@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1999, 2000,
+@c 2001, 2005 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Programs, Building, Text, Top
@chapter Editing Programs
Apply the usual indentation conventions of the language
(@pxref{Program Indent}).
@item
-Insert, kill or align comments (@pxref{Comments}).
-@item
Balance parentheses (@pxref{Parentheses}).
@item
+Insert, kill or align comments (@pxref{Comments}).
+@item
Highlight program syntax (@pxref{Font Lock}).
@end itemize
* Defuns:: Commands to operate on major top-level parts
of a program.
* Program Indent:: Adjusting indentation to show the nesting.
-* Comments:: Inserting, killing, and aligning comments.
* Parentheses:: Commands that operate on parentheses.
+* Comments:: Inserting, killing, and aligning comments.
* Documentation:: Getting documentation of functions you plan to call.
* Hideshow:: Displaying blocks selectively.
* Symbol Completion:: Completion on symbol names of your program or language.
@cindex Perl mode
@cindex Icon mode
-@cindex Awk mode
@cindex Makefile mode
@cindex Tcl mode
@cindex CPerl mode
@cindex Metafont mode
@cindex Modula2 mode
@cindex Prolog mode
+@cindex Python mode
@cindex Simula mode
@cindex VHDL mode
@cindex M4 mode
@cindex Shell-script mode
@cindex Delphi mode
@cindex PostScript mode
+@cindex Conf mode
+@cindex DNS 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
+ASM, 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
-also a major mode for makefiles, called Makefile mode. An alternative
-mode for Perl is called CPerl mode. Modes are available for the
-scripting languages of the common GNU and Unix shells, VMS DCL, and
+Perl, Pike, PostScript, Prolog, Python, Simula, Tcl, and VHDL. An
+alternative mode for Perl is called CPerl mode. Modes are available for
+the scripting languages of the common GNU and Unix shells, VMS DCL, and
MS-DOS/MS-Windows @samp{BAT} files. There are also major modes for
-editing various sorts of configuration files.
+editing makefiles, DNS master files, and various sorts of configuration
+files.
@kindex DEL @r{(programming modes)}
@findex c-electric-backspace
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
+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}).
")
@end example
+ To help you catch violations of this convention, Font Lock mode
+highlights confusing opening delimiters (those that ought to be
+quoted) in bold red.
+
In the earliest days, the original Emacs found defuns by moving
upward a level of parentheses or braces until there were no more
levels to go up. This always required scanning all the way back to
defun. This is the easiest way to get ready to kill the defun in
order to move it to a different place in the file. If you use the
command while point is between defuns, it uses the following defun.
+Successive uses of @kbd{C-M-h}, or using it in Transient Mark mode
+when the mark is active, includes an additional defun in the region
+each time.
In C mode, @kbd{C-M-h} runs the function @code{c-mark-function},
which is almost the same as @code{mark-defun}; the difference is that
@vindex which-func-modes
To enable (or disable) Which Function mode, use the command @kbd{M-x
which-function-mode}. This command is global; it applies to all
-buffers, both existing ones and those yet to be created. However,
-it only takes effect in certain major modes, those listed in the value of
-@code{which-func-modes}. If the value is @code{t}, then Which
-Function mode applies to all major modes that know how to support
-it---in other words, all the major modes that support Imenu.
+buffers, both existing ones and those yet to be created. However, it
+takes effect only in certain major modes, those listed in the value of
+@code{which-func-modes}. If the value is @code{t}, then Which Function
+mode applies to all major modes that know how to support it---in other
+words, all the major modes that support Imenu.
@node Program Indent
@section Indentation for Programs
The basic indentation command is @key{TAB}, which gives the current line
the correct indentation as determined from the previous lines. The
function that @key{TAB} runs depends on the major mode; it is
-@code{indent-for-tab-command}
+@code{lisp-indent-line}
in Lisp mode, @code{c-indent-command} in C mode, etc. These functions
understand the syntax and conventions of different languages, but they all do
conceptually the same job: @key{TAB} in any programming-language major mode
that whitespace; otherwise, @key{TAB} keeps point fixed with respect to
the characters around it.
- Use @kbd{C-q @key{TAB}} to insert a tab at point.
+ Use @kbd{C-q @key{TAB}} to insert a tab character at point.
@kindex C-j
@findex newline-and-indent
followed by a @key{TAB}. @kbd{C-j} at the end of a line creates a
blank line and then gives it the appropriate indentation.
- @key{TAB} indents lines that start within a parenthetical grouping
-each under the preceding line (or the text after the parenthesis).
-Therefore, if you manually give one of these lines a nonstandard
-indentation, the lines below will tend to follow it. This behavior is
-convenient in cases where you have overridden the standard result of
-@key{TAB} because you find it unaesthetic for a particular line.
+ @key{TAB} indents a line that starts within a parenthetical grouping
+under the preceding line within the grouping, or the text after the
+parenthesis. Therefore, if you manually give one of these lines a
+nonstandard indentation, the lines below will tend to follow it. This
+behavior is convenient in cases where you have overridden the standard
+result of @key{TAB} because you find it unaesthetic for a particular
+line.
Remember that an open-parenthesis, open-brace or other opening delimiter
at the left margin is assumed by Emacs (including the indentation routines)
@table @kbd
@item C-M-q
-Reindent all the lines within one parenthetical grouping(@code{indent-sexp}).
+Reindent all the lines within one parenthetical grouping (@code{indent-pp-sexp}).
@item C-M-\
Reindent all lines in the region (@code{indent-region}).
@item C-u @key{TAB}
@end table
@kindex C-M-q
-@findex indent-sexp
+@findex indent-pp-sexp
You can reindent the contents of a single parenthetical grouping by
positioning point before the beginning of it and typing @kbd{C-M-q}
-(@code{indent-sexp} in Lisp mode, @code{c-indent-exp} in C mode; also
+(@code{indent-pp-sexp} in Lisp mode, @code{c-indent-exp} in C mode; also
bound to other suitable commands in other modes). The indentation of
-the line where the grouping starts is not changed; therefore, this
+the line where the grouping starts is not changed; therefore this
changes only the relative indentation within the grouping, not its
overall indentation. To correct that as well, type @key{TAB} first.
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.
+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 comment or a string, unless the region starts inside that
-comment or string.
+inside a string, unless the region also starts inside that string.
+The prefix arg specifies the number of columns to indent.
@node Lisp Indent
@subsection Customizing Lisp Indentation
@cindex @code{lisp-indent-function} property
You can override the standard pattern in various ways for individual
-functions, according to the @code{lisp-indent-function} property of the
-function name. There are four possibilities for this property:
-
-@table @asis
-@item @code{nil}
-This is the same as no property---use the standard indentation pattern.
-@item @code{defun}
-Handle this function like a @samp{def} construct: treat the second
-line as the start of a @dfn{body}.
-@item a number, @var{number}
-The first @var{number} arguments of the function are
-@dfn{distinguished} arguments; the rest are considered the body
-of the expression. A line in the expression is indented according to
-whether the first argument on it is distinguished or not. If the
-argument is part of the body, the line is indented @code{lisp-body-indent}
-more columns than the open-parenthesis starting the containing
-expression. If the argument is distinguished and is either the first
-or second argument, it is indented @emph{twice} that many extra columns.
-If the argument is distinguished and not the first or second argument,
-the line uses the standard pattern.
-@item a symbol, @var{symbol}
-@var{symbol} should be a function name; that function is called to
-calculate the indentation of a line within this expression. The
-function receives two arguments:
-@table @asis
-@item @var{state}
-The value returned by @code{parse-partial-sexp} (a Lisp primitive for
-indentation and nesting computation) when it parses up to the
-beginning of this line.
-@item @var{pos}
-The position at which the line being indented begins.
-@end table
-@noindent
-It should return either a number, which is the number of columns of
-indentation for that line, or a list whose car is such a number. The
-difference between returning a number and returning a list is that a
-number says that all following lines at the same nesting level should
-be indented just like this one; a list says that following lines might
-call for different indentations. This makes a difference when the
-indentation is being computed by @kbd{C-M-q}; if the value is a
-number, @kbd{C-M-q} need not recalculate indentation for the following
-lines until the end of the list.
-@end table
+functions, according to the @code{lisp-indent-function} property of
+the function name. Normally you would use this for macro definitions
+and specify it using the @code{declare} construct (@pxref{Defining
+Macros,,, elisp, the Emacs Lisp Reference Manual}).
@node C Indent
@subsection Commands for C Indentation
@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.
+(@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.
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.
+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
@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}.
+ 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 M-x c-set-style @key{RET} @var{style} @key{RET}
-Select predefined indentation style @var{style}.
+@item C-c . @key{RET} @var{style} @key{RET}
+Select a predefined style @var{style} (@code{c-set-style}).
@end table
- A style is a named collection of indentation customizations that can
+ 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},
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{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-\}.
+ 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 an alist,
-in which each element specifies one major mode and which indentation
-style to use for it. For example,
+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
@noindent
specifies an explicit choice for Java mode, and the default @samp{gnu}
-style for the other C-like modes. This variable takes effect when you
-select one of the C-like major modes; thus, if you specify a new
-default style for Java mode, you can make it take effect in an
-existing Java mode buffer by typing @kbd{M-x java-mode} there.
+style for the other C-like modes. (These settings are actually the
+defaults.) This variable takes effect when you select one of the
+C-like major modes; thus, if you specify a new default style for Java
+mode, you can make it take effect in an existing Java mode buffer by
+typing @kbd{M-x java-mode} there.
The @code{gnu} style specifies the formatting recommended by the GNU
Project for C; it is the default, so as to encourage use of our
@item C-M-f
Move forward over a balanced expression (@code{forward-sexp}).
@item C-M-b
-Move backward over a balanced expression(@code{backward-sexp}).
+Move backward over a balanced expression (@code{backward-sexp}).
@item C-M-k
Kill balanced expression forward (@code{kill-sexp}).
-@item C-M-@key{DEL}
-Kill balanced expression backward (@code{backward-kill-sexp}).
@item C-M-t
Transpose expressions (@code{transpose-sexps}).
@item C-M-@@
+@itemx C-M-@key{SPC}
Put mark after following expression (@code{mark-sexp}).
@end table
@cindex killing expressions
@kindex C-M-k
@findex kill-sexp
-@kindex C-M-DEL
-@findex backward-kill-sexp
Killing a whole balanced expression can be done with @kbd{C-M-k}
-(@code{kill-sexp}) or @kbd{C-M-@key{DEL}} (@code{backward-kill-sexp}).
-@kbd{C-M-k} kills the characters that @kbd{C-M-f} would move over, and
-@kbd{C-M-@key{DEL}} kills the characters that @kbd{C-M-b} would move
-over. On some machines, @kbd{C-M-@key{DEL}} typed on the console is a
-command to reboot; when that is so, you cannot use it as an Emacs
-command. This conflict is rare, though: usually the @key{DEL} key for
-Emacs is really @key{BACKSPACE}, and the reboot command is
-@kbd{C-M-@key{DELETE}}, so there is no conflict.
+(@code{kill-sexp}). @kbd{C-M-k} kills the characters that @kbd{C-M-f}
+would move over.
@cindex transposition of expressions
@kindex C-M-t
at or after point and the mark.
@kindex C-M-@@
+@kindex C-M-@key{SPC}
@findex mark-sexp
To set the region around the next balanced expression in the buffer,
use @kbd{C-M-@@} (@code{mark-sexp}), which sets mark at the same place
that @kbd{C-M-f} would move to. @kbd{C-M-@@} takes arguments like
@kbd{C-M-f}. In particular, a negative argument is useful for putting
-the mark at the beginning of the previous balanced expression.
+the mark at the beginning of the previous balanced expression. The
+alias @kbd{C-M-@key{SPC}} is equivalent to @kbd{C-M-@@}. If you use
+this command repeatedly, or in Transient Mark mode whenever the mark
+is active, it extends the region by one sexp each time.
In languages that use infix operators, such as C, it is not possible
to recognize all balanced expressions as such because there can be
@item C-M-n
Move forward over a parenthetical group (@code{forward-list}).
@item C-M-p
-Move backward over a parenthetical group(@code{backward-list}).
+Move backward over a parenthetical group (@code{backward-list}).
@item C-M-u
Move up in parenthesis structure (@code{backward-up-list}).
@item C-M-d
@vindex blink-matching-paren
@vindex blink-matching-paren-distance
@vindex blink-matching-delay
- Three variables control parenthesis match display.
-@code{blink-matching-paren} turns the feature on or off: @code{nil}
+ Three variables control parenthesis match display:
+
+ @code{blink-matching-paren} turns the feature on or off: @code{nil}
disables it, but the default is @code{t} to enable match display.
@code{blink-matching-delay} says how many seconds to leave the
@cindex comments
Because comments are such an important part of programming, Emacs
-provides special commands for editing and inserting comments.
+provides special commands for editing and inserting comments. It can
+also do spell checking on comments with Flyspell Prog mode
+(@pxref{Spelling}).
@menu
* Comment Commands:: Inserting, killing, and indenting comments.
The comment commands in this table insert, kill and align comments.
They are described in this section and following sections.
-@table @kbd
-@item M-;
+@table @asis
+@item @kbd{M-;}
Insert or realign comment on current line; alternatively, comment or
uncomment the region (@code{comment-dwim}).
-@item C-u M-;
+@item @kbd{C-u M-;}
Kill comment on current line (@code{comment-kill}).
-@item C-x ;
+@item @kbd{C-x ;}
Set comment column (@code{comment-set-column}).
-@item C-M-j
+@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 M-x comment-region
+@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
@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} (@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.
-
+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
@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 @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
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
+@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
@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{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}
-(@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.
+(@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 that allow
+multi-line comments, 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
@findex info-lookup-symbol
@findex info-lookup-file
-@kindex C-h C-i
+@kindex C-h S
For C, Lisp, and other languages that have documentation in Info,
-you can use @kbd{C-h C-i} (@code{info-lookup-symbol}) to view the Info
-documentation for a symbol. You specify the symbol with the
-minibuffer; the default is the symbol appearing in the buffer at
-point.
+you can use @kbd{C-h S} (@code{info-lookup-symbol}) to view the Info
+documentation for a symbol used in the program. You specify the
+symbol with the minibuffer; the default is the symbol appearing in the
+buffer at point. For example, in C mode this looks for the symbol in
+the C Library Manual.
The major mode determines where to look for documentation for the
symbol---which Info files to look in, and which indices to search.
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,
+ 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.
@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
+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
program.}. Unlike @kbd{M-x man}, it does not run any external
programs to format and display the man pages; instead it does the job
in Emacs Lisp, so it works on systems such as MS-Windows, where the
-@code{man} program (and the other programs it uses) are not generally
+@code{man} program (and other programs it uses) are not generally
available.
@kbd{M-x woman} prompts for a name of a manual page, and provides
mode constantly displays in the echo area the argument list for the
function being called at point. (In other words, it finds the
function call that point is contained in, and displays the argument
-list of that function.) Eldoc mode applies in Emacs Lisp and Lisp
-Interaction modes only. Use the command @kbd{M-x eldoc-mode} to
+list of that function.) If point is over a documented variable, it
+shows the variable's docstring. Eldoc mode applies in Emacs Lisp and
+Lisp Interaction modes only. Use the command @kbd{M-x eldoc-mode} to
enable or disable this feature.
@node Hideshow
@item C-c @@ C-s
Show the current block (@code{hs-show-block}).
@item C-c @@ C-c
-Either hide or show the current block (@code{hs-toggle-hiding})
+Either hide or show the current block (@code{hs-toggle-hiding}).
@item S-Mouse-2
-Either hide or show the block you click on (@code{hs-mouse-toggle-hiding})
+Either hide or show the block you click on (@code{hs-mouse-toggle-hiding}).
@item C-c @@ C-M-h
Hide all top-level blocks (@code{hs-hide-all}).
@item C-c @@ C-M-s
@vindex hs-hide-comments-when-hiding-all
@vindex hs-isearch-open
@vindex hs-special-modes-alist
- These user options exist for customizing Hideshow mode.
+ These variables exist for customizing Hideshow mode.
@table @code
@item hs-hide-comments-when-hiding-all
@item hs-isearch-open
Specifies what kind of hidden blocks to open in Isearch mode.
-The value should be one of these four symbols.
+The value should be one of these four symbols:
@table @code
@item code
The character @kbd{M-@key{TAB}} runs a command to complete the
partial symbol before point against the set of meaningful symbol
names. This command inserts at point any additional characters that
-it can determine from the partial name.
+it can determine from the partial name. (If your window manager
+defines @kbd{M-@key{TAB}} to switch windows, you can type
+@kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i}.)
If the partial name in the buffer has multiple possible completions
that differ in the very next character, so that it is impossible to
command @kbd{M-x glasses-mode} to enable or disable the mode in the
current buffer; you can also add @code{glasses-mode} to the mode hook
of the programming language major modes in which you normally want
-to use Glasses mode.
+to use Glasses mode.
@node Misc for Programs
@section Other Features Useful for Editing Programs
@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, 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
+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.
-* Comments in C:: Options for customizing comment style.
+* 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
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. When going backwards, @code{#elif} is treated
-like @code{#else} followed by @code{#if}. When going forwards,
-@code{#elif} is ignored.@refill
+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)}
argument, move backward.
@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.
-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.
+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; like @kbd{M-a}
-except that it moves in the other direction (@code{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
In C mode and related modes, certain printing characters are
``electric''---in addition to inserting themselves, they also reindent
-the current line and may insert newlines. This feature is controlled by
-the variable @code{c-auto-newline}. The ``electric'' characters are
-@kbd{@{}, @kbd{@}}, @kbd{:}, @kbd{#}, @kbd{;}, @kbd{,}, @kbd{<},
-@kbd{>}, @kbd{/}, @kbd{*}, @kbd{(}, and @kbd{)}.
+the current line, and optionally also insert newlines. The
+``electric'' characters are @kbd{@{}, @kbd{@}}, @kbd{:}, @kbd{#},
+@kbd{;}, @kbd{,}, @kbd{<}, @kbd{>}, @kbd{/}, @kbd{*}, @kbd{(}, and
+@kbd{)}.
Electric characters insert newlines only when the @dfn{auto-newline}
feature is enabled (indicated by @samp{/a} in the mode line after the
@table @kbd
@item C-c :
+@ifinfo
@c This uses ``colon'' instead of a literal `:' because Info cannot
@c cope with a `:' in a menu
@kindex C-c @key{colon} @r{(C mode)}
+@end ifinfo
+@ifnotinfo
+@kindex C-c : @r{(C mode)}
+@end ifnotinfo
@findex c-scope-operator
Insert a double colon scope operator at point, without reindenting the
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}
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}
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
@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
@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}).
@findex c-show-syntactic-information
@kindex C-c C-s @r{(C mode)}
Display the syntactic information about the current source line
-(@code{c-show-syntactic-information}). This is the information that
-directs how the line is indented.
+(@code{c-show-syntactic-information}). This information directs how
+the line is indented.
@item M-x cwarn-mode
@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:
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
@section Fortran Mode
@cindex Fortran mode
@cindex mode, Fortran
- Fortran mode provides special motion commands for Fortran statements and
-subprograms, and indentation commands that understand Fortran conventions
-of nesting, line numbers and continuation statements. Fortran mode has
-its own Auto Fill mode that breaks long lines into proper Fortran
-continuation lines.
+ Fortran mode provides special motion commands for Fortran statements
+and subprograms, and indentation commands that understand Fortran
+conventions of nesting, line numbers and continuation statements.
+Fortran mode has support for Auto Fill mode that breaks long lines into
+proper Fortran continuation lines.
Special commands for comments are provided because Fortran comments
are unlike those of other languages. Built-in abbrevs optionally save
@cindex Fortran77 and Fortran90
@findex f90-mode
@findex fortran-mode
- Fortan mode is meant for editing Fortran77 ``fixed format'' source
-code. For editing the modern Fortran90 ``free format'' source code,
-use F90 mode (@code{f90-mode}). Emacs normally uses Fortran mode for
-files with extension @samp{.f}, @samp{.F} or @samp{.for}, and F90 mode
-for the extension @samp{.f90}. GNU Fortran supports both kinds of
-format.
+ Fortran mode is meant for editing Fortran77 ``fixed format'' (and also
+``tab format'') source code. For editing the modern Fortran90 or
+Fortran95 ``free format'' source code, use F90 mode (@code{f90-mode}).
+Emacs normally uses Fortran mode for files with extension @samp{.f},
+@samp{.F} or @samp{.for}, and F90 mode for the extension @samp{.f90} and
+@samp{.f95}. GNU Fortran supports both kinds of format.
@menu
* Motion: Fortran Motion. Moving point by statements or subprograms.
* Indent: Fortran Indent. Indentation commands for Fortran.
* Comments: Fortran Comments. Inserting and aligning comments.
-* Autofill: Fortran Autofill. Auto fill minor mode for Fortran.
+* Autofill: Fortran Autofill. Auto fill support for Fortran.
* Columns: Fortran Columns. Measuring columns for valid Fortran.
* Abbrev: Fortran Abbrev. Built-in abbrevs for Fortran keywords.
@end menu
@subsection Motion Commands
In addition to the normal commands for moving by and operating on
-``defuns'' (Fortran subprograms---functions and subroutines), Fortran
-mode provides special commands to move by statements.
+``defuns'' (Fortran subprograms---functions and subroutines, as well as
+modules for F90 mode), Fortran mode provides special commands to move by
+statements.
@table @kbd
@kindex C-c C-n @r{(Fortran mode)}
@findex fortran-next-statement
+@findex f90-next-statement
@item C-c C-n
-Move to beginning of current or next statement
-(@code{fortran-next-statement}).
+Move to the beginning of the next statement
+(@code{fortran-next-statement}/@code{f90-next-statement}).
@kindex C-c C-p @r{(Fortran mode)}
@findex fortran-previous-statement
+@findex f90-previous-statement
@item C-c C-p
-Move to beginning of current or previous statement
-(@code{fortran-previous-statement}).
+Move to the beginning of the previous statement
+(@code{fortran-previous-statement}/@code{f90-previous-statement}).
+If there is no previous statement (i.e. if called from the first
+statement in the buffer), move to the start of the buffer.
+
+@kindex C-c C-e @r{(F90 mode)}
+@findex f90-next-block
+@item C-c C-e
+Move point forward to the start of the next code block
+(@code{f90-next-block}). A code block is a subroutine,
+@code{if}--@code{endif} statement, and so forth. This command exists
+for F90 mode only, not Fortran mode. With a numeric argument, this
+moves forward that many blocks.
+
+@kindex C-c C-a @r{(F90 mode)}
+@findex f90-previous-block
+@item C-c C-a
+Move point backward to the previous code block
+(@code{f90-previous-block}). This is like @code{f90-next-block}, but
+moves backwards.
+
+@kindex C-M-n @r{(F90 mode)}
+@findex f90-end-of-block
+@item C-M-n
+Move to the end of the current code block (@code{f90-end-of-block}).
+This is for F90 mode only. With a numeric agument, move forward that
+number of blocks. This command checks for consistency of block types
+and labels (if present), but it does not check the outermost block
+since that may be incomplete. The mark is set before moving point.
+
+@kindex C-M-p @r{(F90 mode)}
+@findex f90-beginning-of-block
+@item C-M-p
+Move to the start of the current code block
+(@code{f90-beginning-of-block}). This is like @code{f90-end-of-block},
+but moves backwards.
@end table
@node Fortran Indent
Special commands and features are needed for indenting Fortran code in
order to make sure various syntactic entities (line numbers, comment line
indicators and continuation line flags) appear in the columns that are
-required for standard Fortran.
+required for standard, fixed (or tab) format Fortran.
@menu
* Commands: ForIndent Commands. Commands for indenting and filling Fortran.
@table @kbd
@item C-M-j
-Break the current line and set up a continuation line
+Break the current line at point and set up a continuation line
(@code{fortran-split-line}).
@item M-^
Join this line to the previous line (@code{fortran-join-line}).
@cindex Fortran continuation lines
@vindex fortran-continuation-string
- Most modern Fortran compilers allow two ways of writing continuation
-lines. If the first non-space character on a line is in column 5, then
-that line is a continuation of the previous line. We call this
-@dfn{fixed format}. (In GNU Emacs we always count columns from 0.) The
-variable @code{fortran-continuation-string} specifies what character to
-put on column 5. A line that starts with a tab character followed by
-any digit except @samp{0} is also a continuation line. We call this
-style of continuation @dfn{tab format}.
+ Most Fortran77 compilers allow two ways of writing continuation lines.
+If the first non-space character on a line is in column 5, then that
+line is a continuation of the previous line. We call this @dfn{fixed
+format}. (In GNU Emacs we always count columns from 0; but note that
+the Fortran standard counts from 1.) The variable
+@code{fortran-continuation-string} specifies what character to put in
+column 5. A line that starts with a tab character followed by any digit
+except @samp{0} is also a continuation line. We call this style of
+continuation @dfn{tab format}. (Fortran90 introduced ``free format'',
+with another style of continuation lines).
@vindex indent-tabs-mode @r{(Fortran mode)}
- Fortran mode can make either style of continuation line, but you
-must specify which one you prefer. The value of the variable
-@code{indent-tabs-mode} controls the choice: @code{nil} for fixed
-format, and non-@code{nil} for tab format. You can tell which style
-is presently in effect by the presence or absence of the string
-@samp{Tab} in the mode line.
-
- If the text on a line starts with the conventional Fortran
-continuation marker @samp{$}, or if it begins with any non-whitespace
-character in column 5, Fortran mode treats it as a continuation line.
-When you indent a continuation line with @key{TAB}, it converts the line
-to the current continuation style. When you split a Fortran statement
-with @kbd{C-M-j}, the continuation marker on the newline is created
-according to the continuation style.
+@vindex fortran-analyze-depth
+@vindex fortran-tab-mode-default
+@vindex fortran-tab-mode-string
+ Fortran mode can use either style of continuation line. When you
+enter Fortran mode, it tries to deduce the proper continuation style
+automatically from the buffer contents. It does this by scanning up to
+@code{fortran-analyze-depth} (default 100) lines from the start of the
+buffer. The first line that begins with either a tab character or six
+spaces determines the choice. If the scan fails (for example, if the
+buffer is new and therefore empty), the value of
+@code{fortran-tab-mode-default} (@code{nil} for fixed format, and
+non-@code{nil} for tab format) is used. You can tell which style is
+presently in effect by the presence or absence of the string specified
+by @code{fortran-tab-mode-string} (default @samp{/t}) in the mode line.
+Fortran mode sets the value of @code{indent-tabs-mode} accordingly
+(@pxref{Just Spaces}).
+
+@vindex fortran-continuation-string
+ If the text on a line starts with the Fortran continuation marker
+specified by @code{fortran-continuation-string} (conventionally
+@samp{$}), or if it begins with any non-whitespace character in column
+5, Fortran mode treats it as a continuation line. When you indent a
+continuation line with @key{TAB}, it converts the line to the current
+continuation style. When you split a Fortran statement with
+@kbd{C-M-j}, the continuation marker on the newline is created according
+to the continuation style.
The setting of continuation style affects several other aspects of
editing in Fortran mode. In fixed format mode, the minimum column
column number for the statement body is 8, and the whitespace before
column 8 must always consist of one tab character.
-@vindex fortran-tab-mode-default
-@vindex fortran-analyze-depth
- When you enter Fortran mode for an existing file, it tries to deduce the
-proper continuation style automatically from the file contents. The first
-line that begins with either a tab character or six spaces determines the
-choice. The variable @code{fortran-analyze-depth} specifies how many lines
-to consider (at the beginning of the file); if none of those lines
-indicates a style, then the variable @code{fortran-tab-mode-default}
-specifies the style. If it is @code{nil}, that specifies fixed format, and
-non-@code{nil} specifies tab format.
-
@node ForIndent Num
@subsubsection Line Numbers
@vindex fortran-line-number-indent
Line numbers of four digits or less are normally indented one space.
The variable @code{fortran-line-number-indent} controls this; it
-specifies the maximum indentation a line number can have. Line numbers
-are indented to right-justify them to end in column 4 unless that would
-require more than this maximum indentation. The default value of the
-variable is 1.
+specifies the maximum indentation a line number can have. The default
+value of the variable is 1. Fortran mode tries to prevent line number
+digits passing column 4, reducing the indentation below the specified
+maximum if necessary. If @code{fortran-line-number-indent} has the
+value 5, line numbers are right-justified to end in column 4.
@vindex fortran-electric-line-number
Simply inserting a line number is enough to indent it according to
these rules. As each digit is inserted, the indentation is recomputed.
To turn off this feature, set the variable
-@code{fortran-electric-line-number} to @code{nil}. Then inserting line
-numbers is like inserting anything else.
+@code{fortran-electric-line-number} to @code{nil}.
+
@node ForIndent Conv
@subsubsection Syntactic Conventions
@item fortran-if-indent
Extra indentation within each level of @samp{if} statement (default 3).
-This value is also used for extra indentation within each level of the
-Fortran 90 @samp{where} statement.
@item fortran-structure-indent
-Extra indentation within each level of @samp{structure}, @samp{union}, or
-@samp{map} statements (default 3).
+Extra indentation within each level of @samp{structure}, @samp{union},
+@samp{map}, or @samp{interface} statements (default 3).
@item fortran-continuation-indent
Extra indentation for bodies of continuation lines (default 5).
@item fortran-check-all-num-for-matching-do
-If this is @code{nil}, indentation assumes that each @samp{do} statement
-ends on a @samp{continue} statement. Therefore, when computing
-indentation for a statement other than @samp{continue}, it can save time
-by not checking for a @samp{do} statement ending there. If this is
-non-@code{nil}, indenting any numbered statement must check for a
-@samp{do} that ends there. The default is @code{nil}.
+In Fortran77, a numbered @samp{do} statement is ended by any statement
+with a matching line number. It is common (but not compulsory) to use a
+@samp{continue} statement for this purpose. If this variable has a
+non-@code{nil} value, indenting any numbered statement must check for a
+@samp{do} that ends there. If you always end @samp{do} statements with
+a @samp{continue} line (or if you use the more modern @samp{enddo}),
+then you can speed up indentation by setting this variable to
+@code{nil}. The default is @code{nil}.
@item fortran-blink-matching-if
-If this is @code{t}, indenting an @samp{endif} statement moves the
-cursor momentarily to the matching @samp{if} statement to show where it
-is. The default is @code{nil}.
+If this is @code{t}, indenting an @samp{endif} (or @samp{enddo}
+statement moves the cursor momentarily to the matching @samp{if} (or
+@samp{do}) statement to show where it is. The default is @code{nil}.
@item fortran-minimum-statement-indent-fixed
-Minimum indentation for fortran statements when using fixed format
+Minimum indentation for Fortran statements when using fixed format
continuation line style. Statement bodies are never indented less than
this much. The default is 6.
@item fortran-minimum-statement-indent-tab
-Minimum indentation for fortran statements for tab format continuation line
+Minimum indentation for Fortran statements for tab format continuation line
style. Statement bodies are never indented less than this much. The
default is 8.
@end table
+The variables controlling the indentation of comments are described in
+a separate section (@pxref{Fortran Comments}).
+
+
@node Fortran Comments
@subsection Fortran Comments
- The usual Emacs comment commands assume that a comment can follow a line
-of code. In Fortran, the standard comment syntax requires an entire line
-to be just a comment. Therefore, Fortran mode replaces the standard Emacs
-comment commands and defines some new variables.
+ The usual Emacs comment commands assume that a comment can follow a
+line of code. In Fortran77, the standard comment syntax requires an
+entire line to be just a comment. Therefore, Fortran mode replaces the
+standard Emacs comment commands and defines some new variables.
+@vindex fortran-comment-line-start
Fortran mode can also handle the Fortran90 comment syntax where comments
start with @samp{!} and can follow other text. Because only some Fortran77
compilers accept this syntax, Fortran mode will not insert such comments
unless you have said in advance to do so. To do this, set the variable
-@code{comment-start} to @samp{"!"} (@pxref{Variables}).
+@code{fortran-comment-line-start} to @samp{"!"}.
@table @kbd
@item M-;
-Align comment or insert new comment (@code{fortran-comment-indent}).
+Align comment or insert new comment (@code{fortran-indent-comment}).
@item C-x ;
Applies to nonstandard @samp{!} comments only.
into real code (@code{fortran-comment-region}).
@end table
+@findex fortran-indent-comment
@kbd{M-;} in Fortran mode is redefined as the command
-@code{fortran-comment-indent}. Like the usual @kbd{M-;} command, this
+@code{fortran-indent-comment}. Like the usual @kbd{M-;} command, this
recognizes any kind of existing comment and aligns its text appropriately;
if there is no existing comment, a comment is inserted and aligned. But
inserting and aligning comments are not the same in Fortran mode as in
@code{fortran-comment-line-extra-indent} columns of indentation.
@item nil
-Don't move text in full-line comments automatically at all.
+Don't move text in full-line comments automatically.
@end table
@vindex fortran-comment-indent-char
@code{fortran-comment-indent-char} to the single-character string you want
to use.
-@vindex comment-line-start
-@vindex comment-line-start-skip
- Fortran mode introduces two variables @code{comment-line-start} and
-@code{comment-line-start-skip}, which play for full-line comments the same
-roles played by @code{comment-start} and @code{comment-start-skip} for
-ordinary text-following comments. Normally these are set properly by
-Fortran mode, so you do not need to change them.
+@vindex fortran-directive-re
+ Compiler directive lines, or preprocessor lines, have much the same
+appearance as comment lines. It is important, though, that such lines
+never be indented at all, no matter what the value of
+@code{fortran-comment-indent-style}. The variable
+@code{fortran-directive-re} is a regular expression that specifies which
+lines are directives. Matching lines are never indented, and receive
+distinctive font-locking.
The normal Emacs comment command @kbd{C-x ;} has not been redefined. If
you use @samp{!} comments, this command can be used with them. Otherwise
clear from the context which one is meant.
@node Fortran Autofill
-@subsection Fortran Auto Fill Mode
-
- Fortran Auto Fill mode is a minor mode which automatically splits
-Fortran statements as you insert them when they become too wide.
-Splitting a statement involves making continuation lines using
-@code{fortran-continuation-string} (@pxref{ForIndent Cont}). This
-splitting happens when you type @key{SPC}, @key{RET}, or @key{TAB}, and
-also in the Fortran indentation commands.
-
-@findex fortran-auto-fill-mode
- @kbd{M-x fortran-auto-fill-mode} turns Fortran Auto Fill mode on if it
-was off, or off if it was on. This command works the same as @kbd{M-x
-auto-fill-mode} does for normal Auto Fill mode (@pxref{Filling}). A
-positive numeric argument turns Fortran Auto Fill mode on, and a
-negative argument turns it off. You can see when Fortran Auto Fill mode
-is in effect by the presence of the word @samp{Fill} in the mode line,
-inside the parentheses. Fortran Auto Fill mode is a minor mode, turned
-on or off for each buffer individually. @xref{Minor Modes}.
+@subsection Auto Fill in Fortran Mode
+
+ Fortran mode has specialized support for Auto Fill mode, which is a
+minor mode that automatically splits statements as you insert them when
+they become too wide. Splitting a statement involves making
+continuation lines using @code{fortran-continuation-string}
+(@pxref{ForIndent Cont}). This splitting happens when you type
+@key{SPC}, @key{RET}, or @key{TAB}, and also in the Fortran indentation
+commands. You activate Auto Fill in Fortran mode in the normal way
+(@pxref{Auto Fill}).
@vindex fortran-break-before-delimiters
- Fortran Auto Fill mode breaks lines at spaces or delimiters when the
-lines get longer than the desired width (the value of @code{fill-column}).
-The delimiters that Fortran Auto Fill mode may break at are @samp{,},
-@samp{'}, @samp{+}, @samp{-}, @samp{/}, @samp{*}, @samp{=}, and @samp{)}.
-The line break comes after the delimiter if the variable
+ Auto Fill breaks lines at spaces or delimiters when the lines get
+longer than the desired width (the value of @code{fill-column}). The
+delimiters (besides whitespace) that Auto Fill may break at are
+@samp{+}, @samp{-}, @samp{/}, @samp{*}, @samp{=}, @samp{<}, @samp{>},
+and @samp{,}. The line break comes after the delimiter if the variable
@code{fortran-break-before-delimiters} is @code{nil}. Otherwise (and by
default), the break comes before the delimiter.
- By default, Fortran Auto Fill mode is not enabled. If you want this
-feature turned on permanently, add a hook function to
-@code{fortran-mode-hook} to execute @code{(fortran-auto-fill-mode 1)}.
-@xref{Hooks}.
+ To enable Auto Fill in all Fortran buffers, add
+@code{turn-on-auto-fill} to @code{fortran-mode-hook}. @xref{Hooks}.
@node Fortran Columns
@subsection Checking Columns in Fortran
@vindex fortran-column-ruler-fixed
@vindex fortran-column-ruler-tabs
- The text used to display the column ruler depends on the value of
-the variable @code{indent-tabs-mode}. If @code{indent-tabs-mode} is
+ The text used to display the column ruler depends on the value of the
+variable @code{indent-tabs-mode}. If @code{indent-tabs-mode} is
@code{nil}, then the value of the variable
@code{fortran-column-ruler-fixed} is used as the column ruler.
-Otherwise, the variable @code{fortran-column-ruler-tab} is displayed.
-By changing these variables, you can change the column ruler display.
+Otherwise, the value of the variable @code{fortran-column-ruler-tab} is
+displayed. By changing these variables, you can change the column ruler
+display.
@kindex C-c C-w @r{(Fortran mode)}
@findex fortran-window-create-momentarily
@kbd{C-c C-w} (@code{fortran-window-create-momentarily}) temporarily
splits the current window horizontally, making a window 72 columns
-wide, so you can see which lines that is too long. Type a space to
+wide, so you can see any lines that are too long. Type a space to
restore the normal width.
@kindex C-u C-c C-w @r{(Fortran mode)}
The variable @code{asm-comment-char} specifies which character
starts comments in assembler syntax.
+
+@ignore
+ arch-tag: c7ee7409-40a4-45c7-bfb7-ae7f2c74d0c0
+@end ignore