Go to the first, previous, next, last section, table of contents.

Fortran Indentation Commands

TAB
Indent the current line (fortran-indent-line).
LFD
Indent the current and start a new indented line (fortran-indent-new-line).
M-LFD
Break the current line and set up a continuation line.
C-M-q
Indent all the lines of the subprogram point is in (fortran-indent-subprogram).

Fortran mode redefines TAB to reindent the current line for Fortran (fortran-indent-line). This command indents Line numbers and continuation markers to their required columns, and independently indents the body of the statement based on its nesting in the program.

The key LFD runs the command fortran-indent-new-line, which reindents the current line then makes and indents a new line. This command is useful to reindent the closing statement of `do' loops and other blocks before starting a new line.

The key C-M-q runs fortran-indent-subprogram, a command to reindent all the lines of the Fortran subprogram (function or subroutine) containing point.

The key M-LFD runs 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.


Go to the first, previous, next, last section, table of contents.