7/13/09

How to use etags for emacs

1. Create tag files
a. In linux kernel tree just execute:
cd linux 2.6.27
make ARCH=arm TAGS

b. Else make your own tag files for your project
etags *.c *.h --output=TAGS

c. Quick command line to make tags in a code tree is:
find . -regex ".*\.[cChH]\(pp\)?" -print | etags -

2. To use tags in emacs
Load TAGS file with M-x visit tag table

Place cursor on a variable and press M-.

Emacs questions you which tag that you want to find, default the one that you have your cursor on. Press enter if correct.

Emacs questions which tag file you want to use, default TAGS, if correct press enter once more

3. Emacs jumps to the definition

If you want to jump to next occurence, press C-u M-.

4. Name completion

To get completion on a long function/variable name type the first letters and press M-tab