(emacs)Find Tag


Next: Tags Search Prev: Select Tag Table Up: Tags

Finding a Tag
-------------

   The most important thing that a tag table enables you to do is to
find the definition of a specific tag.

`M-. TAG RET'
     Find first definition of TAG (`find-tag').

`C-u M-.'
     Find next alternate definition of last tag specified.

`C-u - M-.'
     Go back to previous tag found.

`M-x find-tag-regexp RET PATTERN RET'
     Find a tag whose name matches PATTERN.

`C-u M-x find-tag-regexp'
     Find the next tag whose name matches the last pattern used.

`C-x 4 . TAG RET'
     Find first definition of TAG, but display it in another window
     (`find-tag-other-window').

`C-x 5 . TAG RET'
     Find first definition of TAG, and create a new frame to select the
     buffer (`find-tag-other-frame').

   `M-.' (`find-tag') is the command to find the definition of a
specified tag.  It searches through the tag table for that tag, as a
string, and then uses the tag table info to determine the file that the
definition is in and the approximate character position in the file of
the definition.  Then `find-tag' visits that file, moves point to the
approximate character position, and searches ever-increasing distances
away to find the tag definition.

   If an empty argument is given (just type RET), the sexp in the
buffer before or around point is used as the TAG argument.  *Note
Lists::, for info on sexps.

   You don't need to give `M-.' the full name of the tag; a part will
do.  This is because `M-.' finds tags in the table which contain TAG as
a substring.  However, it prefers an exact match to a substring match.

   To find other tags that match the same substring, give `find-tag' a
numeric argument, as in `C-u M-.'; this does not read a tag name, but
continues searching the tag table's text for another tag containing the
same substring last used.  If you have a real META key, `M-0 M-.' is an
easier alternative to `C-u M-.'.

   Like most commands that can switch buffers, `find-tag' has a variant
that displays the new buffer in another window, and one that makes a
new frame for it.  The former is `C-x 4 .', which invokes the command
`find-tag-other-window'.  The latter is `C-x 5 .', which invokes
`find-tag-other-frame'.

   To move back to places you've found tags recently, use `C-u - M-.';
more generally, `M-.' with a negative numeric argument.  This command
can take you to another buffer.  `C-x 4 .' with a negative argument
finds the previous tag location in another window.

   The new command `M-x find-tag-regexp' visits the tags that match a
specified regular expression.  It is just like `M-.' except that it
does regexp matching instead of substring matching.

   Emacs comes with a tag table file `src/TAGS' that includes all the
Lisp libraries and all the C sources of Emacs.  By specifying this file
with `visit-tags-table' and then using `M-.' you can quickly find the
source for any Emacs function.


automatically generated by info2www