Next: , Previous: , Up: Maintaining   [Contents][Index]

28.3 Tags Tables

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 etags facility. See Semantic.

Next: , Previous: , Up: Maintaining   [Contents][Index]