Fully-featured Fortran setup for Linux/Mac in Emacs (Intel Fortran support included!)

Hi everyone, we here from the Doom Emacs project recently completed its brand-new Fortran Module. Out of the box, it automatically supports:

  1. Integration with fpm.
  2. LSP support via fortls.
  3. Auto-formatting via fprettier.
  4. (Optional) Intel Fortran! (Otherwise gfortran is the default).

This should provide a fully-featured, modern Fortran setup for anyone on Linux or MacOS. The Intel support is especially important, given how much of a pain its installation / editor integration has been outside of the classic Windows + Visual Studio setup.

If you try out this module and have any issues, please let me know! I’m also regularly available on Doom’s Discourse or its Discord.

Happy computing!

13 Likes

Welcome to the community @fosskers and also nice seeing fortls being part of the mix!

2 Likes

Small question. Does this work on vanilla Emacs as well or just Doom Emacs ?

1 Like

Thanks for sharing. This is great. Does this also work fully in Microsoft WSL? I just installed it and it seems like it works, but I am not sure if it has all the bells and whistles it gets in the native Unix environment.

There are Fortran modes for F90 and legacy Fortran built in to Emacs natively, and this module uses those and expands on them. The “module” however, is Doom-specific, so requires Doom to be installed and configured. Note that Doom is just Emacs with a lot of packages/settings pre-configured for convenience.

1 Like

I don’t see why not? So long as you get Doom installed, it should work.

1 Like

Welcome @fosskers!
I was about to ask the same question as @Aurelius_Nero just did. Well, I guess it’s time to give Doom Emacs a try - although I must admit I avoided it so far because lots of packages usually means larger memory footprint - and I’m still using some legacy computers with vanilla Emacs somewhat stripped.

1 Like

Doom requires at least Emacs 27, but since Emacs 28 is out now, you might as well use that. It features the new Elisp “native compilation” feature which really speeds up Emacs itself. As for memory footprint… my emacs process is currently sitting at 2.7% RAM. For comparison, Firefox is over 10%.