Name

etags

Synopsis

    etags [options]files

Create a list of function and macro names defined in a programming source file. etags generates tags for use by emacs. (ctags produces an equivalent tags file for use with vi.) More than one file may be specified. etags understands many programming languages, including Ada, bison, C++, C, Cobol, Emacs Lisp/Common Lisp, Erlang, flex, Fortran, Java, Perl, Python, Scheme, TeX, and yacc. The output list (named TAGS by default) contains lines of the form:

              name     file     context

where name is the function or macro name, file is the source file in which name is defined, and context is a search pattern that shows the line of code containing name. After the list of tags is created, you can invoke Emacs on any file and type:

    M-x visit-tags-table

You will be prompted for the name of the tag table; the default is TAGS. To switch to the source file associated with the name listed in tagsfile, type:

    M-x find-tag

You will be prompted for the tag you would like Emacs to search for.

This entry documents the etags program shipped with GNU Emacs. A related ctags program is also included for generating a tags file for vi. Some of the options below only work with GNU ctags. The ctags entry in this chapter documents a different version of ctags, the Exuberant ctags.

Options

-a, --append

Append tag output to existing list of tags.

-C, --c++

Expect .c and .h files to contain C++, not C, code.

-d, --defines

Include tag entries for C preprocessor definitions.

--declarations

Create ...

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.