<-- back

Emacs: which-function-mode

The problem

I sometimes work with long functions or big org subtrees and it’s not always clear what function or org subtree I’m in right now. I wish there is a package that can show me what function I’m in.

which-function-mode

trace output

Turns out Emacs has this mode built-in so this functionality is just M-x which-function-mode away. It shows in the status line a function name I’m currently in (see [encode_terminal_code] on the screenshot above). It’s global mode so as soon as it’s enabled, you’ll see it’s working for every buffer. You can have it enabled on Emacs startup by adding (which-function-mode) to your config file.

I just started to get benefits of this mode but it’s already surprising how well it works:

  • it works in various prog modes
  • it works in org mode
  • it even works in markdown files

It doesn’t seem to work in html files I tried it with or modes that use html (e.g. vuejs or laravel blade files).
It definitely not an issue for me so I’m going to continue using it and I suggest you to try it out.


Feel free to contact me for feedback or questions. Find my contacts on About page.