Emacs: is there a semantic transition to declaration (using semantic.el)?

Suppose I edit a buffer containing C code.

I started semantic with semantic-load-enable-code-helpers .

I have a dot located on a function name. If I then call senator-jump , I can go to the place where this fn is declared first in this module. If there is an extern declaration in this module, then it goes to this extern statement. Sometimes? Sometimes it doesn’t work.

There is also semantic-ia-fast-jump , which also goes into the first declaration. I'm not sure how this fn differs from senator-jump . This actually works all the time, however, for functions defined in the local buffer.

What if the function I want to jump is external? Is it possible to use the senator to go to the definition of fn, if this definition is in a separate module? Shouldn't EDE do something like this?

Thanks.

+6
c emacs
source share
2 answers

Look at the semantic-ia-fast-jump function defined in semantic-ia. For C and C ++, it is also a good idea to generate a database using gtags from GNU Global - CEDET supports it.

PS I just checked - it jumped from my source to the std :: string declaration in / usr / include / ....

+5
source share

I did not use the senator, but does not work for you? I create a tag table for all .c . and .h with

 find . -name \*.c -o -name \*.h | xargs etags 

and then use find-tag (attached by default to M - . ) and go to the corresponding definition. pop-tag-mark (associated with M - * by default) can be used to return to where you came from.

It works great for me, but I use it mainly when viewing large codebases of projects, rather than editing C.

+1
source share

All Articles