Hacker News new | ask | show | jobs
by kovek 3134 days ago
Seems like lots of people here are sharing their experience with #emacs. I like it a lot, and think that it would be part of the ideal #workingset for me. However, I have never found a nice 'jump-to-definition that worked for most languages I edit on emacs. I tried ggtags, ctags, pygments. I think I had trouble setting all of these up, and they would not work for many languages I was using. I have not found a good resource on how to get a nice 'jump-to-definition set-up, and did look within the last 6 months. Maybe something new popped up?

Edit: I think I had trouble with Javascript, React and/or Ruby.

5 comments

You could give Dumb Jump a shot: https://github.com/jacktasia/dumb-jump
I have been using dumb-jump with some R packages recently and I'm happy to report that it works very well!
You might want to to try Spacemacs [0].

It's a preconfigured Emacs configuration (a bit of an overhaul, but not too intrusive if you run it in Emacs or Hybrid mode).

You can just open source files in languages you haven't touched before and the editor will offer to configure itself for that language.

Go to definition works out of the box for more than a dozen languages. :)

[0]: https://spacemacs.org

I have good experience on ggtags with GnuGlobal. Here's my setup.

1. Install the ggtags.el package in Emacs and install GnuGlobal outside.

2. Make sure /GnuGlobal/bin is in the path environment variable, so that the global and gtags executables can be launched from Emacs.

3. Build the initial index database outside of Emacs. Emacs will update the index as you add new code. I usually just run the following commands on the root of the source directory. You can modify find to include or exclude certain files.

    find . -type f >> filelist
    gtags -f filelist
Now M-. should pick up the word at cursor and jump to its definition, or display a list of all its usage if cursor is already at the definition.
Language awareness can be lacking. That is why things like helm-ag and helm-multioccur are so great. They work no matter the language and for things you could never really add awareness for. I find with a few language based cheat codes like helm / git free + it grabbing the symbol at point working out just fine in practice.
Which languages were you using that those tags tools didn't work with? Have you tried etags, rtags, or universal ctags?