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


Fortran Indentation Commands

TAB
Indent the current line (fortran-indent-line).
C-j
Indent the current and start a new indented line (fortran-indent-new-line).
C-M-j
Break the current line and set up a continuation line.
M-^
Join this line to the previous 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 C-j 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 C-M-j 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.

M-^ runs the command fortran-join-line, which is more or less the inverse of fortran-split-line. It joins the current line to the previous line in a suitable way for Fortran code.


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