7 Aug 2012 wainstead   » (Master)

How to teach ctags to read Cheetah template files:
1) Create a file in your home directory, .ctags (i.e. $HOME/.ctags).

2) Edit it:

--regex-cheetah=/^#def[ \t]*([a-zA-Z0-9_]+)/\1/d,definition/

(This assumes your Cheetah templates use the extension .tmpl. Change --langmap to suite your needs).

This is for Exuberant Ctags, not the stock one that ships on some systems. If you run ctags --version and it doesn't tell you it's Exuberant Ctags you probably have a different version.

Cheetah is a templating system used in Python programming. I use it at work and yesterday I finally decided to do something about Cheetah template support in my TAGS file (I use Emacs; vim users will use a file called "tags").

Be sure to run ctags again to generate a new tags file; you may need to tweak the command line flags so ctags picks up your template files:

ctags -e -R --languages=-html,python

It's neat that this can be accomplished just through command line flags! I thought about writing an extension or a patch in C, but this small bit of work does pretty much all I need.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!