28 April, 2008

Etags emacs

From http://www.xemacs.org/Documentation/21.5/html/emodules_5.html

Indexing your source code for easy navigation

Emacs comes with an etags executable (and also probably its cousin ctags), which can index source code, allowing you to jump around your source code quickly by simply giving a method name to jump to, etc. Here are some simple steps to get you started:
  1. from a shell, run etags *.[ch] in your source directory, which will index or re-index the .c and .h files in your source directory, and will create a file named TAGS.
  2. inside emacs, run M-x visit-tags-table RET and then enter the name of the TAGS file created by the previous step.
  3. for example, to visit a function named "sortRecords", type M-. and then enter the name "sortRecords". Or, better yet, enter just "sortRec", as substrings will work as well, as long as they are unique.
  4. did your press of M-. not put you in the right function/variable? Then try pressing C-u M-. to visit the next function/variable with a similar name.
  5. do you want to go back to where you were before the last M-. or C-u M-.? Then simply to M-*, each press of which will pop a stack and return you to where you came from.

No comments: