O'Reilly logo

Learning GNU Emacs, Second Edition by Eric S. Raymond, Bill Rosenblatt, Debra Cameron

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

FORTRAN Mode

Emacs goes into FORTRAN mode when you visit a file with suffix .f or .for. FORTRAN mode has several features that relate to the language’s column-oriented format. It understands the syntactic elements common to all language modes; in addition, it supports the commands listed in Table 12-7 that deal with statements and subprograms.

Table 13-7. FORTRAN Mode Motion Commands

Keystrokes

Command Name

Action

C-c C-n

fortran-next-statement

Move forward one statement.

C-c C-p

fortran-previous-statement

Move backward one statement.

ESC C-a

beginning-of-fortran-subprogram

Move to the beginning of the current subprogram.

ESC C-e

end-of-fortran-subprogram

Move to the end of the current subprogram.

ESC C-h

mark-fortran-subprogram

Put the cursor at the beginning of the subprogram, put the mark at the end.

The C-c C-n and C-c C-p commands differ from the normal C-n and C-p commands in that they skip over continuation and comment lines.

FORTRAN mode supports the indentation and comment commands common to all language modes, with some modifications that is described shortly. In addition to the universal comment command ESC ;, the command ESC C-q (for fortran-indent-subprogram) properly indents the subprogram surrounding the cursor, and C-c ; (fortran-comment-region) comments out the region between the cursor and mark.

Just about every aspect of FORTRAN mode indentation, continuation, and comment style is customizable [71]via several Emacs ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required