
Dumb-jump: an Emacs “jump to definition” package - jacktasia
https://github.com/jacktasia/dumb-jump
======
kozikow
I was planning to write this as a comment here, but it ended up growing so I
published it on my blog post: [https://kozikow.wordpress.com/2016/05/21/nice-
new-emacs-pack...](https://kozikow.wordpress.com/2016/05/21/nice-new-emacs-
package-dumb-jump-el/) .

BTW, did you know that you can just do README.org and github parses it? I
noticed that you have org file checked in, but README is in md. For example
see
[https://github.com/kozikow/keyremaplinux](https://github.com/kozikow/keyremaplinux)
.

~~~
jacktasia
Wow, thanks for writing that blog post! You highlight pretty much all the
reasons why I made dumb-jump. Please don't hesitate to make issues on github
if/when you run into issues/ideas.

------
qwertyuiop924
Ah yes, yet another proof that the Wrong Thing™ isn't necessarily the wrong
thing. Sure it's objectively worse than [ce]tags, but haven't you heard? Worse
is Better. :-D

~~~
justinmk
I am not sure "proof" is the appropriate word.

> Dumb Jump uses The Silver Searcher ag (and falls back to grep) ... [and] a
> set of regular expressions

If you're going to install ag, you might as well install universal-ctags[1], a
revival of ctags with many improved and new parsers. It allowed me to discard
my C and javascript ctags config entirely.

Combined with gutentags[2] you have a "just works" and "Less Dumb" setup.

[1] [https://github.com/universal-ctags/ctags](https://github.com/universal-
ctags/ctags)

[2] [https://github.com/ludovicchabant/vim-
gutentags](https://github.com/ludovicchabant/vim-gutentags)

~~~
gpderetta
The advantage of ag is that it is dumb brute (very brute) force. You do not
need an up to date index as it will search whatever is on disk.

I have rtags set up, but it periodically stops working (too many parsing
errors, indexer crashes, etc) or it is just slow, then I fall back to ag. It
can search a ~1M lines C++ codebase in seconds (and you can start browsing the
results while the search is in progress of course). Of couse it also works if
you do not have a project setup, or you just switched to a wildly diverged git
branch.

I'm definitely going to try this dumb-jump.

------
jekdoce
For C/C++ RTags
([https://github.com/Andersbakken/rtags](https://github.com/Andersbakken/rtags))
together with company-mode and fly-check can do jump-to-definition, auto-
completion and on-the-fly-syntax-checking. Super easy to use if using cmake as
build system.

Respond to this comment if you need pointers on how to set things up.

~~~
fizixer
Any equivalent options for make?

~~~
LazyGrizzly
For make you could use bear
([https://github.com/rizsotto/Bear](https://github.com/rizsotto/Bear)). It
allows you to generate a compilation database that is equivalent to that of
cmake projects.

------
t1amat
This is neat, and useful as a general purpose jump-to feature. It's probably
worth mentioning that some languages have packages with better functionality
for that language, such as tern-mode for JavaScript.

------
drewg123
I must be missing something, but what is the advantage of this over something
like Emacs Tags
([https://www.emacswiki.org/emacs/EmacsTags](https://www.emacswiki.org/emacs/EmacsTags))
?

~~~
vic8722
Building a tags file is not trivial.For example if you cloned a random
repository on github you'd want to just jump around and not have to have the
additional step of generating it and keeping it up to date.

~~~
parent5446
Can't it just be done automatically and on-the-fly using ctags or another
appropriate command?

~~~
pmontra
Maybe this changed in the last few years but the problem with TAGS files was
that you have to rebuild it at every change you make. I had a cron that
rebuilt the ones of the projects I was working on, but it's not efficient and
not up to date. Maybe a process that monitors changes to files is a better
approach. Still, rebuilding the TAGS file is useless if ag is fast enough.
SSDs and lots of RAM to cache files help.

The only problem with ag is that it can't find definitions until you save the
buffer to a file. Not that ctags does any better. Some tool running inside
emacs could do that too but it's not so important.

~~~
gpderetta
It shouldn't be too hard to write a grep-buffers command (I was using one
version for a while), exclude open files from ag searches and merge the result
of ag+grep-buffers in a single output (eh, in fact I should just write it).

------
sdegutis
I really love how well this works with Cider though, for Clojure projects. It
even lets you jump to the definition of Java or Clojure files that live
outside your current project, e.g. in third party libraries or even the Java
standard library. Why, just today I jumped to the definition of
java.time.Month because I had never actually seen a real live Java enum
before. (Sure enough, it's defined with the keyword `enum`. Neat!) Cider has
become essential to my Clojure workflow at work.

------
Myrmornis
This is cool, I've also been writing a similar emacs package: it uses `git
grep` and `git ls-files` to quickly find patterns and file names in the
current git repo, and has a simple interface for filtering the search results
to narrow down to what you were looking for (and also uses a regexp heuristic
for jumping to definitions).

[https://github.com/dandavison/emacs-search-
files](https://github.com/dandavison/emacs-search-files)

------
webaholic
What do people use to get something like this for C/C++? Also is there any
package for auto-completion in C/C++?

~~~
nodivbyzero
[http://tuhdo.github.io/c-ide.html](http://tuhdo.github.io/c-ide.html)

~~~
webaholic
Thanks! This worked the best out of all...

------
soamv
Nice! Just tried it out and it seems to work well.

Why does dumb-jump-go want me to save my files before jumping?

~~~
NoGravitas
I assume because it uses an external tool that looks at your files, not the
state of your emacs buffers, to find references.

------
mordocai
Nice package! Unfortunately is completely falling on its face for my ruby on
rails project, but I'm sure it can be improved.

~~~
mck-
Agreed. Was so hopeful that it would "just work". Still hopeful that it will
improve, because the README just sounds sooo good.

~~~
jacktasia
Sorry to hear it didn't work for you. Would you consider opening an issue on
github outlining what you were trying to do? Then you can be more than just
hopeful that it will improve.

------
peatfreak
Why is so much Emacs stuff hosted on GitHub these days? It seems antithetical
to the spirit of the project as a whole.

~~~
imtringued
As opposed to what? Buying a domain and hosting your own server? To answer
your question: Some small programs would probably not exist at all without a
service like github.

~~~
peatfreak
It's not necessary to buy a domain and host one's own server. For example,
there is [https://savannah.gnu.org/](https://savannah.gnu.org/) , which is
where Emacs itself is hosted.

------
dilap
this looks neat.

i notice one of the supported languages is go -- if you're doing much go, i
recommend installing godef and using go-mode.el. no tags files or anything
like that, and works perfectly well for jumping to definition.

(i also highly recommend gorename and guru.)

------
iKlsR
Still learning VIM user here, do we have something like this?

~~~
GregBuchholz
Are you aware of '*' and '#', and 'gd'?

[http://vim.wikia.com/wiki/Go_to_definition_using_g](http://vim.wikia.com/wiki/Go_to_definition_using_g)

~~~
sillysaurus3
It never seems to work for me. If I put the cursor over a word and type gd, it
seems to go to the first line that the word is mentioned, not necessarily the
definition. It's handy, for sure, but not too reliable. I think it can be
improved with some plugins though.

