Does emacs have a function or library that can allow the user to go to the function declaration even if it was defined in another file?

If so, what languages is there support for?

The inspiration for this question, comes from the below article which talks about some of the reasons why emacs will never be able to compete with IDE's.


  • The way emacs generally handles this is by relying on external, compiled programs (like clang) to understand the source code quickly and respond to queries passed via the command line. Check out irony-clang to this end. Did you read the comments on the article? Commented Mar 19, 2015 at 2:37
  • 1
    The functionality provided by alchemist.el, for elixir, or omnisharp for C#, both of which rely on external programs for navigation/refactoring/ide-ish stuff are pretty akin to most IDEs out there. (at least for most use cases). Emacs is not in the same business as IDEs, so I don't think that's reasonable to say it will never have a competing chance. Commented Mar 19, 2015 at 3:11
  • @RenanRanelli IDE is just the same way, except we have to do integration manually instead of someone already did it and called it an "IDE".
    – Tu Do
    Commented Mar 19, 2015 at 6:34
  • IN 2019 there is only one solution you should consider in my opinion. And that is rtags with company completion. Forget etags or the bloated, unstable CEDET. rtags uses compile-time info to provide a LIVE structure of what your project is using. global et al are awful - they are glorified "greps" that do a lot of guesswork and frequently take you to the wrong place. github.com/Andersbakken/rtags
    – RichieHH
    Commented Mar 10, 2019 at 14:58

4 Answers 4


You can jump to any definition/reference of entire project as large as Linux kernel source tree (more than 36k) in an instant. See my C/C++ guide for details. For C/C++, I suggest using GNU Global that supports C, C++, Yacc, Java, PHP4 and assembly.

The key is, if you want to have IDE features of a language, you have to install plugin of that language. Here are some packages for dynamic languages that I know of:

  • Live web development: skewer-mode.
  • Javascript: Tern. But before that, remember to install js2-mode. As for what js2-mode does, see the description; but in essence, js2-mode is a complete Javascript parser that generates an AST to do proper IDE features. If you install skewer-mode than you will have js2-mode by default, since skewer-mode depends on it.
  • Python: elpy, see the IDE features
  • Ruby: robe provides these features:
  • Jump to method definition
  • Jump to super or a constructor called at point
  • Jump to a module or class (provided it has at least one method defined)
  • Display method documentation
  • Display information about method called at point using ElDoc
  • Method and constant name completion

You can also use ctags to support vast many languages such as shell script or Tcl...

  • Any suite suggestion for javascript? Commented Mar 19, 2015 at 15:51
  • @BarryG There is Tern and j2-mode I edited in my answer.
    – Tu Do
    Commented Mar 20, 2015 at 6:17
  • 2
    I'd like to point our that anaconda may be a more specific solution for definition jumping in Python.
    – PythonNut
    Commented Feb 19, 2016 at 0:48
  • @TuDo You've put Robe's feature list under ESS.
    – Dmitry
    Commented Feb 20, 2016 at 12:00
  • For C++, there's also rtags and ycmd. I use ycmd, which also works with e.g. Python, C#, Go and other languages. I use dumb-jump and counsel-rg as a fall-back or to show usages or commented/doc mentions of a symbol.
    – unhammer
    Commented Aug 21, 2017 at 9:43

I ran into a similar issue with emacs, so I made Dumb Jump. I tried many of the solutions mentioned in the accepted answer, but I always ran into one or more of the following issues:

  • Solution only worked for a single programming language
  • Solution required an index (TAG) file or persistent process

I badly wanted a solution that "just worked" and didn't require customization or setup. That is, I wanted to clone a random repo on Github and navigate around it like any other of my own projects.

Right now Dumb Jump has basic support for:

  • JavaScript
  • Emacs Lisp
  • Python
  • Go
  • PHP
  • Ruby
  • Faust
  • R
  • Lua
  • Rust
  • ...and more

It's available via MELPA and GitHub issues and PRs are more than welcome.

  • 1
    This is acutally great. I have some comments after installing it and tested it a bit on a quite large project, but I will do in Github. Thanks.
    – MarkSkayff
    Commented May 28, 2020 at 20:52

The primary solution for this in emacs is using TAGS files, which are created by programs such as etags or gtags. I myself use (and recommend) exuberant ctags, and etags-select.el to help you narrow down destinations when the search symbol lies in multiple destinations. The supported languages are quite numerous, see the individual tools' manuals. There is even support for adding your own language, whereby you can provide a regular expression that instructs ctags how to isolate the tags you are interested in.

  • 1
    Oh! How could I forget about tagsfiles? ctags -e -R * from the root directory will set it up for you. Commented Mar 19, 2015 at 3:46
  • is this an acceptable solution when your project has many dependencies (such as more recent javascript web dev projects)?
    – user10000
    Commented Nov 19, 2015 at 16:08
  • The number of dependencies is not itself an impediment. You can either have one large tags file that aggregates many different libraries; I did this for many years, the ctags command invocation trivially does this. Or what I now recommend is to have a separate tags file per dependency; emacs is smart enough to load multiple tags files. To ease this, search out etags-table.el, which helps loading groups of tags files per project.
    – InHarmsWay
    Commented Nov 19, 2015 at 16:22

You can probably achieve this (and MUCH more IDE-like features, like refactorization) with the neat a "language server" feature + lsp-mode https://vxlabs.com/2018/06/08/python-language-server-with-emacs-and-lsp-mode/

  • Please elaborate, saying why you think those things provide an answer - e.g., explain what they do that solves the problem (how). So far, this is essentially a link-only answer, so it risks being deleted.
    – Drew
    Commented Jan 12, 2021 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.