Thursday, October 25, 2007

Using etags with emacs

1. First tag the entire code. Go to the first directory and run

$ etags `find . -name "*.c" -o -name "*.cpp" -o -name "*.h"`

This is if you are looking for C\CPP\H files. This will generate a "TAGS" file.

2. Open emacs and go to your code directory

3. Let emacs know about the tag file

M-x visit-tag-table [location of the TAGS file]

4. Select the function and do the following

M-. (which translates to ALT-.)

This would take you to the function anywhere in the entire directory structure

5. To go back use

M-*, which translates to ALT-SHIFT-*