Almost All You'll Ever Need to Know About Tag Tables

Almost All You'll Ever Need to Know About Tag Tables


I personally don't know how anyone ever gets anything done without using tag table files. In emacs (and vi, though I don't know how), you can go directly to any procedure or other definitions in your program (even across multiple files) using one command.

Tag tables

A tag table file is the file that emacs (or vi) uses to look up definitions. You can create a tag table file using etags (or ctags for vi).
           etags *.c *.h 
This will create a file called TAGS (tags for ctags) in the current directory. Anytime you add new procedures or files to your program, you must run etags again.

Using tag tables in emacs

To jump to the definition of a procedure (or macro or structure or whatever) in emacs, type "M-x find-tag" or "ESC ." (if you haven't changed the bindings) and type in the name of the definition you want (the default is the text string you were on when you type "ESC ."). It will also ask you for the location of the TAGS file, so it is convenient to have it in the same directory you are working in or somewhere near by.

cse451-TA@cs.washington.edu