0

I work a lot with Fortran, both with newer standards like f90/f95 (f90-mode in emacs) as well as the f77 standard (fortran-mode in emacs). I want to enable flycheck so it works with both standards (depending on mode), instead of just one. By default, flycheck only works on the newer f90/f95 standard.

According to their documentation, one can modify the flycheck-gfortran-language-standard variable to control the fortran standard in use, but so far I've only been able to make it work with one at a time. I tried the following solution:

(add-hook 'f90-mode-hook
  (lambda ()
    (make-local-variable 'flycheck-gfortran-language-standard)
    (setq flycheck-gfortran-language-standard "f95")))

(add-hook 'fortran-mode-hook
      (lambda ()
        (make-local-variable 'flycheck-gfortran-language-standard)
        (setq flycheck-gfortran-language-standard "legacy")))

but it didn't seem to have any effect. Basically, what I was hoping would happen is that the variable flycheck-gfortran-language-standard would be modified according to the major mode that I was in. That is, it would have the value "f95" in f90-mode and the value "legacy" in fortran-mode.

Any suggestions?

  • Please specify what you mean by "it didn't work". Say what happened and what you instead expected/hoped would happen. – Drew Jun 16 at 18:54
  • The code I typed did nothing as far as I can tell. What I was hoping would happen is that the variable flycheck-gfortran-language-standard would be modified according to the major mode that I was in. That is, it would have the value "f95" in f90-mode and the value "legacy" in fortran-mode. – johnymm Jun 16 at 18:59
  • Please the info in your comment to the question. Comments can be deleted at any time. Thx. – Drew Jun 17 at 15:03

Your Answer

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

Browse other questions tagged or ask your own question.