5

I have used a package before which used the header line to show the name of the current function being edited. Whatever package it was, I don't have it installed now. What are my options for getting this sort of functionality?

How can I have a persistent view (e.g. mode-line, header-line, etc.) of the current function being edited when the top of the function is past the top of the window?

nispio
  • 8,175
  • 2
  • 35
  • 73

1 Answers1

11

This sounds a lot like you've followed this Emacs Redux blog post which is using which-func-mode. It explains its purpose (displaying the current function point is within), demonstrates how to enable and customize it and offers the following snippet to put the indicator in the header line:

;; Show the current function name in the header line
(which-function-mode)
(setq-default header-line-format
              '((which-func-mode ("" which-func-format " "))))
(setq mode-line-misc-info
            ;; We remove Which Function Mode from the mode line, because it's mostly
            ;; invisible here anyway.
            (assq-delete-all 'which-func-mode mode-line-misc-info))

wasamasa
  • 21,803
  • 1
  • 65
  • 97
  • It might be useful to summarize the blog post to guard against link rot. – Vamsi Oct 15 '14 at 23:57
  • I am quite confident that this is not the method that I was using before, but it does a pretty good job of guessing the current function. It took me a long time to make it work though because I couldn't read the text in the header line due to the font color. Changing the `header-line` face had no effect. I had to rummage through the sources for `which-function-mode` to figure out that there is a special face called `which-func` that is applied as a text property. :\ – nispio Oct 16 '14 at 02:07