* navigate in C
@ 2006-10-26 13:54 Pedro Sa da Costa
2006-10-26 15:51 ` Kevin Rodgers
0 siblings, 1 reply; 4+ messages in thread
From: Pedro Sa da Costa @ 2006-10-26 13:54 UTC (permalink / raw)
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.
and
int test(){
call_test();
}
have the cursor above "call_test()" call and pressing F3, goes to the
function.
Thanks,
Pedro
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: navigate in C
[not found] <mailman.266.1161870876.27805.help-gnu-emacs@gnu.org>
@ 2006-10-26 15:29 ` Burton Samograd
2006-10-26 18:03 ` Vagn Johansen
1 sibling, 0 replies; 4+ messages in thread
From: Burton Samograd @ 2006-10-26 15:29 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: navigate in C
2006-10-26 13:54 navigate in C Pedro Sa da Costa
@ 2006-10-26 15:51 ` Kevin Rodgers
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2006-10-26 15:51 UTC (permalink / raw)
Pedro Sa da Costa wrote:
> 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.
,----[ C-h f ff-find-related-file RET ]
| ff-find-related-file is an alias for `ff-find-other-file' in
`find-file.el'.
| (ff-find-related-file &optional in-other-window ignore-include)
|
| Find the header or source file corresponding to this file.
| Being on a `#include' line pulls in that file.
|
| If optional in-other-window is non-nil, find the file in the other window.
| If optional ignore-include is non-nil, ignore being on `#include' lines.
|
| Variables of interest include:
|
| - `ff-case-fold-search'
| Non-nil means ignore cases in matches (see `case-fold-search').
| If you have extensions in different cases, you will want this to be
nil.
|
| - `ff-always-in-other-window'
| If non-nil, always open the other file in another window, unless an
| argument is given to `ff-find-other-file'.
|
| - `ff-ignore-include'
| If non-nil, ignores #include lines.
|
| - `ff-always-try-to-create'
| If non-nil, always attempt to create the other file if it was not
found.
|
| - `ff-quiet-mode'
| If non-nil, traces which directories are being searched.
|
| - `ff-special-constructs'
| A list of regular expressions specifying how to recognize special
| constructs such as include files etc, and an associated method for
| extracting the filename from that construct.
|
| - `ff-other-file-alist'
| Alist of extensions to find given the current file's extension.
|
| - `ff-search-directories'
| List of directories searched through with each extension specified in
| `ff-other-file-alist' that matches this file's extension.
|
| - `ff-pre-find-hook'
| List of functions to be called before the search for the file starts.
|
| - `ff-pre-load-hook'
| List of functions to be called before the other file is loaded.
|
| - `ff-post-load-hook'
| List of functions to be called after the other file is loaded.
|
| - `ff-not-found-hook'
| List of functions to be called if the other file could not be found.
|
| - `ff-file-created-hook'
| List of functions to be called if the other file has been created.
|
| [back]
`----
> and
>
> int test(){
> call_test();
>
> }
>
> have the cursor above "call_test()" call and pressing F3, goes to the
> function.
I think you need to create a tags table file, select it, then find the
call_test tag. See the "Tags Tables" section of the Emacs manual.
--
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: navigate in C
[not found] <mailman.266.1161870876.27805.help-gnu-emacs@gnu.org>
2006-10-26 15:29 ` Burton Samograd
@ 2006-10-26 18:03 ` Vagn Johansen
1 sibling, 0 replies; 4+ messages in thread
From: Vagn Johansen @ 2006-10-26 18:03 UTC (permalink / raw)
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.
set ffap-c-path (to a list if directories) and use ffap AKA find-file-at-point
PS: add (require 'ffap) to your .emacs first
--
Vagn Johansen
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-10-26 18:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-26 13:54 navigate in C Pedro Sa da Costa
2006-10-26 15:51 ` Kevin Rodgers
[not found] <mailman.266.1161870876.27805.help-gnu-emacs@gnu.org>
2006-10-26 15:29 ` Burton Samograd
2006-10-26 18:03 ` Vagn Johansen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.