f90-namelist-mode
f90-namelist-mode copied to clipboard
An extension to emacs f90-mode to handle Fortran namelists
#+title: f90-namelist-mode #+options: toc:nil
- f90-namelist-mode
An extension to emacs f90-mode to handle Fortran namelists
- Installation
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:
#+BEGIN_SRC emacs-lisp (add-to-list 'load-path "~/.emacs.d/f90-namelist-mode/") (require 'f90-namelist-mode) #+END_SRC
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:
#+BEGIN_SRC emacs-lisp ! -- mode: f90-namelist -- #+END_SRC
or at the end of your file:
#+BEGIN_SRC emacs-lisp ! Local Variables: ! mode: f90-namelist ! End: #+END_SRC
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:
#+BEGIN_SRC emacs-lisp (add-to-list 'magic-mode-alist '(f90-buffer-is-input-file . f90-namelist-mode)) #+END_SRC
- Planned features
- 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?)