Next: Running Lisp
Up: Compiling, debugging, and tags
Previous: Using GDB under Emacs
In UNIX terminology, a tag table is an index that tells how to
find the definition of any certain identifiers
(`tags') defined in some collection
of source files. In effect, it provides a smart, multi-file search
that is particularly useful when navigating in non-trivial
directories of source files. Typically, you set things up by
going into the directory
containing the source text to be indexed and issuing the UNIX command
etags options files
where files is a list of all the source files that need to be
indexed. This creates a file named `TAGS' containing the tag table.
For C programs, the tags are the names of functions defined in the
named source files.
The -t option causes etags to record typedef
declarations as well. The tag table produced is organized in such a way that
simple edits to a source file will not invalidate it.
The following Emacs commands deal with tag tables.
- M-x visit-tags-table
- prompts for the name of a tags table
file, and uses its contents in future tag-related searches.
- M-.
- prompts for a tag and then positions the current
window in the file containing its first definition and puts the cursor
on that definition. You may also give a null response (just RET), in
which case the word
before or around the point is used as the tag.
- C-u M-.
- finds the next alternate definition of the last
tag specified.
- C-x 4 .
- is the same as M-., but displays the text
containing the tag in the other window instead of the current one.
- M-x tags-search
- prompts and searches for a regular expression
as for C-M-s, but is does a non-incremental
search through all the files given in the
currently-visited tag table.
- M-x tags-query-replace
- acts like M-Q, but looks
through all the files given in the currently-visited tag table.
- M-,
- restarts the last tags-search or tags-query-replace from the current location of the point.
- M-x tags-apropos
- prompts for a regular expression and
displays a list of all tags in the
currently-visited table that match it.
Next: Running Lisp
Up: Compiling, debugging, and tags
Previous: Using GDB under Emacs
Karl W Knight
2003-01-05