Follow coding conventions.
[emacs.git] / etc / etags.1
blob676cd868a146032090d5bedbd89409fb922fbdd5
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 .br
19 [\|\-\-append\|] [\|\-\-no\-defines\|]
20 [\|\-\-no\-globals\|] [\|\-\-include=\fIfile\fP\|]
21 [\|\-\-ignore\-indentation\|] [\|\-\-language=\fIlanguage\fP\|]
22 [\|\-\-members\|] [\|\-\-output=\fItagfile\fP\|]
23 [\|\-\-regex=\fIregexp\fP\|] [\|\-\-no\-regex\|]
24 [\|\-\-ignore\-case\-regex=\fIregexp\fP\|]
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 .br
32 [\|\-\-append\|] [\|\-\-backward\-search\|]
33 [\|\-\-cxref\|] [\|\-\-defines\|] [\|\-\-forward\-search\|]
34 [\|\-\-globals\|] [\|\-\-ignore\-indentation\|]
35 [\|\-\-language=\fIlanguage\fP\|] [\|\-\-members\|]
36 [\|\-\-output=\fItagfile\fP\|] [\|\-\-regex=\fIregexp\fP\|]
37 [\|\-\-ignore\-case\-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,
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\-o\fP \fItagfile\fP, \fB\-\-output=\fItagfile\fP
141 Explicit name of file for tag table; overrides default \fBTAGS\fP or
142 \fBtags\fP.   (But ignored with \fB\-v\fP or \fB\-x\fP.)
144 \fB\-r\fP \fIregexp\fP, \fB\-\-regex=\fIregexp\fP
146 \fB\-\-ignore\-case\-regex=\fIregexp\fP
147 Make tags based on regexp matching for each line of the files
148 following this option, in addition to the tags made with the standard
149 parsing based on language.  When using \fB\-\-regex\fP, case is
150 significant, while it is not with \fB\-\-ignore\-case\-regex\fP. May
151 be freely intermixed with filenames and the \fB\-R\fP option.  The
152 regexps are cumulative, i.e. each option will add to the previous
153 ones.  The regexps are of the form:
155         \fB/\fP\fItagregexp\fP[\fB/\fP\fInameregexp\fP]\fB/\fP
158 where \fItagregexp\fP is used to match the lines that must be tagged.
159 It should not match useless characters.  If the match is
160 such that more characters than needed are unavoidably matched by
161 \fItagregexp\fP, it may be useful to add a \fInameregexp\fP, to
162 narrow down the tag scope.  \fBctags\fP ignores regexps without a
163 \fInameregexp\fP.  The syntax of regexps is the same as in emacs.
165 Here are some examples.  All the regexps are quoted to protect them
166 from shell interpretation.
169 Tag the DEFVAR macros in the emacs source files:
171 \fI\-\-regex\='/[ \\t]*DEFVAR_[A-Z_ \\t(]+"\\([^"]+\\)"\/'\fP
172 .\"" This comment is to avoid confusion to Emacs syntax highlighting
175 Tag VHDL files (this example is a single long line, broken here for
176 formatting reasons):
178 \fI\-\-language\=none\ \-\-regex='/[\ \\t]*\\(ARCHITECTURE\\|\\
179 CONFIGURATION\\)\ +[^\ ]*\ +OF/'\ \-\-regex\='/[\ \\t]*\\
180 \\(ATTRIBUTE\\|ENTITY\\|FUNCTION\\|PACKAGE\\(\ BODY\\)?\\
181 \\|PROCEDURE\\|PROCESS\\|TYPE\\)[\ \\t]+\\([^\ \\t(]+\\)/\\3/'\fP
184 Tag TCL files (this last example shows the usage of a \fItagregexp\fP):
186 \fI\-\-lang\=none \-\-regex\='/proc[\ \\t]+\\([^\ \\t]+\\)/\\1/'\fP
189 A regexp can be preceded by {\fIlang\fP}, thus restricting it to match
190 lines of files of the specified language.  Use \fBetags --help\fP to obtain
191 a list of the recognised languages.  This feature is particularly useful inside
192 \fBregex files\fP.  A regex file contains one regex per line.  Empty lines,
193 and those lines beginning with space or tab are ignored.  Lines beginning
194 with @ are references to regex files whose name follows the @ sign.  Other
195 lines are considered regular expressions like those following \fB\-\-regex\fP.
197 For example, the command
199 \fIetags \-\-regex=@regex.file *.c\fP
201 reads the regexes contained in the file regex.file.
203 .B \-R, \-\-no\-regex
204 Don't do any more regexp matching on the following files.  May be
205 freely intermixed with filenames and the \fB\-\-regex\fP option.
207 .B \-t, \-\-typedefs
208 Record typedefs in C code as tags.  Since this is the default behaviour
209 of \fBetags\fP, only \fBctags\fP accepts this option.
211 .B \-T, \-\-typedefs\-and\-c++
212 Generate tag entries for typedefs, struct, enum, and union tags, and
213 C++ member functions.  Since this is the default behaviour
214 of \fBetags\fP, only \fBctags\fP accepts this option.
216 .B \-u, \-\-update
217 Update tag entries for \fIfiles\fP specified on command line, leaving
218 tag entries for other files in place.  Currently, this is implemented
219 by deleting the existing entries for the given files and then
220 rewriting the new entries at the end of the tags file.  It is often
221 faster to simply rebuild the entire tag file than to use this.
222 Only \fBctags\fP accepts this option.
224 .B \-v, \-\-vgrind
225 Instead of generating a tag file, write index (in \fBvgrind\fP format)
226 to standard output.  Only \fBctags\fP accepts this option.
228 .B \-w, \-\-no\-warn
229 Suppress warning messages about duplicate entries.  The \fBetags\fP
230 program does not check for duplicate entries, so this option is not
231 allowed with it.
233 .B \-x, \-\-cxref
234 Instead of generating a tag file, write a cross reference (in
235 \fBcxref\fP format) to standard output.  Only \fBctags\fP accepts this option.
237 .B \-h, \-H, \-\-help
238 Print usage information.
240 .B \-V, \-\-version
241 Print the current version of the program (same as the version of the
242 emacs \fBetags\fP is shipped with).
244 .SH "SEE ALSO"
245 `\|\fBemacs\fP\|' entry in \fBinfo\fP; \fIGNU Emacs Manual\fP, Richard
246 Stallman.
248 .BR cxref ( 1 ),
249 .BR emacs ( 1 ),
250 .BR vgrind ( 1 ),
251 .BR vi ( 1 ).
253 .SH COPYING
254 Copyright
255 .if t \(co
256 .if n (c)
257 1999, 2001 Free Software Foundation, Inc.
259 Permission is granted to make and distribute verbatim copies of this
260 document provided the copyright notice and this permission notice are
261 preserved on all copies.
263 Permission is granted to copy and distribute modified versions of
264 this document under the conditions for verbatim copying, provided that
265 the entire resulting derived work is distributed under the terms of
266 a permission notice identical to this one.
268 Permission is granted to copy and distribute translations of this
269 document into another language, under the above conditions for
270 modified versions, except that this permission notice may be stated
271 in a translation approved by the Free Software Foundation.