A tag is a reference to a subunit in a program or in a document. In source code, tags reference syntactic elements of the program: functions, subroutines, data types, macros, etc. In a document, tags reference chapters, sections, appendices, etc. Each tag specifies the name of the file where the corresponding subunit is defined, and the position of the subunit’s definition in that file.
A tags table records the tags extracted by scanning the source code of a certain program or a certain document. Tags extracted from generated files reference the original files, rather than the generated files that were scanned during tag extraction. Examples of generated files include C files generated from Cweb source files, from a Yacc parser, or from Lex scanner definitions; .i preprocessed C files; and Fortran files produced by preprocessing .fpp source files.
To produce a tags table, you run the
etags shell command
on a document or the source code file. The ‘etags’ program
writes the tags to a tags table file, or tags file in
short. The conventional name for a tags file is TAGS.
See Create Tags Table.
Emacs provides many commands for searching and replacing using the
information recorded in tags tables. For instance, the M-.
find-tag) jumps to the location of a specified function
definition in its source file. See Find Tag.
The Ebrowse facility is similar to
etags but specifically
tailored for C++. See Ebrowse in Ebrowse User’s
Manual. The Semantic package provides another way to generate and
use tags, separate from the
|• Tag Syntax:||Tag syntax for various types of code and text files.|
|• Create Tags Table:||Creating a tags table with |
|• Etags Regexps:||Create arbitrary tags using regular expressions.|
|• Select Tags Table:||How to visit a tags table.|
|• Find Tag:||Commands to find the definition of a specific tag.|
|• Tags Search:||Using a tags table for searching and replacing.|
|• List Tags:||Using tags for completion, and listing them.|