I am currently writing a user-script for a simulation software, and the program requires the use of Fortran90 syntax in 132-columns fixed format.

Emacs has two Fortran modes that I know of, fortran-mode and f90-mode. Fixed formmat is not supported in f90-mode so I am stuck using fortran-mode. The number of columns can be fixed, but the syntax highlighting is not correct.

  • Keywords such as use, contains, intent, dimension, end subroutine <name> are not recognized.
  • Variables aren't being highlighted after the :: operator.

While these are simple inconveniences and they do not affect the programming experience much, Emacs is all about convenience. So my question is:

Is there a simple way to achieve the f90-modesyntax highlighting in fortran-mode?

1 Answer 1


Yes, there is nothing to stop you from using F90 highlighting in fortran-mode. Just put something like this in your config:

(require 'f90)
(add-hook 'fortran-mode-hook 'f90-font-lock-2)

where the number at the end (1 to 4) controls the degree of gaudiness. Here is an example with the default color scheme and f90-font-lock-4 (maximum gaudiness).

enter image description here

  • All those cases are colored for me at levels 3 and above. You can see only in the screenshot above (at level 4). Is this not the case for you?
    – deprecated
    Dec 12, 2014 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.