help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: navigate in C


From: Burton Samograd
Subject: Re: navigate in C
Date: Thu, 26 Oct 2006 09:29:53 -0600
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Pedro Sa da Costa <op132650c@mail.telepac.pt> writes:

> 1 - Is there a way in C mode to, by selecting the .h file or a method
> and press a shortcut key, go that file or function?
>
> For example:
>
> #include "header.h"
>
> by pressing F3 in the selected "header.h", or simply have the cursor
> of the header file, open the file.

I haven't found anything that does this just yet (I'm sure it's
probably somewhere in emacs), and have been writing something like
this myself...

> int test(){
>    call_test();
>
> }
>
> have the cursor above "call_test()" call and pressing F3, goes to the
> function.

Check Info: Emacs: Tags.  A simple HOWTO on tags is:

1) Run 'etags *.c *.h' in the shell to create a TAGS file (better yet
put it in your Makefile so it's run when the source is updated; it's
fast so it can be run on every rebuild).  If you do this, add 
(setq tags-revert-without-query 't) to your .emacs so you don't have
to type 'y' every time the tags file is updated.

2) Over the variable or function type M-. to go to it's definition.

3) M-* pop's (goes back to) where you were before. 

Check the info manual for more options and advanced tags usage.
Another thing about tags is you can perform completion on them using
M-TAB (which you might have to rebind if your window manager steals
that for switching windows...C-TAB would work just as well)

Hope this helps.

-- 
burton samograd                                             kruhft .at. gmail
    generative a/v artwork : http://kruhft.boldlygoingnowhere.org


reply via email to

[Prev in Thread] Current Thread [Next in Thread]