Sat, 01 Dec 2007

« Practical preparedness | MAIN | Benedict XVI and Lazarus Long »

Using etags with Mathematica code

For years I've avoided using emacs' tags table functions, but I finally had to break down and read about them tonight to search eficiently through a huge collection of Mathematica packages and applications.

After reading the fine manual it was easy to create a tags table of Mathematica function definitions and variable assignments:

cd topdir;
find . -name "*.m" -print | grep -v BrowserCategories.m | \
etags \
  --language=none \
  --regex='/\([A-Za-z0-9$]+\)[ \t]*=/\1/' \
  --regex='/\([A-Za-z0-9$]+\).*:=/\1/' -

The second regexp choked on a particular BrowserCategories.m; since they don't contain the definitions I'm looking for I removed them from consideration.

The two regexs find these sorts of things:

fact[1] = 1;
fact[n_] := n fact[n - 1]