Emacs - Browsing Projects With Etags

A tag is a reference to a sub unit in a program. A tag references syntactic elements like functions, classes e.t.c. A tags table consists of list of tag names and their positions in corresponding files.

Creating Tags Table

A tags table can be generated by etags program. If you are using Ubuntu machine, you can install it with
sudo apt-get install exuberant-ctags
Now, you can generate tags for a file with
etags input_file
Depending on the project, we can also generate tags for a particular type. For example, we can generate tags for all python files using
find . -name '*.py' -exec etags -a {} \;

Browsing Tags

This tag tables enables you to jump to definition of any tag. You can place cursor on a tag and pressM-.(find-tag) which takes you to definition of that tag. If you want to go back to previous location, you can use M-*(pop-tag -mark). There are several functions which help to navigate tags.


ctags-update is a third party package which automatically updates TAGS file when new files are created.
In addition to them, helm provides a function called helm-semantic which shows all available tags in the current file. This works without TAGS file. Helm also has helm-etags-select which provides helm interface to select tags.
If you are working with a python projects, you can use elpy which navigates tags (using Jedi in the backend) without any TAGS file.

I am Chillar Anand. I daydream a lot and write about the things that interest me here. You can read more about this blog here.

See all articles


Edit this page