tags:

views:

76

answers:

1

Hello,

GNU Emacs 23.1.1

I am maintaining someones code. There are many files and directories for the headers and source files.

I am wondering if there is a easy way to use emacs that when I highlight a variable name I can go straight to where it is declared?

Some of the structures I am working in are declared in other header files, rather than go searching for them, I just want to be taken straight to them.

Many thanks for any suggestions,

+4  A: 

Look into the etags command which builds a tags database. Once the tag DB is built and loaded, you can use M-. on any keyword to jump directly to the definition.

Anders Abel
Does etags come with emacs? M-x etags comes up with no match. Thanks
robUK
It's a separate command outside emacs, try `man etags` (if you're on a *nix system)
Anders Abel
Seems to be working. However, I notice it doesn't find the #defines. I tested this by writing a simple one in a single source file. And in that source file I reference it. I place the cursor on the define but it doesn't take me to where it is defined. It saids 'No tags containing: '. Does it work differently for #define. Thanks.
robUK
Everything is now working as expected. Just like to point out there is also GNU Scope that works like etags, for anyone who would like a second option.
robUK