Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GNU emacs equivalent of func-menu

Tags:

emacs

gnu

xemacs

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?

like image 572
perogiex Avatar asked Jan 20 '12 15:01

perogiex


2 Answers

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.

like image 139
phils Avatar answered Oct 18 '22 11:10

phils


Is this the XEmacs func-menu mode you're talking about? It gives you a list of functions in the current file.

If so, then you can mostly replicate the functionality in GNU Emacs with the Collection of Emacs Development Tools, CEDET (specifically the Semantic code parser), and the Emacs Code Browser, ECB.

  • The ECB Methods window shows you all the symbols in the selected source code buffer. It is a separate window in the Emacs sense - that is, a editing area showing a single buffer, several of which can be within a single window-manager window. It is not a Emacs frame so it won't be covered up.
  • Semantic's stickyfunc-mode can show the current function in a line at the top of your source code buffer. It uses the GNU Emacs-specific header line feature. This is not quite the same as showing the function name in the mode line, but close enough.

Note that ECB requires CEDET and both tend to be tricky to install without XEmacs's package manager.

like image 39
Michael Ratanapintha Avatar answered Oct 18 '22 12:10

Michael Ratanapintha