1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 16:51:06 -07:00

* emacs-xtra.texi (Emerge, Picture Mode. Fortran): New chapters,

moved here from Emacs manual.

	* programs.texi (Fortran): Section moved to emacs-xtra.
	(Program Modes): Xref to Fortran in emacs-xtra.

	* maintaining.texi (Emerge): Moved to emacs-xtra.
	* files.texi (Comparing Files): Xref to Emerge in emacs-xtra.

	* picture.texi: File deleted.
	* text.texi (Text): Xref to Picture Mode in emacs-xtra.
	* abbrevs.texi (Abbrevs):
	* sending.texi (Sending Mail): Picture node removed.

	* emacs.texi (Top): Update node listings.
This commit is contained in:
Chong Yidong 2006-03-16 03:19:56 +00:00
parent dc5c3489f4
commit e0fc8fa2dd
9 changed files with 1212 additions and 946 deletions

View file

@ -1,3 +1,21 @@
2006-03-15 Chong Yidong <cyd@stupidchicken.com>
* emacs-xtra.texi (Emerge, Picture Mode. Fortran): New chapters,
moved here from Emacs manual.
* programs.texi (Fortran): Section moved to emacs-xtra.
(Program Modes): Xref to Fortran in emacs-xtra.
* maintaining.texi (Emerge): Moved to emacs-xtra.
* files.texi (Comparing Files): Xref to Emerge in emacs-xtra.
* picture.texi: File deleted.
* text.texi (Text): Xref to Picture Mode in emacs-xtra.
* abbrevs.texi (Abbrevs):
* sending.texi (Sending Mail): Picture node removed.
* emacs.texi (Top): Update node listings.
2006-03-15 Carsten Dominik <dominik@science.uva.nl>
* org.texi: Version number change only.

View file

@ -2,7 +2,7 @@
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2002, 2003,
@c 2004, 2005, 2006 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Abbrevs, Picture, Maintaining, Top
@node Abbrevs, Sending Mail, Maintaining, Top
@chapter Abbrevs
@cindex abbrevs
@cindex expansion (of abbrevs)

File diff suppressed because it is too large Load diff

View file

@ -103,8 +103,6 @@ Text Mode
Outline Mode
@TeX{} Mode
Formatted Text
Fortran Mode
Fortran Indentation
Shell Command History
The ones for Dired and Rmail have had the items turned into :: items
@ -182,8 +180,6 @@ Advanced Features
* Maintaining:: Features for maintaining large programs.
* Abbrevs:: How to define text abbreviations to reduce
the number of characters you must type.
* Picture:: Editing pictures made up of characters
using the quarter-plane screen model.
* Sending Mail:: Sending mail in Emacs.
* Rmail:: Reading mail in Emacs.
* Dired:: You can ``edit'' a directory to manage files in it.
@ -525,7 +521,6 @@ Editing Programs
* Misc for Programs:: Other Emacs features useful for editing programs.
* C Modes:: Special commands of C, C++, Objective-C,
Java, and Pike modes.
* Fortran:: Fortran mode and its special features.
* Asm Mode:: Asm mode and its special features.
Top-Level Definitions, or Defuns
@ -572,15 +567,6 @@ C and Related Modes
* Other C Commands:: Filling comments, viewing expansion of macros,
and other neat features.
Fortran Mode
* Fortran Motion:: Moving point by statements or subprograms.
* Fortran Indent:: Indentation commands for Fortran.
* Fortran Comments:: Inserting and aligning comments.
* Fortran Autofill:: Auto fill minor mode for Fortran.
* Fortran Columns:: Measuring columns for valid Fortran.
* Fortran Abbrev:: Built-in abbrevs for Fortran keywords.
Compiling and Testing Programs
* Compilation:: Compiling programs in languages other
@ -615,7 +601,6 @@ Maintaining Large Programs
* Format of ChangeLog:: What the change log file looks like.
* Tags:: Go direct to any function in your program in one
command. Tags remembers which file it is in.
* Emerge:: A convenient way of merging two versions of a program.
Tags Tables
@ -627,19 +612,6 @@ Tags Tables
* Tags Search:: Using a tags table for searching and replacing.
* List Tags:: Listing and finding tags defined in a file.
Merging Files with Emerge
* Overview of Emerge:: How to start Emerge. Basic concepts.
* Submodes of Emerge:: Fast mode vs. Edit mode.
Skip Prefers mode and Auto Advance mode.
* State of Difference:: You do the merge by specifying state A or B
for each difference.
* Merge Commands:: Commands for selecting a difference,
changing states of differences, etc.
* Exiting Emerge:: What to do when you've finished the merge.
* Combining in Emerge:: How to keep both alternatives for a difference.
* Fine Points of Emerge:: Misc.
Abbrevs
* Abbrev Concepts:: Fundamentals of defined abbrevs.
@ -650,14 +622,6 @@ Abbrevs
* Dynamic Abbrevs:: Abbreviations for words already in the buffer.
* Dabbrev Customization:: What is a word, for dynamic abbrevs. Case handling.
Editing Pictures
* Basic Picture:: Basic concepts and simple commands of Picture Mode.
* Insert in Picture:: Controlling direction of cursor motion
after "self-inserting" characters.
* Tabs in Picture:: Various features for tab stops and indentation.
* Rectangles in Picture:: Clearing and superimposing rectangles.
Sending Mail
* Mail Format:: Format of the mail being composed.
@ -1179,7 +1143,6 @@ shell commands.
@include building.texi
@include maintaining.texi
@include abbrevs.texi
@include picture.texi
@include sending.texi
@include rmail.texi
@include dired.texi

