*** empty log message ***
[emacs.git] / etc / etags.1
blob0d08f8df95608c9cb41ae86160eeb997a1d8c93f
1 .\" Copyright (c) 1992, 2001 Free Software Foundation
2 .\" See section COPYING for conditions for redistribution
3 .TH etags 1 "23nov2001" "GNU Tools" "GNU Tools"
4 .de BP
5 .sp
6 .ti -.2i
7 \(**
8 ..
10 .SH NAME
11 etags, ctags \- generate tag file for Emacs, vi
12 .SH SYNOPSIS
13 .hy 0
14 .na
15 \fBetags\fP [\|\-aCDGImRVh\|] [\|\-i \fIfile\fP\|] [\|\-l \fIlanguage\fP\|]
16 .if n .br
17 [\|\-o \fItagfile\fP\|] [\|\-r \fIregexp\fP\|]
18 [\|\-\-parse\-stdin=\fIfile\fP\|]
19 .br
20 [\|\-\-append\|] [\|\-\-no\-defines\|]
21 [\|\-\-no\-globals\|] [\|\-\-include=\fIfile\fP\|]
22 [\|\-\-ignore\-indentation\|] [\|\-\-language=\fIlanguage\fP\|]
23 [\|\-\-members\|] [\|\-\-output=\fItagfile\fP\|]
24 [\|\-\-regex=\fIregexp\fP\|] [\|\-\-no\-regex\|]
25 [\|\-\-help\|] [\|\-\-version\|]
26 \fIfile\fP .\|.\|.
28 \fBctags\fP [\|\-aCdgImRVh\|] [\|\-BtTuvwx\|] [\|\-l \fIlanguage\fP\|]
29 .if n .br
30 [\|\-o \fItagfile\fP\|] [\|\-r \fIregexp\fP\|]
31 [\|\-\-parse\-stdin=\fIfile\fP\|]
32 .br
33 [\|\-\-append\|] [\|\-\-backward\-search\|]
34 [\|\-\-cxref\|] [\|\-\-defines\|] [\|\-\-forward\-search\|]
35 [\|\-\-globals\|] [\|\-\-ignore\-indentation\|]
36 [\|\-\-language=\fIlanguage\fP\|] [\|\-\-members\|]
37 [\|\-\-output=\fItagfile\fP\|] [\|\-\-regex=\fIregexp\fP\|]
38 [\|\-\-typedefs\|] [\|\-\-typedefs\-and\-c++\|]
39 [\|\-\-update\|] [\|\-\-no\-warn\|]
40 [\|\-\-help\|] [\|\-\-version\|]
41 \fIfile\fP .\|.\|.
42 .ad b
43 .hy 1
44 .SH DESCRIPTION
45 The \|\fBetags\fP\| program is used to create a tag table file, in a format
46 understood by
47 .BR emacs ( 1 )\c
48 \&; the \|\fBctags\fP\| program is used to create a similar table in a
49 format understood by
50 .BR vi ( 1 )\c
51 \&.  Both forms of the program understand
52 the syntax of C, Objective C, C++, Java, Fortran, Ada, Cobol, Erlang, HTML,
53 LaTeX, Emacs Lisp/Common Lisp, makefiles, Pascal, Perl, PHP, Postscript,
54 Python, Prolog, Scheme and
55 most assembler\-like syntaxes.
56 Both forms read the files specified on the command line, and write a tag
57 table (defaults: \fBTAGS\fP for \fBetags\fP, \fBtags\fP for
58 \fBctags\fP) in the current working directory.
59 Files specified with relative file names will be recorded in the tag
60 table with file names relative to the directory where the tag table
61 resides.  Files specified with absolute file names will be recorded
62 with absolute file names.  Files generated from a source file\-\-like
63 a C file generated from a source Cweb file\-\-will be recorded with
64 the name of the source file.
65 The programs recognize the language used in an input file based on its
66 file name and contents.  The \fB\-\-language\fP switch can be used to force
67 parsing of the file names following the switch according to the given
68 language, overriding guesses based on filename extensions.
69 .SH OPTIONS
70 Some options make sense only for the \fBvi\fP style tag files produced
71 by ctags;
72 \fBetags\fP does not recognize them.
73 The programs accept unambiguous abbreviations for long option names.
74 .TP
75 .B \-a, \-\-append
76 Append to existing tag file.  (For \fBvi\fP-format tag files, see also
77 \fB\-\-update\fP.)
78 .TP
79 .B \-B, \-\-backward\-search
80 Tag files written in the format expected by \fBvi\fP contain regular
81 expression search instructions; the \fB\-B\fP option writes them using
82 the delimiter `\|\fB?\fP\|', to search \fIbackwards\fP through files.
83 The default is to use the delimiter `\|\fB/\fP\|', to search \fIforwards\fP
84 through files.
85 Only \fBctags\fP accepts this option.
86 .TP
87 .B \-\-declarations
88 In C and derived languages, create tags for function declarations,
89 and create tags for extern variables unless \-\-no\-globals is used.
90 .TP
91 .B \-d, \-\-defines
92 Create tag entries for C preprocessor constant definitions
93 and enum constants, too.  This is the
94 default behavior for \fBetags\fP.
95 .TP
96 .B \-D, \-\-no\-defines
97 Do not create tag entries for C preprocessor constant definitions
98 and enum constants.
99 This may make the tags file much smaller if many header files are tagged.
100 This is the default behavior for \fBctags\fP.
102 .B \-g, \-\-globals
103 Create tag entries for global variables in C, C++, Objective C, Java,
104 and Perl.
105 This is the default behavior for \fBetags\fP.
107 .B \-G, \-\-no\-globals
108 Do not tag global variables.  Typically this reduces the file size by
109 one fourth.  This is the default behavior for \fBctags\fP.
111 \fB\-i\fP \fIfile\fP, \fB\-\-include=\fIfile\fP
112 Include a note in the tag file indicating that, when searching for a
113 tag, one should also consult the tags file \fIfile\fP after checking the
114 current file.  This options is only accepted by \fBetags\fP.
116 .B \-I, \-\-ignore\-indentation
117 Don't rely on indentation as much as we normally do.  Currently, this
118 means not to assume that a closing brace in the first column is the
119 final brace of a function or structure definition in C and C++.
121 \fB\-l\fP \fIlanguage\fP, \fB\-\-language=\fIlanguage\fP
122 Parse the following files according to the given language.  More than
123 one such options may be intermixed with filenames.  Use \fB\-\-help\fP
124 to get a list of the available languages and their default filename
125 extensions.  The `auto' language can be used to restore automatic
126 detection of language based on the file name.  The `none'
127 language may be used to disable language parsing altogether; only
128 regexp matching is done in this case (see the \fB\-\-regex\fP option).
130 .B \-m, \-\-members
131 Create tag entries for variables that are members of structure-like
132 constructs in C++, Objective C, Java.
134 .B \-M, \-\-no\-members
135 Do not tag member variables.  This is the default behavior.
137 .B \-\-packages\-only
138 Only tag packages in Ada files.
140 \fB\-\-parse\-stdin=\fIfile\fP
141 May be used (only once) in place of a file name on the command line.
142 \fBetags\fP will read from standard input and mark the produced tags
143 as belonging to the file \fBFILE\fP.
145 \fB\-o\fP \fItagfile\fP, \fB\-\-output=\fItagfile\fP
146 Explicit name of file for tag table; overrides default \fBTAGS\fP or
147 \fBtags\fP.   (But ignored with \fB\-v\fP or \fB\-x\fP.)
149 \fB\-r\fP \fIregexp\fP, \fB\-\-regex=\fIregexp\fP
151 Make tags based on regexp matching for the files following this option,
152 in addition to the tags made with the standard parsing based on
153 language. May be freely intermixed with filenames and the \fB\-R\fP
154 option.  The regexps are cumulative, i.e. each such option will add to
155 the previous ones.  The regexps are of one of the forms:
157         [\fB{\fP\fIlanguage\fP\fB}\fP]\fB/\fP\fItagregexp/\fP[\fInameregexp\fP\fB/\fP]\fImodifiers\fP
159         \fB@\fP\fIregexfile\fP
162 where \fItagregexp\fP is used to match the tag.  It should not match
163 useless characters.  If the match is such that more characters than
164 needed are unavoidably matched by \fItagregexp\fP, it may be useful to
165 add a \fInameregexp\fP, to narrow down the tag scope.  \fBctags\fP
166 ignores regexps without a \fInameregexp\fP.  The syntax of regexps is
167 the same as in emacs.  The following character escape sequences are
168 supported: \\a, \\b, \\d, \\e, \\f, \\n, \\r, \\t, \\v, which
169 respectively stand for the ASCII characters BEL, BS, DEL, ESC, FF, NL,
170 CR, TAB, VT.
172 The \fImodifiers\fP are a sequence of 0 or more characters among
173 \fIi\fP, which means to ignore case when matching; \fIm\fP, which means
174 that the \fItagregexp\fP will be matched against the whole file contents
175 at once, rather than line by line, and the matching sequence can match
176 multiple lines; and \fIs\fP, which implies \fIm\fP and means that the
177 dot character in \fItagregexp\fP matches the newline char as well.
179 The separator, which is \fB/\fP in the examples, can be any character
180 different from space, tab, braces and \fB@\fP.  If the separator
181 character is needed inside the regular expression, it must be quoted
182 by preceding it with \fB\\\fP.
184 The optional \fB{\fP\fIlanguage\fP\fB}\fP prefix means that the tag
185 should be
186 created only for files of language \fIlanguage\fP, and ignored
187 otherwise.  This is particularly useful when storing many predefined
188 regexps in a file.
190 In its second form, \fIregexfile\fP is the name of a file that contains
191 a number of arguments to the \fI\-\-regex\=\fP option,
192 one per line.  Lines beginning with a space or tab are assumed
193 to be comments, and ignored.
196 Here are some examples.  All the regexps are quoted to protect them
197 from shell interpretation.
200 Tag the DEFVAR macros in the emacs source files:
202 \fI\-\-regex\='/[ \\t]*DEFVAR_[A-Z_ \\t(]+"\\([^"]+\\)"\/'\fP
203 .\"" This comment is to avoid confusion to Emacs syntax highlighting
206 Tag VHDL files (this example is a single long line, broken here for
207 formatting reasons):
209 \fI\-\-language\=none\ \-\-regex='/[\ \\t]*\\(ARCHITECTURE\\|\\
210 CONFIGURATION\\)\ +[^\ ]*\ +OF/'\ \-\-regex\='/[\ \\t]*\\
211 \\(ATTRIBUTE\\|ENTITY\\|FUNCTION\\|PACKAGE\\(\ BODY\\)?\\
212 \\|PROCEDURE\\|PROCESS\\|TYPE\\)[\ \\t]+\\([^\ \\t(]+\\)/\\3/'\fP
215 Tag TCL files (this last example shows the usage of a \fItagregexp\fP):
217 \fI\-\-lang\=none \-\-regex\='/proc[\ \\t]+\\([^\ \\t]+\\)/\\1/'\fP
220 A regexp can be preceded by {\fIlang\fP}, thus restricting it to match
221 lines of files of the specified language.  Use \fBetags --help\fP to obtain
222 a list of the recognised languages.  This feature is particularly useful inside
223 \fBregex files\fP.  A regex file contains one regex per line.  Empty lines,
224 and those lines beginning with space or tab are ignored.  Lines beginning
225 with @ are references to regex files whose name follows the @ sign.  Other
226 lines are considered regular expressions like those following \fB\-\-regex\fP.
228 For example, the command
230 \fIetags \-\-regex=@regex.file *.c\fP
232 reads the regexes contained in the file regex.file.
234 .B \-R, \-\-no\-regex
235 Don't do any more regexp matching on the following files.  May be
236 freely intermixed with filenames and the \fB\-\-regex\fP option.
238 .B \-t, \-\-typedefs
239 Record typedefs in C code as tags.  Since this is the default behavior
240 of \fBetags\fP, only \fBctags\fP accepts this option.
242 .B \-T, \-\-typedefs\-and\-c++
243 Generate tag entries for typedefs, struct, enum, and union tags, and
244 C++ member functions.  Since this is the default behavior
245 of \fBetags\fP, only \fBctags\fP accepts this option.
247 .B \-u, \-\-update
248 Update tag entries for \fIfiles\fP specified on command line, leaving
249 tag entries for other files in place.  Currently, this is implemented
250 by deleting the existing entries for the given files and then
251 rewriting the new entries at the end of the tags file.  It is often
252 faster to simply rebuild the entire tag file than to use this.
253 Only \fBctags\fP accepts this option.
255 .B \-v, \-\-vgrind
256 Instead of generating a tag file, write index (in \fBvgrind\fP format)
257 to standard output.  Only \fBctags\fP accepts this option.
259 .B \-w, \-\-no\-warn
260 Suppress warning messages about duplicate entries.  The \fBetags\fP
261 program does not check for duplicate entries, so this option is not
262 allowed with it.
264 .B \-x, \-\-cxref
265 Instead of generating a tag file, write a cross reference (in
266 \fBcxref\fP format) to standard output.  Only \fBctags\fP accepts this option.
268 .B \-h, \-H, \-\-help
269 Print usage information.
271 .B \-V, \-\-version
272 Print the current version of the program (same as the version of the
273 emacs \fBetags\fP is shipped with).
275 .SH "SEE ALSO"
276 `\|\fBemacs\fP\|' entry in \fBinfo\fP; \fIGNU Emacs Manual\fP, Richard
277 Stallman.
279 .BR cxref ( 1 ),
280 .BR emacs ( 1 ),
281 .BR vgrind ( 1 ),
282 .BR vi ( 1 ).
284 .SH COPYING
285 Copyright
286 .if t \(co
287 .if n (c)
288 1999, 2001 Free Software Foundation, Inc.
290 Permission is granted to make and distribute verbatim copies of this
291 document provided the copyright notice and this permission notice are
292 preserved on all copies.
294 Permission is granted to copy and distribute modified versions of
295 this document under the conditions for verbatim copying, provided that
296 the entire resulting derived work is distributed under the terms of
297 a permission notice identical to this one.
299 Permission is granted to copy and distribute translations of this
300 document into another language, under the above conditions for
301 modified versions, except that this permission notice may be stated
302 in a translation approved by the Free Software Foundation.