I have a long file.f90 with several subroutines. Sometimes I'm editing some subroutine and I forgot where I'm (I mean the name of the subroutine that I'm editing).

I wonder what subroutine I am, I mean, where the cursor is (obviously, without move the cursor until the beginning to the subroutine to see its name). Is it possible?

  • 1
    does which-function-mode not work for you? – rekado Sep 28 '15 at 20:50
  • 1
    @rekado I assume yemino does not know that mode even exists, otherwise, he probably wouldn't have asked this question. Why don't you post that as an answer? – nanny Sep 28 '15 at 20:52
  • indeed @nanny (thanks for your kindness) , "which-function-mode" is exactly that I want, and I did not know. – yemino Sep 28 '15 at 21:02

You could enable the global minor mode which-function-mode, which should be supported in f90-mode and fortran-mode.

The documentation says:

Which Function mode is a global minor mode. When enabled, the current function name is continuously displayed in the mode line, in certain major modes.

Enable it by running M-x which-function-mode or by adding (which-function-mode 1) to your ~/.emacs.d/init.el file.

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.