Tg.
Tg.

Reputation: 5804

Emacs: how to jump to function definition in .el file?

I tried to edit my init file. Is there any possible way to quickly jump into function definition of other .el file that has already loaded/required ?

I remember doing this once, but don't remember how...

Upvotes: 55

Views: 18917

Answers (4)

Hi-Angel
Hi-Angel

Reputation: 5669

As of emacs-25.1, there's a new generic function xref-find-definitions. The xref built-in package provides a generic framework for navigating definitions in code. Probably, it'd take some time for every mode to adjust custom functions for this framework, but, at the very least, emacs-lisp-mode already ported.

Upvotes: 10

Drew
Drew

Reputation: 30718

find-function is the way to go. An alternative is to use C-h f, then click the file name in buffer *Help*.

Upvotes: 4

phils
phils

Reputation: 73365

M-x find-function RET (function name) RET

I find that C-h C-f makes a good keybinding for find-function (given that C-h f is bound by default to describe-function)

(global-set-key (kbd "C-h C-f") 'find-function)

Upvotes: 64

vpit3833
vpit3833

Reputation: 7961

etags [options] file1 file2 ... and then, from inside emacs, do M-. to visit the tag. To go the the next occurrence of the tag, do M-,.

Upvotes: 5

Related Questions