Otags Reloaded: Emacs and vi Tag Generation for OCaml

Otags generates TAGS files suitable for emacs and vi/vim from OCaml sources. Otags employs camlp4 for parsing. Therefore otags can easily handle files that use camlp4 syntax extensions. Otags reloaded is a complete rewrite for the new camlp4 that is shipped with OCaml since version 3.10.

Recent Changes

2016-01-15: otags 4.02.2 released
2016-01-10: otags 4.02.1 released
2013-09-25: otags 4.01.1 released
See also the complete list of changes.


Latest version: [otags-4.02.2.tar.gz].

Previous versions: 4.02.1, 4.01.1, 4.00.2, 4.00.1, 3.12.5, 3.12.4, 3.12.3, 3.12.2, 3.12.1, 3.11.3, 3.11.2, 3.11.1


  1. ./configure

    Optionally use --prefix, --bindir or --mandir if you don't like the default installation directories.

  2. make
  3. make install

    You might need to become superuser before make install.

Bleeding edge OCaml users may use the configure option --no-version-check to compile otags for an unsupported version of OCaml.


otags ocaml.ml -pa rq quotation.ml
to generate an Emacs TAGS table for ocaml.ml in standard syntax and quotation.ml with (revised) quotations. Note that otags switches the parsing engine between the two files.

Add option -r to recurse into subdirectories and option -vi to generate vi and vim tags tables. For more details and more examples consult the man page.

Compatibility and Otags version numbers

For tagging source files otags uses a recursive function that traverses the abstract syntax tree that comes out of the camlp4 parser. It is therefore quite unlikely that a given otags version works well for more than one major OCaml version. For this reason otags version numbers simply follow the OCaml version numbers. For instance otags version 3.11.1 is the 1. otags release for OCaml 3.11.xx. In general, an otags version X.YY.Z will only compile with OCaml X.YY.*


Cuihtlauac Alvarado and Jean-Francois Monin wrote the first OCaml tagging program based on camlp4 and released this as otags. Some old otags version can still be found on their websites.

Around 2005 I released a few versions for OCaml 3.09. All these old otags versions require the original camlp4 from Daniel de Rauglaudre, which is now available as camlp5. My latest release for the old camlp4 was otags for OCaml 3.09.3. The debian maintainers developed some patches to make this version compile with later OCaml versions and camlp5.

last changed on 10 Jan 2016 by Hendrik