26.14.2.2 Continuation Lines
Most Fortran 77 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 fixed
form. (In GNU Emacs we always count columns from 0; but note that
the Fortran standard counts from 1. You can customize the variable
column-number-indicator-zero-based
to make the column display
Fortran-like; see Optional Mode Line Features.)
The variable
fortran-continuation-string
specifies what character to put in
column 5. A line that starts with a tab character followed by any digit
except ‘ 0
’ is also a continuation line. We call this style of
continuation tab format. (Fortran 90 introduced free-form
continuation lines.)
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
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
fortran-tab-mode-default
( nil
for fixed form, and
non- nil
for tab format) is used. ‘ /t
’
( fortran-tab-mode-string
) in the mode line indicates tab format
is selected. Fortran mode sets the value of indent-tabs-mode
accordingly.
If the text on a line starts with the Fortran continuation marker
‘ $
’, 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 TAB
, it converts the line to the
current continuation style. When you split a Fortran statement with
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 form 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 must 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 consist of one tab character.