View file

@ -3037,8 +3037,8 @@ typically the result of a failed merge from a version control system
mode provides commands to resolve conflicts by selecting specific
changes.
See also @ref{Emerge}, and @ref{Top,,, ediff, The Ediff Manual}, for
convenient facilities for merging two similar files.
@inforef{Emerge,, emacs-xtra} for the Emerge facility, which
provides a powerful interface for merging files.
@node Misc File Ops
@section Miscellaneous File Operations

View file

@ -14,7 +14,6 @@ also particularly useful for this purpose.
* Format of ChangeLog:: What the change log file looks like.
* Tags:: Go direct to any function in your program in one
command. Tags remembers which file it is in.
* Emerge:: A convenient way of merging two versions of a program.
@end menu
@node Change Log
@ -846,393 +845,6 @@ details.
You can also use the collection of tag names to complete a symbol
name in the buffer. @xref{Symbol Completion}.
@node Emerge
@section Merging Files with Emerge
@cindex Emerge
@cindex merging files
It's not unusual for programmers to get their signals crossed and
modify the same program in two different directions. To recover from
this confusion, you need to merge the two versions. Emerge makes this
easier. See also @ref{Comparing Files}, for other ways to compare
files, and @ref{Top, Ediff,, ediff, The Ediff Manual}.
@menu
* Overview of Emerge:: How to start Emerge. Basic concepts.
* Submodes of Emerge:: Fast mode vs. Edit mode.
Skip Prefers mode and Auto Advance mode.
* State of Difference:: You do the merge by specifying state A or B
for each difference.
* Merge Commands:: Commands for selecting a difference,
changing states of differences, etc.
* Exiting Emerge:: What to do when you've finished the merge.
* Combining in Emerge:: How to keep both alternatives for a difference.
* Fine Points of Emerge:: Misc.
@end menu
@node Overview of Emerge
@subsection Overview of Emerge
To start Emerge, run one of these four commands:
@table @kbd
@item M-x emerge-files
@findex emerge-files
Merge two specified files.
@item M-x emerge-files-with-ancestor
@findex emerge-files-with-ancestor
Merge two specified files, with reference to a common ancestor.
@item M-x emerge-buffers
@findex emerge-buffers
Merge two buffers.
@item M-x emerge-buffers-with-ancestor
@findex emerge-buffers-with-ancestor
Merge two buffers with reference to a common ancestor in a third
buffer.
@end table
@cindex merge buffer (Emerge)
@cindex A and B buffers (Emerge)
The Emerge commands compare two files or buffers, and display the
comparison in three buffers: one for each input text (the @dfn{A buffer}
and the @dfn{B buffer}), and one (the @dfn{merge buffer}) where merging
takes place. The merge buffer shows the full merged text, not just the
differences. Wherever the two input texts differ, you can choose which
one of them to include in the merge buffer.
The Emerge commands that take input from existing buffers use only the
accessible portions of those buffers, if they are narrowed
(@pxref{Narrowing}).
If a common ancestor version is available, from which the two texts to
be merged were both derived, Emerge can use it to guess which
alternative is right. Wherever one current version agrees with the
ancestor, Emerge presumes that the other current version is a deliberate
change which should be kept in the merged version. Use the
@samp{with-ancestor} commands if you want to specify a common ancestor
text. These commands read three file or buffer names---variant A,
variant B, and the common ancestor.
After the comparison is done and the buffers are prepared, the
interactive merging starts. You control the merging by typing special
@dfn{merge commands} in the merge buffer (@pxref{Merge Commands}).
For each run of differences between the input texts, you can choose
which one of them to keep, or edit them both together.
The merge buffer uses a special major mode, Emerge mode, with commands
for making these choices. But you can also edit the buffer with
ordinary Emacs commands.
At any given time, the attention of Emerge is focused on one
particular difference, called the @dfn{selected} difference. This
difference is marked off in the three buffers like this:
@example
vvvvvvvvvvvvvvvvvvvv
@var{text that differs}
^^^^^^^^^^^^^^^^^^^^
@end example
@noindent
Emerge numbers all the differences sequentially and the mode
line always shows the number of the selected difference.
Normally, the merge buffer starts out with the A version of the text.
But when the A version of a difference agrees with the common ancestor,
then the B version is initially preferred for that difference.
Emerge leaves the merged text in the merge buffer when you exit. At
that point, you can save it in a file with @kbd{C-x C-w}. If you give a
numeric argument to @code{emerge-files} or
@code{emerge-files-with-ancestor}, it reads the name of the output file
using the minibuffer. (This is the last file name those commands read.)
Then exiting from Emerge saves the merged text in the output file.
Normally, Emerge commands save the output buffer in its file when you
exit. If you abort Emerge with @kbd{C-]}, the Emerge command does not
save the output buffer, but you can save it yourself if you wish.
@node Submodes of Emerge
@subsection Submodes of Emerge
You can choose between two modes for giving merge commands: Fast mode
and Edit mode. In Fast mode, basic merge commands are single
characters, but ordinary Emacs commands are disabled. This is
convenient if you use only merge commands. In Edit mode, all merge
commands start with the prefix key @kbd{C-c C-c}, and the normal Emacs
commands are also available. This allows editing the merge buffer, but
slows down Emerge operations.
Use @kbd{e} to switch to Edit mode, and @kbd{C-c C-c f} to switch to
Fast mode. The mode line indicates Edit and Fast modes with @samp{E}
and @samp{F}.
Emerge has two additional submodes that affect how particular merge
commands work: Auto Advance mode and Skip Prefers mode.
If Auto Advance mode is in effect, the @kbd{a} and @kbd{b} commands
advance to the next difference. This lets you go through the merge
faster as long as you simply choose one of the alternatives from the
input. The mode line indicates Auto Advance mode with @samp{A}.
If Skip Prefers mode is in effect, the @kbd{n} and @kbd{p} commands
skip over differences in states prefer-A and prefer-B (@pxref{State of
Difference}). Thus you see only differences for which neither version
is presumed ``correct.'' The mode line indicates Skip Prefers mode with
@samp{S}.
@findex emerge-auto-advance-mode
@findex emerge-skip-prefers-mode
Use the command @kbd{s a} (@code{emerge-auto-advance-mode}) to set or
clear Auto Advance mode. Use @kbd{s s}
(@code{emerge-skip-prefers-mode}) to set or clear Skip Prefers mode.
These commands turn on the mode with a positive argument, turns it off
with a negative or zero argument, and toggle the mode with no argument.
@node State of Difference
@subsection State of a Difference
In the merge buffer, a difference is marked with lines of @samp{v} and
@samp{^} characters. Each difference has one of these seven states:
@table @asis
@item A
The difference is showing the A version. The @kbd{a} command always
produces this state; the mode line indicates it with @samp{A}.
@item B
The difference is showing the B version. The @kbd{b} command always
produces this state; the mode line indicates it with @samp{B}.
@item default-A
@itemx default-B
The difference is showing the A or the B state by default, because you
haven't made a choice. All differences start in the default-A state
(and thus the merge buffer is a copy of the A buffer), except those for
which one alternative is ``preferred'' (see below).
When you select a difference, its state changes from default-A or
default-B to plain A or B. Thus, the selected difference never has
state default-A or default-B, and these states are never displayed in
the mode line.
The command @kbd{d a} chooses default-A as the default state, and @kbd{d
b} chooses default-B. This chosen default applies to all differences
which you haven't ever selected and for which no alternative is preferred.
If you are moving through the merge sequentially, the differences you
haven't selected are those following the selected one. Thus, while
moving sequentially, you can effectively make the A version the default
for some sections of the merge buffer and the B version the default for
others by using @kbd{d a} and @kbd{d b} between sections.
@item prefer-A
@itemx prefer-B
The difference is showing the A or B state because it is
@dfn{preferred}. This means that you haven't made an explicit choice,
but one alternative seems likely to be right because the other
alternative agrees with the common ancestor. Thus, where the A buffer
agrees with the common ancestor, the B version is preferred, because
chances are it is the one that was actually changed.
These two states are displayed in the mode line as @samp{A*} and @samp{B*}.
@item combined
The difference is showing a combination of the A and B states, as a
result of the @kbd{x c} or @kbd{x C} commands.
Once a difference is in this state, the @kbd{a} and @kbd{b} commands
don't do anything to it unless you give them a numeric argument.
The mode line displays this state as @samp{comb}.
@end table
@node Merge Commands
@subsection Merge Commands
Here are the Merge commands for Fast mode; in Edit mode, precede them
with @kbd{C-c C-c}:
@table @kbd
@item p
Select the previous difference.
@item n
Select the next difference.
@item a
Choose the A version of this difference.
@item b
Choose the B version of this difference.
@item C-u @var{n} j
Select difference number @var{n}.
@item .
Select the difference containing point. You can use this command in the
merge buffer or in the A or B buffer.
@item q
Quit---finish the merge.
@item C-]
Abort---exit merging and do not save the output.
@item f
Go into Fast mode. (In Edit mode, this is actually @kbd{C-c C-c f}.)
@item e
Go into Edit mode.
@item l
Recenter (like @kbd{C-l}) all three windows.
@item -
Specify part of a prefix numeric argument.
@item @var{digit}
Also specify part of a prefix numeric argument.
@item d a
Choose the A version as the default from here down in
the merge buffer.
@item d b
Choose the B version as the default from here down in
the merge buffer.
@item c a
Copy the A version of this difference into the kill ring.
@item c b
Copy the B version of this difference into the kill ring.
@item i a
Insert the A version of this difference at point.
@item i b
Insert the B version of this difference at point.
@item m
Put point and mark around the difference.
@item ^
Scroll all three windows down (like @kbd{M-v}).
@item v
Scroll all three windows up (like @kbd{C-v}).
@item <
Scroll all three windows left (like @kbd{C-x <}).
@item >
Scroll all three windows right (like @kbd{C-x >}).
@item |
Reset horizontal scroll on all three windows.
@item x 1
Shrink the merge window to one line. (Use @kbd{C-u l} to restore it
to full size.)
@item x c
Combine the two versions of this difference (@pxref{Combining in
Emerge}).
@item x f
Show the names of the files/buffers Emerge is operating on, in a Help
window. (Use @kbd{C-u l} to restore windows.)
@item x j
Join this difference with the following one.
(@kbd{C-u x j} joins this difference with the previous one.)
@item x s
Split this difference into two differences. Before you use this
command, position point in each of the three buffers at the place where
you want to split the difference.
@item x t
Trim identical lines off the top and bottom of the difference.
Such lines occur when the A and B versions are
identical but differ from the ancestor version.
@end table
@node Exiting Emerge
@subsection Exiting Emerge
The @kbd{q} command (@code{emerge-quit}) finishes the merge, storing
the results into the output file if you specified one. It restores the
A and B buffers to their proper contents, or kills them if they were
created by Emerge and you haven't changed them. It also disables the
Emerge commands in the merge buffer, since executing them later could
damage the contents of the various buffers.
@kbd{C-]} aborts the merge. This means exiting without writing the
output file. If you didn't specify an output file, then there is no
real difference between aborting and finishing the merge.
If the Emerge command was called from another Lisp program, then its
return value is @code{t} for successful completion, or @code{nil} if you
abort.
@node Combining in Emerge
@subsection Combining the Two Versions
Sometimes you want to keep @emph{both} alternatives for a particular
difference. To do this, use @kbd{x c}, which edits the merge buffer
like this:
@example
@group
#ifdef NEW
@var{version from A buffer}
#else /* not NEW */
@var{version from B buffer}
#endif /* not NEW */
@end group
@end example
@noindent
@vindex emerge-combine-versions-template
While this example shows C preprocessor conditionals delimiting the two
alternative versions, you can specify the strings to use by setting
the variable @code{emerge-combine-versions-template} to a string of your
choice. In the string, @samp{%a} says where to put version A, and
@samp{%b} says where to put version B. The default setting, which
produces the results shown above, looks like this:
@example
@group
"#ifdef NEW\n%a#else /* not NEW */\n%b#endif /* not NEW */\n"
@end group
@end example
@node Fine Points of Emerge
@subsection Fine Points of Emerge
During the merge, you mustn't try to edit the A and B buffers yourself.
Emerge modifies them temporarily, but ultimately puts them back the way
they were.
You can have any number of merges going at once---just don't use any one
buffer as input to more than one merge at once, since the temporary
changes made in these buffers would get in each other's way.
Starting Emerge can take a long time because it needs to compare the
files fully. Emacs can't do anything else until @code{diff} finishes.
Perhaps in the future someone will change Emerge to do the comparison in
the background when the input files are large---then you could keep on
doing other things with Emacs until Emerge is ready to accept
commands.
@vindex emerge-startup-hook
After setting up the merge, Emerge runs the hook
@code{emerge-startup-hook} (@pxref{Hooks}).
@ignore
arch-tag: b9d83dfb-82ea-4ff6-bab5-05a3617091fb
@end ignore

