简体   繁体   English

emacs:是否有语义跳转到声明(使用semantic.el)?

[英]emacs: is there a semantic-jump-to-declaration (using semantic.el)?

Suppose I am editing a buffer containing C code. 假设我正在编辑一个包含C代码的缓冲区。

I have started semantic with semantic-load-enable-code-helpers . 我已经开始使用semantic-load-enable-code-helpers 语义处理。

I have point placed on the name of a function . 我有点放在函数的名称上。 If I then invoke senator-jump I can jump to the place where that fn is first declared, in that module. 如果我然后调用senator-jump我可以跳转到该模块中首次声明fn的地方。 If there is an extern declaration in that module, then it goes to that extern statement. 如果该模块中存在extern声明,那么它将转到该extern语句。 Sometimes? 有时? Sometimes it doesn't work, though. 但有时它不起作用。

There is also semantic-ia-fast-jump , which jumps to the first declaration, also. 还有semantic-ia-fast-jump ,它也跳转到第一个声明。 I'm not sure how this fn differs from senator-jump . 我不确定这个fn与senator-jump不同。 This one actually works all the time, though, for functions defined in the local buffer. 但是,对于本地缓冲区中定义的函数,这个实际上始终有效。

What if it the function I want to jump to, is an extern? 如果它想要跳转到的功能怎么样呢? Is it possible to use senator to jump to the definition of the fn, if that definition resides in a separate module? 如果该定义存在于一个单独的模块中,是否可以使用参数来跳转到fn的定义? Isn't EDE supposed to do something like this? EDE不应该做这样的事吗?

Thanks. 谢谢。

Look to the semantic-ia-fast-jump function, defined in semantic-ia. 查看语义-aa快速跳转函数,在语义ia中定义。 For C & C++ it's also good idea to generate database with gtags from GNU Global - CEDET has support for it. 对于C&C ++,使用GNU Global的gtags生成数据库也是个好主意 - CEDET支持它。

PS I just checked - it jumped from my source to declaration of std::string in /usr/include/.... PS我刚刚检查过 - 它从我的源码跳转到/ usr / include /中的std :: string声明

I haven't used senator but doesn't etags work for you? 我没有使用过参议员,但是没有etags为你工作? I create a tags table of all .c . 我创建了一个所有.c的标签表。 and .h files using .h文件使用

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

and then use find-tag (bound by default to M - . ) and jump to the appropriate definition. 然后使用find-tag (默认绑定到M - )并跳转到适当的定义。 pop-tag-mark (bound by default to M - * ) can be used to return to where you came from. pop-tag-mark (默认绑定到M - * )可用于返回到你来自的地方。

It works fine for me but I use it mainly while browsing large project codebases rather than which editing C. 它对我来说很好,但我主要是在浏览大型项目代码库时使用它而不是编辑C.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM