{
    "mode": "man",
    "parameter": "ctags.emacs",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/ctags.emacs/1/json",
    "generated": "2026-05-30T06:08:47Z",
    "synopsis": "etags [-aCDGIQRVh] [-i file] [-l language]\n[-o tagfile] [-r regexp] [--parse-stdin=file]\n[--append] [--no-defines] [--globals] [--no-globals] [--no-line-directive] [--include=file]\n[--ignore-indentation] [--language=language] [--members] [--no-members] [--output=tagfile]\n[--class-qualify] [--regex=regexp] [--no-regex] [--help] [--version] file ...\nctags [-aCdgIQRVh] [-BtTuvwx] [-l language]\n[-o tagfile] [-r regexp] [--parse-stdin=file]\n[--append] [--backward-search] [--cxref] [--no-defines] [--globals] [--no-globals]\n[--no-line-directive] [--ignore-indentation] [--language=language] [--members] [--no-members]\n[--class-qualify] [--output=tagfile] [--regex=regexp] [--update] [--help] [--version] file\n...",
    "sections": {
        "NAME": {
            "content": "etags, ctags - generate tag file for Emacs, vi\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "etags [-aCDGIQRVh] [-i file] [-l language]\n[-o tagfile] [-r regexp] [--parse-stdin=file]\n[--append] [--no-defines] [--globals] [--no-globals] [--no-line-directive] [--include=file]\n[--ignore-indentation] [--language=language] [--members] [--no-members] [--output=tagfile]\n[--class-qualify] [--regex=regexp] [--no-regex] [--help] [--version] file ...\n\nctags [-aCdgIQRVh] [-BtTuvwx] [-l language]\n[-o tagfile] [-r regexp] [--parse-stdin=file]\n[--append] [--backward-search] [--cxref] [--no-defines] [--globals] [--no-globals]\n[--no-line-directive] [--ignore-indentation] [--language=language] [--members] [--no-members]\n[--class-qualify] [--output=tagfile] [--regex=regexp] [--update] [--help] [--version] file\n...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The etags program is used to create a tag table file, in a format understood by emacs(1); the\nctags  program is used to create a similar table in a format understood by vi(1).  Both forms\nof the program understand the syntax of C, Objective C, C++, Java, Fortran, Ada,  Cobol,  Er‐\nlang, Forth, Go, HTML, LaTeX, Emacs Lisp/Common Lisp, Lua, Makefile, Pascal, Perl, Ruby, PHP,\nPostScript, Python, Prolog, Scheme and most assembler-like syntaxes.   Both  forms  read  the\nfiles  specified  on  the command line, and write a tag table (defaults: TAGS for etags, tags\nfor ctags) in the current working directory.  Files specified with relative file  names  will\nbe  recorded  in  the tag table with file names relative to the directory where the tag table\nresides.  If the tag table is in /dev or is the standard output, however, the file names  are\nmade  relative  to  the  working directory.  Files specified with absolute file names will be\nrecorded with absolute file names.  Files generated from a source file--like a C file  gener‐\nated  from a source Cweb file--will be recorded with the name of the source file.  Compressed\nfiles are supported using gzip, bzip2, xz, and zstd.  The  programs  recognize  the  language\nused in an input file based on its file name and contents.  The --language switch can be used\nto force parsing of the file names following the switch  according  to  the  given  language,\noverriding guesses based on filename extensions.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Some  options  make  sense  only for the vi style tag files produced by ctags; etags does not\nrecognize them.  The programs accept unambiguous abbreviations for long option names.\n",
            "subsections": [
                {
                    "name": "-a, --append",
                    "content": "Append to existing tag file.  (For vi-format tag files, see also --update.)\n",
                    "flag": "-a",
                    "long": "--append"
                },
                {
                    "name": "-B, --backward-search",
                    "content": "Tag files written in the format expected by vi contain regular expression  search  in‐\nstructions;  the  -B  option  writes them using the delimiter \"?\", to search backwards\nthrough files.  The default is to use the delimiter \"/\", to  search  forwards  through\nfiles.  Only ctags accepts this option.\n",
                    "flag": "-B",
                    "long": "--backward-search"
                },
                {
                    "name": "--declarations",
                    "content": "In C and derived languages, create tags for function declarations, and create tags for\nextern variables unless --no-globals is used.  In Lisp, create tags for  (defvar  foo)\ndeclarations.\n",
                    "long": "--declarations"
                },
                {
                    "name": "-D, --no-defines",
                    "content": "Do  not create tag entries for C preprocessor constant definitions and enum constants.\nThis may make the tags file much smaller if many header files are tagged.\n",
                    "flag": "-D",
                    "long": "--no-defines"
                },
                {
                    "name": "--globals",
                    "content": "Create tag entries for global variables in Perl and Makefile.  This is the default  in\nC and derived languages.\n",
                    "long": "--globals"
                },
                {
                    "name": "--no-globals",
                    "content": "Do  not  tag  global variables in C and derived languages.  Typically this reduces the\nfile size by one fourth.\n",
                    "long": "--no-globals"
                },
                {
                    "name": "--no-line-directive",
                    "content": "Ignore #line preprocessor directives in C and derived languages.  The  default  is  to\nhonor  those  directives, and record the tags as if the file scanned was the one named\nin the #line directive.  This switch is useful when the original file named  by  #line\nis no longer available.\n",
                    "long": "--no-line-directive"
                },
                {
                    "name": "-i --include=",
                    "content": "Include  a  note in the tag file indicating that, when searching for a tag, one should\nalso consult the tags file file after checking the current file.  Only  etags  accepts\nthis option.\n",
                    "flag": "-i"
                },
                {
                    "name": "-I, --ignore-indentation",
                    "content": "Don't rely on indentation as much as we normally do.  Currently, this means not to as‐\nsume that a closing brace in the first column is the final  brace  of  a  function  or\nstructure definition in C and C++.\n",
                    "flag": "-I",
                    "long": "--ignore-indentation"
                },
                {
                    "name": "-l --language=",
                    "content": "Parse the following files according to the given language.  More than one such options\nmay be intermixed with filenames.  Use --help to get a list of the available languages\nand their default filename extensions.  The \"auto\" language can be used to restore au‐\ntomatic detection of language based on the file name.  The \"none\" language may be used\nto disable language parsing altogether; only regexp matching is done in this case (see\nthe --regex option).\n",
                    "flag": "-l"
                },
                {
                    "name": "--members",
                    "content": "Create tag entries for variables that are members of structure-like constructs in PHP.\nThis is the default for C and derived languages.\n",
                    "long": "--members"
                },
                {
                    "name": "--no-members",
                    "content": "Do not tag member variables.\n",
                    "long": "--no-members"
                },
                {
                    "name": "--packages-only",
                    "content": "Only tag packages in Ada files.\n\n--parse-stdin=file\nMay  be used (only once) in place of a file name on the command line.  etags will read\nfrom standard input and mark the produced tags as belonging to the file FILE.\n",
                    "long": "--packages-only"
                },
                {
                    "name": "-Q, --class-qualify",
                    "content": "Qualify tag names with their class name in C++, ObjC, Java, and Perl.   This  produces\ntag names of the form class::member for C++ and Perl, class(category) for Objective C,\nand class.member for Java.  For Objective C, this also produces class  methods  quali‐\nfied with their arguments, as in foo:bar:baz:more.\n",
                    "flag": "-Q",
                    "long": "--class-qualify"
                },
                {
                    "name": "-o --output=",
                    "content": "Explicit  name  of file for tag table; for etags only, a file name of - means standard\noutput; overrides default TAGS or tags.  (But ignored with -v or -x.)\n",
                    "flag": "-o"
                },
                {
                    "name": "-r --regex=",
                    "content": "Make tags based on regexp matching for the files following this option, in addition to\nthe  tags  made  with the standard parsing based on language. May be freely intermixed\nwith filenames and the -R option.  The regexps are cumulative, i.e., each such  option\nwill add to the previous ones.  The regexps are of one of the forms:\n[{language}]/tagregexp/[nameregexp/]modifiers\n@regexfile\n\nwhere tagregexp is used to match the tag.  It should not match useless characters.  If\nthe match is such that more characters than needed are unavoidably matched by  tagreg‐\nexp,  it  may  be useful to add a nameregexp, to narrow down the tag scope.  ctags ig‐\nnores regexps without a nameregexp.  The syntax of regexps is the same  as  in  emacs.\nThe  following  character  escape sequences are supported: \\a, \\b, \\d, \\e, \\f, \\n, \\r,\n\\t, \\v, which respectively stand for the ASCII characters BEL, BS, DEL, ESC,  FF,  NL,\nCR, TAB, VT.\nThe  modifiers  are  a sequence of 0 or more characters among i, which means to ignore\ncase when matching; m, which means that the tagregexp  will  be  matched  against  the\nwhole  file  contents at once, rather than line by line, and the matching sequence can\nmatch multiple lines; and s, which implies m and  means  that  the  dot  character  in\ntagregexp matches the newline char as well.\nThe  separator, which is / in the examples, can be any character different from space,\ntab, braces and @.  If the separator character is needed inside  the  regular  expres‐\nsion, it must be quoted by preceding it with \\.\nThe  optional {language} prefix means that the tag should be created only for files of\nlanguage language, and ignored otherwise.  This is particularly  useful  when  storing\nmany predefined regexps in a file.\nIn  its  second  form, regexfile is the name of a file that contains a number of argu‐\nments to the --regex= option, one per line.  Lines beginning with a space or  tab  are\nassumed to be comments, and ignored.\n\nHere  are some examples.  All the regexps are quoted to protect them from shell inter‐\npretation.\n\nTag the DEFVAR macros in the emacs source files:\n--regex='/[ \\t]*DEFVAR[A-Z \\t(]+\"\\([^\"]+\\)\"/'\n\nTag VHDL files (this example is a single long line, broken here  for  formatting  rea‐\nsons):\n--language=none --regex='/[ \\t]*\\(ARCHITECTURE\\|\\                           CONFIGURA‐\nTION\\) +[^ ]* +OF/' --regex='/[ \\t]*\\             \\(ATTRIBUTE\\|ENTITY\\|FUNCTION\\|PACK‐\nAGE\\( BODY\\)?\\ \\|PROCEDURE\\|PROCESS\\|TYPE\\)[ \\t]+\\([^ \\t(]+\\)/\\3/'\n\nTag TCL files (this last example shows the usage of a tagregexp):\n--lang=none --regex='/proc[ \\t]+\\([^ \\t]+\\)/\\1/'\n\nA regexp can be preceded by {lang}, thus restricting it to match lines of files of the\nspecified language.  Use etags --help to obtain a list of  the  recognized  languages.\nThis  feature  is  particularly  useful inside regex files.  A regex file contains one\nregex per line.  Empty lines, and those lines beginning with space or tab are ignored.\nLines  beginning  with  @ are references to regex files whose name follows the @ sign.\nOther lines are considered regular expressions like those following --regex.\nFor example, the command\netags --regex=@regex.file *.c\nreads the regexes contained in the file regex.file.\n",
                    "flag": "-r"
                },
                {
                    "name": "-R, --no-regex",
                    "content": "Don't do any more regexp matching on the following files.  May  be  freely  intermixed\nwith filenames and the --regex option.\n",
                    "flag": "-R",
                    "long": "--no-regex"
                },
                {
                    "name": "-u, --update",
                    "content": "Update  tag entries for files specified on command line, leaving tag entries for other\nfiles in place.  Currently, this is implemented by deleting the existing  entries  for\nthe given files and then rewriting the new entries at the end of the tags file.  It is\noften faster to simply rebuild the entire tag file than to use this.  Only  ctags  ac‐\ncepts this option.\n",
                    "flag": "-u",
                    "long": "--update"
                },
                {
                    "name": "-v, --vgrind",
                    "content": "Instead  of  generating a tag file, write index (in vgrind format) to standard output.\nOnly ctags accepts this option.\n",
                    "flag": "-v",
                    "long": "--vgrind"
                },
                {
                    "name": "-x, --cxref",
                    "content": "Instead of generating a tag file, write a cross reference (in cxref format)  to  stan‐\ndard output.  Only ctags accepts this option.\n",
                    "flag": "-x",
                    "long": "--cxref"
                },
                {
                    "name": "-h, -H, --help",
                    "content": "Print  usage information.  Followed by one or more --language=LANG prints detailed in‐\nformation about how tags are created for LANG.\n",
                    "flag": "-H",
                    "long": "--help"
                },
                {
                    "name": "-V, --version",
                    "content": "Print the current version of the program (same as the version of the  emacs  etags  is\nshipped with).\n\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "SEE ALSO": {
            "content": "\"emacs\" entry in info; GNU Emacs Manual, Richard Stallman.\ncxref(1), emacs(1), vgrind(1), vi(1).\n\n",
            "subsections": []
        },
        "COPYING": {
            "content": "Copyright 1992, 1999, 2001-2020 Free Software Foundation, Inc.\n\nPermission  is  granted  to make and distribute verbatim copies of this document provided the\ncopyright notice and this permission notice are preserved on all copies.\n\nPermission is granted to copy and distribute modified versions of  this  document  under  the\nconditions  for verbatim copying, provided that the entire resulting derived work is distrib‐\nuted under the terms of a permission notice identical to this one.\n\nPermission is granted to copy and distribute translations of this document into another  lan‐\nguage,  under  the above conditions for modified versions, except that this permission notice\nmay be stated in a translation approved by the Free Software Foundation.\n\n\n\nGNU Tools                                     23nov2001                                     etags(1)",
            "subsections": []
        }
    },
    "summary": "etags, ctags - generate tag file for Emacs, vi",
    "flags": [
        {
            "flag": "-a",
            "long": "--append",
            "arg": null,
            "description": "Append to existing tag file. (For vi-format tag files, see also --update.)"
        },
        {
            "flag": "-B",
            "long": "--backward-search",
            "arg": null,
            "description": "Tag files written in the format expected by vi contain regular expression search in‐ structions; the -B option writes them using the delimiter \"?\", to search backwards through files. The default is to use the delimiter \"/\", to search forwards through files. Only ctags accepts this option."
        },
        {
            "flag": "",
            "long": "--declarations",
            "arg": null,
            "description": "In C and derived languages, create tags for function declarations, and create tags for extern variables unless --no-globals is used. In Lisp, create tags for (defvar foo) declarations."
        },
        {
            "flag": "-D",
            "long": "--no-defines",
            "arg": null,
            "description": "Do not create tag entries for C preprocessor constant definitions and enum constants. This may make the tags file much smaller if many header files are tagged."
        },
        {
            "flag": "",
            "long": "--globals",
            "arg": null,
            "description": "Create tag entries for global variables in Perl and Makefile. This is the default in C and derived languages."
        },
        {
            "flag": "",
            "long": "--no-globals",
            "arg": null,
            "description": "Do not tag global variables in C and derived languages. Typically this reduces the file size by one fourth."
        },
        {
            "flag": "",
            "long": "--no-line-directive",
            "arg": null,
            "description": "Ignore #line preprocessor directives in C and derived languages. The default is to honor those directives, and record the tags as if the file scanned was the one named in the #line directive. This switch is useful when the original file named by #line is no longer available."
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": "Include a note in the tag file indicating that, when searching for a tag, one should also consult the tags file file after checking the current file. Only etags accepts this option."
        },
        {
            "flag": "-I",
            "long": "--ignore-indentation",
            "arg": null,
            "description": "Don't rely on indentation as much as we normally do. Currently, this means not to as‐ sume that a closing brace in the first column is the final brace of a function or structure definition in C and C++."
        },
        {
            "flag": "-l",
            "long": null,
            "arg": null,
            "description": "Parse the following files according to the given language. More than one such options may be intermixed with filenames. Use --help to get a list of the available languages and their default filename extensions. The \"auto\" language can be used to restore au‐ tomatic detection of language based on the file name. The \"none\" language may be used to disable language parsing altogether; only regexp matching is done in this case (see the --regex option)."
        },
        {
            "flag": "",
            "long": "--members",
            "arg": null,
            "description": "Create tag entries for variables that are members of structure-like constructs in PHP. This is the default for C and derived languages."
        },
        {
            "flag": "",
            "long": "--no-members",
            "arg": null,
            "description": "Do not tag member variables."
        },
        {
            "flag": "",
            "long": "--packages-only",
            "arg": null,
            "description": "Only tag packages in Ada files. --parse-stdin=file May be used (only once) in place of a file name on the command line. etags will read from standard input and mark the produced tags as belonging to the file FILE."
        },
        {
            "flag": "-Q",
            "long": "--class-qualify",
            "arg": null,
            "description": "Qualify tag names with their class name in C++, ObjC, Java, and Perl. This produces tag names of the form class::member for C++ and Perl, class(category) for Objective C, and class.member for Java. For Objective C, this also produces class methods quali‐ fied with their arguments, as in foo:bar:baz:more."
        },
        {
            "flag": "-o",
            "long": null,
            "arg": null,
            "description": "Explicit name of file for tag table; for etags only, a file name of - means standard output; overrides default TAGS or tags. (But ignored with -v or -x.)"
        },
        {
            "flag": "-r",
            "long": null,
            "arg": null,
            "description": "Make tags based on regexp matching for the files following this option, in addition to the tags made with the standard parsing based on language. May be freely intermixed with filenames and the -R option. The regexps are cumulative, i.e., each such option will add to the previous ones. The regexps are of one of the forms: [{language}]/tagregexp/[nameregexp/]modifiers @regexfile where tagregexp is used to match the tag. It should not match useless characters. If the match is such that more characters than needed are unavoidably matched by tagreg‐ exp, it may be useful to add a nameregexp, to narrow down the tag scope. ctags ig‐ nores regexps without a nameregexp. The syntax of regexps is the same as in emacs. The following character escape sequences are supported: \\a, \\b, \\d, \\e, \\f, \\n, \\r, \\t, \\v, which respectively stand for the ASCII characters BEL, BS, DEL, ESC, FF, NL, CR, TAB, VT. The modifiers are a sequence of 0 or more characters among i, which means to ignore case when matching; m, which means that the tagregexp will be matched against the whole file contents at once, rather than line by line, and the matching sequence can match multiple lines; and s, which implies m and means that the dot character in tagregexp matches the newline char as well. The separator, which is / in the examples, can be any character different from space, tab, braces and @. If the separator character is needed inside the regular expres‐ sion, it must be quoted by preceding it with \\. The optional {language} prefix means that the tag should be created only for files of language language, and ignored otherwise. This is particularly useful when storing many predefined regexps in a file. In its second form, regexfile is the name of a file that contains a number of argu‐ ments to the --regex= option, one per line. Lines beginning with a space or tab are assumed to be comments, and ignored. Here are some examples. All the regexps are quoted to protect them from shell inter‐ pretation. Tag the DEFVAR macros in the emacs source files: --regex='/[ \\t]*DEFVAR[A-Z \\t(]+\"\\([^\"]+\\)\"/' Tag VHDL files (this example is a single long line, broken here for formatting rea‐ sons): --language=none --regex='/[ \\t]*\\(ARCHITECTURE\\|\\ CONFIGURA‐ TION\\) +[^ ]* +OF/' --regex='/[ \\t]*\\ \\(ATTRIBUTE\\|ENTITY\\|FUNCTION\\|PACK‐ AGE\\( BODY\\)?\\ \\|PROCEDURE\\|PROCESS\\|TYPE\\)[ \\t]+\\([^ \\t(]+\\)/\\3/' Tag TCL files (this last example shows the usage of a tagregexp): --lang=none --regex='/proc[ \\t]+\\([^ \\t]+\\)/\\1/' A regexp can be preceded by {lang}, thus restricting it to match lines of files of the specified language. Use etags --help to obtain a list of the recognized languages. This feature is particularly useful inside regex files. A regex file contains one regex per line. Empty lines, and those lines beginning with space or tab are ignored. Lines beginning with @ are references to regex files whose name follows the @ sign. Other lines are considered regular expressions like those following --regex. For example, the command etags --regex=@regex.file *.c reads the regexes contained in the file regex.file."
        },
        {
            "flag": "-R",
            "long": "--no-regex",
            "arg": null,
            "description": "Don't do any more regexp matching on the following files. May be freely intermixed with filenames and the --regex option."
        },
        {
            "flag": "-u",
            "long": "--update",
            "arg": null,
            "description": "Update tag entries for files specified on command line, leaving tag entries for other files in place. Currently, this is implemented by deleting the existing entries for the given files and then rewriting the new entries at the end of the tags file. It is often faster to simply rebuild the entire tag file than to use this. Only ctags ac‐ cepts this option."
        },
        {
            "flag": "-v",
            "long": "--vgrind",
            "arg": null,
            "description": "Instead of generating a tag file, write index (in vgrind format) to standard output. Only ctags accepts this option."
        },
        {
            "flag": "-x",
            "long": "--cxref",
            "arg": null,
            "description": "Instead of generating a tag file, write a cross reference (in cxref format) to stan‐ dard output. Only ctags accepts this option."
        },
        {
            "flag": "-H",
            "long": "--help",
            "arg": null,
            "description": "Print usage information. Followed by one or more --language=LANG prints detailed in‐ formation about how tags are created for LANG."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Print the current version of the program (same as the version of the emacs etags is shipped with)."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "cxref",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/cxref/1/json"
        },
        {
            "name": "emacs",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/emacs/1/json"
        },
        {
            "name": "vgrind",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/vgrind/1/json"
        },
        {
            "name": "vi",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/vi/1/json"
        }
    ]
}