Emacs中有一个功能调用层次结构的功能 [英] Is there a feature in Emacs for function call hierarchy

查看:143
本文介绍了Emacs中有一个功能调用层次结构的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在维护别人的代码。该代码使用GCC 4.4.3在Linux平台上编写。然而,代码跳过很多,并且很难找出调用所有函数的位置。



在Visual Studio中,有一个名为调用层次结构这将显示从哪里调用和调用函数。 Emacs(23.1.1)有这样的功能吗?

解决方案

经典Emacs跳转到呼叫的方法是使用 TAGS 文件,并使用 M - 。命令。我建议您在项目的根目录中使用以下命令令人兴奋的C标签

  ctags -e --c-categories = + pxd -R。 

然后使用 visit-tags-table 可以打开TAGS文件。使用 M - 。,您可以跳转到每个定义或调用您的关键字。使用 C-u M - 。跳转到另一个事件。使用 Cx z z z ...重复搜索。



如果您有许多项目,您可以为每个项目创建一个TAGS文件,然后调用visit-tags-file将TAGS文件添加到您的TAGS文件列表中进行搜索。



另一种经典方式(un * x方式)是使用命令 Mx find-grep 搜索关键字的出现。


I am maintaining someone else's code. The code is written in C using GCC 4.4.3 on Linux platform. However, the code jumps around a lot and its difficult to find out where all the functions are called from.

In Visual Studio, there is a feature called 'Call Hierarchy' which will display where functions are called from and called to. Does Emacs (23.1.1) have any such feature?

解决方案

The classic Emacs way to jump to calls is to use TAGS file and use the M-. command. I recommend using Exuberant C Tags with the following command in the root directory of your project :

ctags -e --c-kinds=+pxd -R .

Then using visit-tags-table you can open the TAGS file. With M-. you can jump to each definition or call to your keyword. Use C-u M-. to jump to another occurrence. Use C-x z z z... to repeat the search.

If you have many projects, you can create a TAGS file for each one of them and then call visit-tags-file to add the TAGS file to your list of TAGS files to search from.

Another classic way (the un*x way), is to use the command M-x find-grep to search for occurrences of your keyword.

这篇关于Emacs中有一个功能调用层次结构的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