CNK's Blog

Etags

Time to use ctags (or really etags in emacs). Most of the time I work on projects that are small enough that I can keep a lot of what I need to know in my head - or look up information from my frameworks on the internet. However, I am currently working on some code that I am having trouble sorting through. All of it is home grown - written by someone who no longer works with us - so no way to find documentation.

Parts of the code are quite clear and have been pretty easy to modify, but I am having trouble tracing the larger flow of data and messages. So perhaps the answer is a tool that would make it easier to go forward and back (particularly back) within the code.

It looks like I have ctags, however, a bunch of tutorials I have looked at suggest that one should use exuberant ctags instead of just plain ctags. May as well give that a try. The instructions in this blog post say you can just use brew install ctags-exuberant. That worked fine until the symlink stage when brew said I already had something at /usr/local/bin/ctags. Looks like ctags is one of the things that installed when Homebrew installed Emacs 24.1 for me. I might want to go back to that version, so I changed the name of that symlink to ctags-from-emacs and then reran the linking step. Now I see:

    $ /usr/local/bin/ctags --version
    Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
      Compiled: Jan 26 2013, 23:23:25
      Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
      Optional compiled features: +wildcards, +regex

And, more importantly, when I run ctags --list-languages I see Ruby in the list of supported languages, which I didn’t see in the ctags version that came with emacs.

I went looking for advice on how to generate my TAGS file and found mactag which will let you set up a configuration file to tell ctags which things you want indexed (your code, gems, etc) and where to find them. Looks pretty useful.