I love hearing the odd details of how other people work. Usually I’m hoping to learn something that will help me be more productive, and, if not, to hear about something delightfully awful, convoluted, and obscure.

Talking to Roland at JavaOne yielded a nice mix of both. One interesting thing is that he uses full-text search on his source and basically (AIUI) doesn’t run grep from inside Emacs. I, on the other hand, was a long-time igrep user, switching to rgrep (new in Emacs 22) recently.

I decided to give Roland’s approach a try.

First I took a look at namazu, since I knew it had some sort of Emacs integration, and because it is packaged in Fedora. Unfortunately it doesn’t seem to understand how to index source code.

So then I tried GNU idutils. I had heard of this years ago, and even tried it once or twice, but somehow it didn’t end up in my repertoire. Anyway, it turns out that this is a pretty nice tool. It isn’t packaged for Fedora, but building it only took a couple minutes. The Emacs support code needed some tweaks (email me if you want this), but works ok enough out of the box.

The result is pretty nice. For small projects it may not matter much, but searches over the code I’m indexing (GCC) are much, much faster. This is especially nice since the work I’m doing on GCC at the moment requires repeated searches for all the users of various global variables.

Idutils could use a little love — right now there’s no way to incrementally update the index, which is a pain. If it affects me enough I suppose I’ll set up a cron job or something using inotify. This is just gloss, though. The important thing is that it has removed a pointless wait from my process.

Share if you liked it


  • Hi, have you tried cscope with emacs? It’s very good for C/C++ projects.

  • Nope, for some reason I still haven’t tried cscope. I have it installed but I just haven’t gotten around to figuring out how to use it.

  • can you send me the fixed for idtools? cscope is good for the languages it was designed for (C, C++, lex, yacc).
    idtools is more generic and can process a wider range of languages since it is not as specialized.

  • tom — I’ll email you as well, but for others reading here, my patches are all in GNU idutils cvs.

  • I find idutils useful too. I’ve put Fedora 8 packages of idutils CVS here: . I’m going to try to get it accepted into Fedora.

  • The URL to my packages seems to have been stripped out. They’re at yum DOT phekda DOT org / fedora / F8

  • I’ve cleaned up the Emacs Lisp support for idutils a bit. But it doesn’t seem like it’s really maintained at all, so I’m not sure where to send the fix.

  • Oh — I see from the earlier comment that there are CVS sources somewhere…

  • Yeah — I cleaned up the elisp as well and Jim Meyering checked it in.
    Maybe your cleanup is better than mine 🙂

    BTW you can M-x package-install-file on the CVS idutils.el and it will DTRT.

    I occasionally contemplate making a new idutils that avoids the really complicated
    database stuff in favor of sqlite or the like, and also allows for incremental updates. I miss the latter feature a lot.

  • I had a design for incremental update ages ago, but never implemented it. For that matter, I hadn’t done a darn thing with idutils for so many years, I fired myself as maintainer. 8^)

    I never suffered much for lack of incremental update because a full rebuild was quick enough. I guess it’s not quick enough for you, Tom.

    At the time I first wrote it in C (1985), the very compact database format was an important feature. Nowadays, it doesn’t mean much.

    The first incarnation of idutils was written in Bourne shell and produced a text-file database that searchable with a small script wrapped around grep. I recall being inspired by sh examples in Kernighan & Pike’s book _The UNIX Programming Environment_.

  • Any idea where to find the original bash version?

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>