Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Emacs, how can I jump between functions in the current file?

Tags:

I'd like to quickly move point to a function in my Emacs buffer. I'd like to run some function and get a prompt asking me for the function name, with completion provided for every function defined in the current buffer.

I generally use etags to navigate around, but sometimes I'm looking for a framework method that's been overridden in several files. In these cases, I can find the file I need but then I'd like to quickly jump to the function there. There is a similar feature in TextMate where you can select a definition from a list in the bottom right of the editor.

like image 657
Bill Avatar asked Jan 25 '10 04:01

Bill


2 Answers

Just to jump around functions in the current file? Use imenu. It's the simplest and lightest of all the alternatives listed so far and might be enough for what you want. It's also built into Emacs and has minimum setup hassle. It features graphical and textual interfaces. Anything extra and you'll be better off using one of the other excellent suggestions made here.

like image 135
Noufal Ibrahim Avatar answered Sep 18 '22 09:09

Noufal Ibrahim


speedbar comes standard, and gives you a collapsible menu for each file in the current directory, by default middle clicking on an entry for a function definition jumps to that def. With emacs23 this was changed to the more normal leftclick.

like image 23
Justin Smith Avatar answered Sep 19 '22 09:09

Justin Smith