Page 1 of 2

Use Emacs to navigate through FreeEMS source code

Posted: Wed Jan 18, 2012 5:16 am
by HotCat
Emacs is my favorite editor, I started to use it since 2003 after graduating from high school, I can't image working on Unix-like environment without it, just like driving a car without steering wheel. Emacs is so Powerful, so flexible and so complex, I can't thoroughly explain how to use it. Instead I only focus on how to navigate through FreeEMS source code

1.First download GNU gtags package
1.png
2.Use Emacs compile mode to configure, compile and install package
2.png
3.Locate gtags elisp extension file and open it
3.png

Re: Use Emacs to navigate through FreeEMS source code

Posted: Wed Jan 18, 2012 5:18 am
by HotCat
4.Follow the comments to configure your emacs
4.png
5.Navigate to FreeEMS source directory and run shell command 'gtags' from Emacs
5.png
6.Three file should be generated
6.png

Re: Use Emacs to navigate through FreeEMS source code

Posted: Wed Jan 18, 2012 5:24 am
by HotCat
7.Explore what gtags can do with our source code, use 'gtags-parse-file' command to list C functions in a C source file and locate the function body
7.png
Press 'enter' key to locate the function body
8.png
here it is
9.png

Re: Use Emacs to navigate through FreeEMS source code

Posted: Wed Jan 18, 2012 5:30 am
by HotCat
8.Find the macro definition of 'cliConfiguredOffset' using 'gtags-find-tag' command

Place cursor around the 'cliConfiguredOffset' variable and issue 'gtags-find-tag' command
10.png
Press 'enter' key to locate whatever definition you prefer to see
11.png
See how it was defined for Hyundai
12.png

Re: Use Emacs to navigate through FreeEMS source code

Posted: Wed Jan 18, 2012 5:35 am
by HotCat
9.Find the definition of 'calculateFuelAndIgnition' using 'gtags-find-tag' command

Place cursor around the 'calculateFuelAndIgnition' function and issue 'gtags-find-tag' command
13.png
here it is
14.png

Re: Use Emacs to navigate through FreeEMS source code

Posted: Wed Jan 18, 2012 5:39 am
by HotCat
10.Find how the function was referenced using 'gtags-find-rtag' command

Place cursor around the 'generateDerivedVars' function and issue 'gtags-find-rtag' command
15.png
There maybe a few candidates, press 'enter' key to choose which one you love it
16.png
Here it is
17.png

Re: Use Emacs to navigate through FreeEMS source code

Posted: Wed Jan 18, 2012 5:42 am
by HotCat
11.Sometimes you have to use 'gtags-find-symbol' command to locate some macro definition

When 'gtags-find-tag' command does not work, try this one
18.png
you must choose
20.png
Here it is
21.png

Re: Use Emacs to navigate through FreeEMS source code

Posted: Wed Jan 18, 2012 5:43 am
by HotCat
End of this topic, thanks for watching :lol:

Re: Use Emacs to navigate through FreeEMS source code

Posted: Wed Jan 18, 2012 9:25 am
by johntramp
Image

Re: Use Emacs to navigate through FreeEMS source code

Posted: Wed Jan 18, 2012 11:31 am
by Fred
HotCat, cool article, this is the most inspired I've EVER been to use emacs! (More than when my best friend tried to convince me) Still not enough to actually do it, though :-)

If you want to edit it freely in future I can leave it here, or I can promote it to article status in the article section. If I do that, though, you have to ask me to get it edited.

LOL @ johntramp :-)

Fred.