Function: f90-mode

f90-mode is an autoloaded, interactive and byte-compiled function defined in f90.el.gz.

Signature

(f90-mode)

Documentation

Major mode for editing Fortran 90,95 code in free format.

For fixed format code, use fortran-mode.

M-x f90-indent-line (f90-indent-line) indents the current line. M-x f90-indent-new-line (f90-indent-new-line) indents current line and creates a new indented line. M-x f90-indent-subprogram (f90-indent-subprogram) indents the current subprogram.

Type `? or `<f1> (help-command) to display a list of built-in abbrevs for F90 keywords.

Key definitions:
* f90-electric-insert
+ f90-electric-insert
, f90-electric-insert
- f90-electric-insert
/ f90-electric-insert
C-M-a f90-beginning-of-subprogram
C-M-e f90-end-of-subprogram
C-M-h f90-mark-subprogram
C-M-n f90-end-of-block
C-M-p f90-beginning-of-block
C-M-q f90-indent-subprogram
C-c ; f90-comment-region(var)/f90-comment-region(fun)
C-c C-a f90-previous-block
C-c C-d f90-join-lines
C-c C-e f90-next-block
C-c C-f f90-fill-region
C-c C-n f90-next-statement
C-c C-p f90-previous-statement
C-c C-w f90-insert-end
C-c RET f90-break-line
C-c ] f90-insert-end
C-j f90-indent-new-line
` f90-abbrev-start

Variables controlling indentation style and extra features:

f90-do-indent
  Extra indentation within do blocks (default 3).
f90-if-indent
  Extra indentation within if/select/where/forall blocks (default 3).
f90-type-indent
  Extra indentation within type/enum/interface/block-data blocks (default 3).
f90-program-indent
  Extra indentation within program/module/subroutine/function blocks
  (default 2).
f90-associate-indent
  Extra indentation within associate blocks (default 2).
f90-critical-indent
  Extra indentation within critical/block blocks (default 2).
f90-continuation-indent
  Extra indentation applied to continuation lines (default 5).
f90-comment-region(var)/f90-comment-region(fun)
  String inserted by function M-x f90-comment-region (f90-comment-region) at start of each
  line in region (default "!!!$").
f90-indented-comment-re
  Regexp determining the type of comment to be intended like code
  (default "!").
f90-directive-comment-re
  Regexp of comment-like directive like "!HPF\\\\$", not to be indented
  (default "!hpf\\\\$").
f90-break-delimiters
  Regexp holding list of delimiters at which lines may be broken
  (default "[-+*/><=,% \\t]").
f90-break-before-delimiters
  Non-nil causes f90-do-auto-fill to break lines before delimiters
  (default t).
f90-beginning-ampersand
  Automatic insertion of & at beginning of continuation lines (default t).
f90-smart-end
  From an END statement, check and fill the end using matching block start.
  Allowed values are blink, no-blink, and nil, which determine
  whether to blink the matching beginning (default blink).
f90-auto-keyword-case
  Automatic change of case of keywords (default nil).
  The possibilities are downcase-word, upcase-word, capitalize-word.
f90-leave-line-no
  Do not left-justify line numbers (default nil).

Turning on F90 mode calls the value of the variable f90-mode-hook with no args, if that value is non-nil.

View in manual

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/f90.el.gz
;;;###autoload
(define-derived-mode f90-mode prog-mode "F90"
  "Major mode for editing Fortran 90,95 code in free format.
For fixed format code, use `fortran-mode'.

\\[f90-indent-line] indents the current line.
\\[f90-indent-new-line] indents current line and creates a new\
 indented line.
\\[f90-indent-subprogram] indents the current subprogram.

Type \\=`? or \\=`\\[help-command] to display a list of built-in\
 abbrevs for F90 keywords.

Key definitions:
\\{f90-mode-map}

Variables controlling indentation style and extra features:

`f90-do-indent'
  Extra indentation within do blocks (default 3).
`f90-if-indent'
  Extra indentation within if/select/where/forall blocks (default 3).
`f90-type-indent'
  Extra indentation within type/enum/interface/block-data blocks (default 3).
`f90-program-indent'
  Extra indentation within program/module/subroutine/function blocks
  (default 2).
`f90-associate-indent'
  Extra indentation within associate blocks (default 2).
`f90-critical-indent'
  Extra indentation within critical/block blocks (default 2).
`f90-continuation-indent'
  Extra indentation applied to continuation lines (default 5).
`f90-comment-region'
  String inserted by function \\[f90-comment-region] at start of each
  line in region (default \"!!!$\").
`f90-indented-comment-re'
  Regexp determining the type of comment to be intended like code
  (default \"!\").
`f90-directive-comment-re'
  Regexp of comment-like directive like \"!HPF\\\\$\", not to be indented
  (default \"!hpf\\\\$\").
`f90-break-delimiters'
  Regexp holding list of delimiters at which lines may be broken
  (default \"[-+*/><=,% \\t]\").
`f90-break-before-delimiters'
  Non-nil causes `f90-do-auto-fill' to break lines before delimiters
  (default t).
`f90-beginning-ampersand'
  Automatic insertion of `&' at beginning of continuation lines (default t).
`f90-smart-end'
  From an END statement, check and fill the end using matching block start.
  Allowed values are `blink', `no-blink', and nil, which determine
  whether to blink the matching beginning (default `blink').
`f90-auto-keyword-case'
  Automatic change of case of keywords (default nil).
  The possibilities are `downcase-word', `upcase-word', `capitalize-word'.
`f90-leave-line-no'
  Do not left-justify line numbers (default nil).

Turning on F90 mode calls the value of the variable `f90-mode-hook'
with no args, if that value is non-nil."
  :group 'f90
  :abbrev-table f90-mode-abbrev-table
  (setq-local indent-line-function #'f90-indent-line)
  (setq-local indent-region-function #'f90-indent-region)
  (setq-local comment-start "!")
  (setq-local comment-start-skip "!+ *")
  (setq-local comment-indent-function 'f90-comment-indent)
  (setq-local abbrev-all-caps t)
  (setq-local normal-auto-fill-function #'f90-do-auto-fill)
  (setq indent-tabs-mode nil)           ; auto buffer local
  (setq-local fill-paragraph-function #'f90-fill-paragraph)
  (setq-local font-lock-defaults
              '((f90-font-lock-keywords f90-font-lock-keywords-1
                                        f90-font-lock-keywords-2
                                        f90-font-lock-keywords-3
                                        f90-font-lock-keywords-4)
                nil t))
  (setq-local imenu-case-fold-search t)
  (setq-local imenu-generic-expression f90-imenu-generic-expression)
  (setq-local beginning-of-defun-function #'f90-beginning-of-subprogram)
  (setq-local end-of-defun-function #'f90-end-of-subprogram)
  (setq-local add-log-current-defun-function #'f90-current-defun))