Go to the first, previous, next, last section, table of contents.

Create Your Own `TAGS' File

You can create your own `TAGS' file to help you jump to sources. For example, if you have a large number of files in your `~/emacs' directory, as I do--I have 137 `.el' files in it, of which I load 17-- you will find it easier to jump to specific functions if you create a `TAGS' file for that directory than if you search for the function name with grep or some other tool.

You can create a `TAGS' file by calling the etags program that comes as a part of the Emacs distribution. Usually, etags is compiled and installed when Emacs is built. (etags is not an Emacs Lisp function or a part of Emacs; it is a C program.)

To create a `TAGS' file, first switch to the directory in which you want to create the file. In Emacs you can do this with the M-x cd command, or by visiting a file in the directory, or by listing the directory with C-x d (dired). Then type

M-! etags *.el

to create a `TAGS' file. The etags program takes all the usual shell `wildcards'. For example, if you have two directories for which you want a single `TAGS file', type the command like this, where `../elisp/' is the second directory:

M-! etags  *.el ../elisp/*.el


M-! etags --help

to see a list of the options accepted by etags.

The etags program handles Emacs Lisp, Common Lisp, Scheme, C, Fortran, Pascal, LaTeX, and most assemblers. The program has no switches for specifying the language; it recognizes the language in an input file according to its file name and contents.

Also, `etags' is very helpful when you are writing code yourself and want to refer back to functions you have already written. Just run etags again at intervals as you write new functions, so they become part of the `TAGS' file.

Go to the first, previous, next, last section, table of contents.