Search code examples
emacsgnuxemacs

GNU emacs equivalent of func-menu


Is there and equivalent of func-menu for GNU emacs? I used func-menu when I had access to xemacs and I prefer its behaviour to that of the speedbar or sr-speedbar. Specifically:

  • I like that only the functions for the current file are displayed.

  • The function list can be popped up from the current frame and isn't a separate window which I may have covered up.

  • The current function name shows up in mode line.

Is there a package for GNU emacs which is a closer approximation to func-menu?


Solution

  • imenu would be the analogous feature in GNU Emacs.

    See C-hf imenu-add-menubar-index RET.
    You can call that in your mode hooks for modes with imenu support.

    Naturally elisp is supported, so for a quick demo:

    • M-x find-library RET imenu RET
    • M-x imenu-add-menubar-index RET

    and then see the new "Index" item in the menu bar, and also on C-<mouse3>

    Of course there's also a keyboard interface, simply by calling M-x imenu RET (with TAB completion), but I would highly recommend adding the ido integration which can be found at the EmacsWiki* -- I find that to be a generally faster interface than using the mouse.

    For more details, see C-hig (elisp) Imenu RET

    For configuration, see M-x customize-group RET imenu RET

    (*) Along with numerous other ways of enhancing the feature, so even if you don't want to use ido, you should definitely have a read through that Wiki page after you've seen the basic version in action.