View file

@ -41,7 +41,6 @@ Highlight program syntax (@pxref{Font Lock}).
* Misc for Programs:: Other Emacs features useful for editing programs.
* C Modes:: Special commands of C, C++, Objective-C,
Java, and Pike modes.
* Fortran:: Fortran mode and its special features.
* Asm Mode:: Asm mode and its special features.
@end menu
@ -109,7 +108,8 @@ 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}).
(@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}). For Fortran
mode, @inforef{Fortran,, emacs-xtra}.
@cindex mode hook
@vindex c-mode-hook
@ -1715,521 +1715,6 @@ to a C/C++ source file, or vice versa. The variable
names.
@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 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
typing when you insert Fortran keywords.
Use @kbd{M-x fortran-mode} to switch to this major mode. This command
runs the hook @code{fortran-mode-hook} (@pxref{Hooks}).
@cindex Fortran77 and Fortran90
@findex f90-mode
@findex fortran-mode
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 support for Fortran.
* Columns: Fortran Columns. Measuring columns for valid Fortran.
* Abbrev: Fortran Abbrev. Built-in abbrevs for Fortran keywords.
@end menu
@node Fortran Motion
@subsection Motion Commands
In addition to the normal commands for moving by and operating on
``defuns'' (Fortran subprograms---functions and subroutines, as well as
modules for F90 mode), Fortran mode provides special commands to move by
statements and other program units.
@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 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 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{(Fortran mode)}
@findex fortran-end-of-block
@findex f90-end-of-block
@item C-M-n
Move to the end of the current code block
(@code{fortran-end-of-block}/@code{f90-end-of-block}). With a numeric
agument, move forward that number of blocks. The mark is set before
moving point. The F90 mode version of 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.
@kindex C-M-p @r{(Fortran mode)}
@findex fortran-beginning-of-block
@findex f90-beginning-of-block
@item C-M-p
Move to the start of the current code block
(@code{fortran-beginning-of-block}/@code{f90-beginning-of-block}). This
is like @code{fortran-end-of-block}, but moves backwards.
@end table
@node Fortran Indent
@subsection Fortran Indentation
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, fixed (or tab) format Fortran.
@menu
* Commands: ForIndent Commands. Commands for indenting and filling Fortran.
* Contline: ForIndent Cont. How continuation lines indent.
* Numbers: ForIndent Num. How line numbers auto-indent.
* Conv: ForIndent Conv. Conventions you must obey to avoid trouble.
* Vars: ForIndent Vars. Variables controlling Fortran indent style.
@end menu
@node ForIndent Commands
@subsubsection Fortran Indentation and Filling Commands
@table @kbd
@item C-M-j
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}).
@item C-M-q
Indent all the lines of the subprogram point is in
(@code{fortran-indent-subprogram}).
@item M-q
Fill a comment block or statement.
@end table
@kindex C-M-q @r{(Fortran mode)}
@findex fortran-indent-subprogram
The key @kbd{C-M-q} runs @code{fortran-indent-subprogram}, a command
to reindent all the lines of the Fortran subprogram (function or
subroutine) containing point.
@kindex C-M-j @r{(Fortran mode)}
@findex fortran-split-line
The key @kbd{C-M-j} runs @code{fortran-split-line}, which splits
a line in the appropriate fashion for Fortran. In a non-comment line,
the second half becomes a continuation line and is indented
accordingly. In a comment line, both halves become separate comment
lines.
@kindex M-^ @r{(Fortran mode)}
@kindex C-c C-d @r{(Fortran mode)}
@findex fortran-join-line
@kbd{M-^} or @kbd{C-c C-d} runs the command @code{fortran-join-line},
which joins a continuation line back to the previous line, roughly as
the inverse of @code{fortran-split-line}. The point must be on a
continuation line when this command is invoked.
@kindex M-q @r{(Fortran mode)}
@kbd{M-q} in Fortran mode fills the comment block or statement that
point is in. This removes any excess statement continuations.
@node ForIndent Cont
@subsubsection Continuation Lines
@cindex Fortran continuation lines
@vindex fortran-continuation-string
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)}
@vindex fortran-analyze-depth
@vindex fortran-tab-mode-default
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. @samp{/t} in the mode line
indicates tab format is selected. Fortran mode sets the value of
@code{indent-tabs-mode} accordingly (@pxref{Just Spaces}).
If the text on a line starts with the 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.
The setting of continuation style affects several other aspects of
editing in Fortran mode. In fixed format mode, the minimum column
number for the body of a statement is 6. Lines inside of Fortran
blocks that are indented to larger column numbers always use only the
space character for whitespace. In tab format mode, the minimum
column number for the statement body is 8, and the whitespace before
column 8 must always consist of one tab character.
@node ForIndent Num
@subsubsection Line Numbers
If a number is the first non-whitespace in the line, Fortran
indentation assumes it is a line number and moves it to columns 0
through 4. (Columns always count from 0 in GNU Emacs.)
@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. 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}.
@node ForIndent Conv
@subsubsection Syntactic Conventions
Fortran mode assumes that you follow certain conventions that simplify
the task of understanding a Fortran program well enough to indent it
properly:
@itemize @bullet
@item
Two nested @samp{do} loops never share a @samp{continue} statement.
@item
Fortran keywords such as @samp{if}, @samp{else}, @samp{then}, @samp{do}
and others are written without embedded whitespace or line breaks.
Fortran compilers generally ignore whitespace outside of string
constants, but Fortran mode does not recognize these keywords if they
are not contiguous. Constructs such as @samp{else if} or @samp{end do}
are acceptable, but the second word should be on the same line as the
first and not on a continuation line.
@end itemize
@noindent
If you fail to follow these conventions, the indentation commands may
indent some lines unaesthetically. However, a correct Fortran program
retains its meaning when reindented even if the conventions are not
followed.
@node ForIndent Vars
@subsubsection Variables for Fortran Indentation
@vindex fortran-do-indent
@vindex fortran-if-indent
@vindex fortran-structure-indent
@vindex fortran-continuation-indent
@vindex fortran-check-all-num@dots{}
@vindex fortran-minimum-statement-indent@dots{}
Several additional variables control how Fortran indentation works:
@table @code
@item fortran-do-indent
Extra indentation within each level of @samp{do} statement (default 3).
@item fortran-if-indent
Extra indentation within each level of @samp{if}, @samp{select case}, or
@samp{where} statements (default 3).
@item fortran-structure-indent
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
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} (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
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
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
the following section.
@node Fortran Comments
@subsection Fortran Comments
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{fortran-comment-line-start} to @samp{"!"}.
@table @kbd
@item M-;
Align comment or insert new comment (@code{fortran-indent-comment}).
@item C-x ;
Applies to nonstandard @samp{!} comments only.
@item C-c ;
Turn all lines of the region into comments, or (with argument) turn them back
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-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
other modes.
When a new comment must be inserted, if the current line is blank, a
full-line comment is inserted. On a non-blank line, a nonstandard @samp{!}
comment is inserted if you have said you want to use them. Otherwise a
full-line comment is inserted on a new line before the current line.
Nonstandard @samp{!} comments are aligned like comments in other
languages, but full-line comments are different. In a standard full-line
comment, the comment delimiter itself must always appear in column zero.
What can be aligned is the text within the comment. You can choose from
three styles of alignment by setting the variable
@code{fortran-comment-indent-style} to one of these values:
@vindex fortran-comment-indent-style
@vindex fortran-comment-line-extra-indent
@table @code
@item fixed
Align the text at a fixed column, which is the sum of
@code{fortran-comment-line-extra-indent} and the minimum statement
indentation. This is the default.
The minimum statement indentation is
@code{fortran-minimum-statement-indent-fixed} for fixed format
continuation line style and @code{fortran-minimum-statement-indent-tab}
for tab format style.
@item relative
Align the text as if it were a line of code, but with an additional
@code{fortran-comment-line-extra-indent} columns of indentation.
@item nil
Don't move text in full-line comments automatically.
@end table
@vindex fortran-comment-indent-char
In addition, you can specify the character to be used to indent within
full-line comments by setting the variable
@code{fortran-comment-indent-char} to the single-character string you want
to use.
@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
it is useless in Fortran mode.
@kindex C-c ; @r{(Fortran mode)}
@findex fortran-comment-region
@vindex fortran-comment-region
The command @kbd{C-c ;} (@code{fortran-comment-region}) turns all the
lines of the region into comments by inserting the string @samp{C$$$} at
the front of each one. With a numeric argument, it turns the region
back into live code by deleting @samp{C$$$} from the front of each line
in it. The string used for these comments can be controlled by setting
the variable @code{fortran-comment-region}. Note that here we have an
example of a command and a variable with the same name; these two uses
of the name never conflict because in Lisp and in Emacs it is always
clear from the context which one is meant.
@node Fortran Autofill
@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
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 can 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.
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
@table @kbd
@item C-c C-r
Display a ``column ruler'' momentarily above the current line
(@code{fortran-column-ruler}).
@item C-c C-w
Split the current window horizontally temporarily so that it is 72
columns wide (@code{fortran-window-create-momentarily}). This may
help you avoid making lines longer than the 72-character limit that
some Fortran compilers impose.
@item C-u C-c C-w
Split the current window horizontally so that it is 72 columns wide
(@code{fortran-window-create}). You can then continue editing.
@item M-x fortran-strip-sequence-nos
Delete all text in column 72 and beyond.
@end table
@kindex C-c C-r @r{(Fortran mode)}
@findex fortran-column-ruler
The command @kbd{C-c C-r} (@code{fortran-column-ruler}) shows a column
ruler momentarily above the current line. The comment ruler is two lines
of text that show you the locations of columns with special significance in
Fortran programs. Square brackets show the limits of the columns for line
numbers, and curly brackets show the limits of the columns for the
statement body. Column numbers appear above them.
Note that the column numbers count from zero, as always in GNU Emacs.
As a result, the numbers may be one less than those you are familiar
with; but the positions they indicate in the line are standard for
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
@code{nil}, then the value of the variable
@code{fortran-column-ruler-fixed} is used as the column ruler.
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 any lines that are too long. Type a space to
restore the normal width.
@kindex C-u C-c C-w @r{(Fortran mode)}
@findex fortran-window-create
You can also split the window horizontally and continue editing with
the split in place. To do this, use @kbd{C-u C-c C-w} (@code{M-x
fortran-window-create}). By editing in this window you can
immediately see when you make a line too wide to be correct Fortran.
@findex fortran-strip-sequence-nos
The command @kbd{M-x fortran-strip-sequence-nos} deletes all text in
column 72 and beyond, on all lines in the current buffer. This is the
easiest way to get rid of old sequence numbers.
@node Fortran Abbrev
@subsection Fortran Keyword Abbrevs
Fortran mode provides many built-in abbrevs for common keywords and
declarations. These are the same sort of abbrev that you can define
yourself. To use them, you must turn on Abbrev mode. @xref{Abbrevs}.
The built-in abbrevs are unusual in one way: they all start with a
semicolon. You cannot normally use semicolon in an abbrev, but Fortran
mode makes this possible by changing the syntax of semicolon to ``word
constituent.''
For example, one built-in Fortran abbrev is @samp{;c} for
@samp{continue}. If you insert @samp{;c} and then insert a punctuation
character such as a space or a newline, the @samp{;c} expands automatically
to @samp{continue}, provided Abbrev mode is enabled.@refill
Type @samp{;?} or @samp{;C-h} to display a list of all the built-in
Fortran abbrevs and what they stand for.
@node Asm Mode
@section Asm Mode

View file

@ -2,7 +2,7 @@
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, 2002,
@c 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Sending Mail, Rmail, Picture, Top
@node Sending Mail, Rmail, Abbrevs, Top
@chapter Sending Mail
@cindex sending mail
@cindex mail

View file

@ -51,6 +51,12 @@ Then the formatting appears on the screen in Emacs while you edit.
@xref{Formatted Text}.
@end iftex
@cindex ASCII art
If you need to edit pictures made out of text characters (commonly
referred to as ``ASCII art''), use @kbd{M-x edit-picture} to enter
Picture mode, a special major mode for editing such pictures.
@inforef{Picture Mode,, emacs-xtra}.
@cindex skeletons
@cindex templates
@cindex autotyping