The ctags and etags programs generate an index (or "tag") file for a variety of language objects found in file(s). This tag file allows these items to be quickly and easily located by a text editor or other utility. A "tag" signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object).The tags generated by ctags are recognized by a wide variety of text editors, most notably Vi and its derivatives, but not Emacs which uses the tag file format generated by etags.
On large projects it is not unusual to have multi-MB tag files. One of the main drawbacks of etags is that the tags are not sorted so that tag lookup is linear and slow. Another shortcoming of using etags and Emacs is that the entire tag file is loaded into memory, which, when combined with the linear search, leads to interminable garbage collection and memory exhaustion. The vtags project addresses these issues. It does a binary search without reading the entire tag file into memory.
Currently, vtags has the following basic functionality:
vtags-find - Find tag whose name contains TAGNAME. vtags-next-placeholder - go up in tag stack vtags-prev-placeholder - go down in tag stack vtags-set-tagfile - set the tag file used by vtags-findOne of the main features of vtags is that it is implemented entirely in elisp. There are no OS dependencies and no auxiliary applications to compile.
Vtags has been tested with several versions of Emacs, up-to and including GNU Emacs 21.2.1 and XEmacs 21.4, using output from Exuberant Ctags 5.2.2.
(shell-command (concat "look " tagname " " tag-path ) t))from within vtags-find and the output was dumped into a buffer and parsed. However, for aesthetics and for portability and to avoid the overhead of "shell-command", we decided to re-implement that portion in elisp and we called the new function vtags-look. The vtags-look function uses binary search until the search is narrowed to a single 8192 byte block of memory, at which point it continues with a linear search.
There are no default key binding for vtags. Add the following to your startup file (e.g. .emacs) with the [ ]'s filled in with whatever function keys you chose and with path set to point to your tags file:
; (load "/path/to/vtags") ; (vtags-set-tagfile "/path/to/my/tags") ; (global-set-key [f5] 'vtags-find); ; (global-set-key [f6] 'vtags-prev-placeholder) ; (global-set-key [f7] 'vtags-goto-current-placeholder) ; (global-set-key [f8] 'vtags-next-placeholder) ; (global-set-key [f9] 'vtags-point-to-placeholder) ; (global-set-key [f10] 'vtags-reset-placeholders)
Copyright (c) 2004-2005 Edward Bishop Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".