tags:

views:

82

answers:

2

Hello

GNU Emacs 23.1.1

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 function calls are called from.

In visual studio there is a feature called 'Call Hierarchy' which will display where functions are called from and called to.

I am wondering if emacs any such feature. It would be very handy in this case

Many thanks for any suggestions,

+3  A: 

http://cedet.sourceforge.net/symref.shtml

aaa
Thanks, I will try this.
robUK
+2  A: 

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.

Jérôme Radix
Thanks, I have just tried that on a small sample project. Worked well. However, I am not sure of your command to create the tags file. ctags -e --c-kinds=pxd -R. I can understand the -e - tags for emacs. --c - c language. -R Recursive so go through all the files and directories in creating the tags file. However, what is -kinds=pxd? Not sure about that. Many thanks.
robUK
@Jermoe. Just wondering how you do you update the TAGS files. I have just added some new functions. However, I cannot navigate to them as it saids "No tags containing ...". I find I have to delete my TAGS file and then generate a new one. Is this correct? Thanks.
robUK
do a ctags --list-kinds=c to know which kinds of C element you can add or remove from TAGS file using --c-kinds.
Jérôme Radix
Just relaunch the same command to update the TAGS file.
Jérôme Radix