Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs: opening any file in a large repo

Tags:

emacs

What I need

a fast/performant way to open any file under a large (git) repo (~9.8k files).

Context

I have tried various solutions, like Textmate.el and find-file-in-repository. I found these solutions via previous SO questions like this and this and through the LocateFilesAnywhere EmacsWiki.

While both solutions work wonderfully for small-to-mdeium repos, in this case they are practically unusable. When I start typing a filename, there's a delay of several seconds before I see any result. And changing any part of the search is very laggy too.

I think the main problem is that on typing any character, emacs/find-file-in-repository starts a shell command (git ls-files...). I really only need to do that when I have stopped typing.

Questions

  • is there a better library out there for this use-case?
  • if not, how can I introduce a delay into the command when I'm typing? i.e. while I'm in find-file-in-repository, I want the find-command to be invoked only when I stop typing (let's say a gap of 300ms).
like image 565
arnab Avatar asked Jan 14 '13 05:01

arnab


1 Answers

Summary

After I received the three answers I tried them out (also answering my own question as none of the above solutions worked for me). I finally settled for helm-ls-git. Here's a comparison from my point-of-view:

Projectile

  • took around 30 minutes to index the repo. Since projectile is not aware of .gitignore, the actual number of files is more like 52k.
  • can be customized but something that just works (i.e. understands git) is preferable
  • may need to invalidate cache re-index time to time. That would be costly and frequent since new files are added everyday to the repo.

helm-cmd-t

  • looked good from the description and the source.
  • hard to install since it's not published in melpa/marmalade etc. More details in this issue I opened up.

GNU Global

  • Didn't try as it's likely to have the same problems as Projectile (git-unaware, needs it's own "index" that may need to be maintained time to time)

event-jr's answer however opened up some more options: I was unaware of helm till now. Looking at melpa for helm related plugins I found the following:

helm-git

  • This looked really promising
  • Was easy to install with package.el since it's in melpa
  • I also use and love magit - so this looked a good fit.
  • However, it kept failing with a magit-git-dir: symbol is void kind of error. Did not dive in too much but looks like it needs to be updated. Opened up an issue

helm-ls-git

  • As the readme says, this is magit independent.
  • Has been working wonderfully so far. Easy to install (melpa) and is fast.
like image 95
arnab Avatar answered Sep 28 '22 12:09

arnab