Fortran mode: Moving with M-f or M-b suddenly stopped working

6 days ago

I was using fortran-mode for some time without problem, but recently the bindings M-f and M-b stopped working.

It seems that they are not bound to the forward-word and backward-word moving commands anymore, but instead to some commands defined in a file called ftnchek.el (this is what C-h k told me about them), which is apparently a "fortran 77 syntax and semantics checker". In this file, I found these:

; I'm not sure I like these but nobody's complaining.

(define-key fortran-mode-map "\C-x`" 'ftnchek-next-error)

(define-key fortran-mode-map "\M-s" 'ftnchek-subprogram)

(define-key fortran-mode-map "\M-b" 'ftnchek-buffer)

(define-key fortran-mode-map "\M-p" 'ftnchek-previous-subprogram)

(define-key fortran-mode-map "\M-n" 'ftnchek-next-subprogram)

(define-key fortran-mode-map "\M-f" 'ftnchek-first-executable)

(define-key fortran-mode-map "\M-h" 'ftnchek-what-subprogram)

which I think causes the problem.

So I have two questions:

Why do

  • ftncheck.el is not part of Emacs, so it's part of your config.

    If you don't need ftncheck.el then you can just disable it or remove it.

    Otherwise, you can just remove those keybindings:

    (add-hook 'fortran-mode-hook

    (lambda ()

    ;; Use default global binding for M-f and M-b.

    (local-set-key "\M-f" nil)

    (local-set-key "\M-b" nil)))

    6 days ago