how to do tags?

Francois Pinard pinard at
Fri Aug 15 03:32:24 CEST 2003

[Yun Mao]

> Hi, I'm using emacs now.  How to run etags so that I can search into my own
> source code as well as those site-packages source?  Thanks a million!
Try `etags --help', and play around with the listed possibilities.

Here is a fragment of a top-level Makefile of mine, where the `Echo'
directory holds a Python package.  This fragment builds separate `TAGS' file
in those sub-directories where there are source files, then builds a small
top-level `TAGS' file which purpose is to include all others.

tags: TAGS
TAGS: Echo bin html src
        cd Echo && find -name '*.py' | grep -v '~$$' | etags -
        cd bin && find -type f | grep -v '~$$' | etags -
        $(MAKE) -C html $@
        $(MAKE) -C src $@
        etags -i Echo/TAGS -i bin/TAGS -i html/TAGS -i src/TAGS

You could use similar principles, maybe, to build separate `TAGS' files for
your various site-packages source hierarchies, and for your own personal
sources likely kept elsewhere.  Then, small master `TAGS' files could then
mix those sets you want to operate upon.

Of course, once all these `TAGS' files are built and ready, you `M-x visit'
at the level which is most appropriate for your needed operations.

François Pinard

More information about the Python-list mailing list