f90-ts-mode is a major mode for editing Fortran 90/2003 (and newer) source files, based on Emacs's built-in tree-sitter support (requires Emacs 30+) Features: - Syntax highlighting - Indentation - Alignment for multiline statements where applicable - Smart end completion - Breaking and joining continued lines - (Un)commenting regions with configurable prefixes - OpenMP and preprocessor directives - Region selection based on tree-sitter nodes - Xref (buffer local) - Imenu - Fortran menu and transient keybindings Features can be found by the fortran menu or a transient popup bound to the key C-c C-f. Installation requires the tree-sitter Fortran grammar, which can be found at https://github.com/stadelmanma/tree-sitter-fortran Basic setup with use-package: (use-package f90-ts-mode :mode ("\\.f90\\'" . f90-ts-mode)) See the README and MANUAL at https://github.com/mscfd/emacs-f90-ts-mode for full documentation on options, keybindings, etc. Bugs and features: https://github.com/mscfd/emacs-f90-ts-mode/issues Questions and discussions: https://fortran-lang.discourse.group/t/tree-sitter-based-f90-mode-for-emacs/10746 Note: Emacs must be linked against tree-sitter 0.25.x at runtime. Emacs does not yet support 0.26, though support is in development and this restriction may soon be obsolete. Moreover the grammar should also be compiled against tree-sitter 0.25.x, though it seems that grammar files generated by 0.26 work as well. The pregenerated grammar files in the master branch of https://github.com/mscfd/tree-sitter-fortran are built against 0.25.10 and ready to use, if there are problems with the official repository. To verify the setup: M-: (treesit-library-abi-version) ; should return 15 M-: (treesit-language-abi-version 'fortran) ; should return 15 in linux: ldd "emacs" | grep libtree-sitter ; should show libtree-sitter.so.0.25 in macos: otool -L "emacs" | grep tree-sitter ; expecting something like: .../tree-sitter/lib/libtree-sitter.0.dylib (compatibility version 0.0.0, current version 0.25.0) in windows: unknown how to check