An extension to emacs f90-mode to handle Fortran namelists
To install, put f90-namelist-mode.el somewhere in your emacs path, for example in ~/.emacs.d/f90-namelist-mode
, then put the following in your .emacs:
(add-to-list 'load-path "~/.emacs.d/f90-namelist-mode/")
(require 'f90-namelist-mode)
Fortran input files don’t have a standard filename suffix, so you’ll have to enable this mode manually with M-x f90-namelist-mode
, or set a local variable. To do so, just put the following on the first line of your input file:
! -*- mode: f90-namelist -*-
or at the end of your file:
! Local Variables:
! mode: f90-namelist
! End:
To automatically detect Fortran input files and load f90-namelist-mode, you can use the function f90-buffer-is-input-file
by adding it to magic-mode-alist
in your .emacs:
(add-to-list 'magic-mode-alist
'(f90-buffer-is-input-file . f90-namelist-mode))
- Extend the comment regexp to include #
- Define indentation rules for:
- Comment only lines
- Namelist start/end
- Key-value line
- Add functions to create/find the next/previous namelist/key/value and map them to appropriate keys.
- Add function to align on regexp (and auto run it?)