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
2.Use Emacs compile mode to configure, compile and install package
3.Locate gtags elisp extension file and open it
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
5.Navigate to FreeEMS source directory and run shell command 'gtags' from Emacs
6.Three file should be generated
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
Press 'enter' key to locate the function body
here it is
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
Press 'enter' key to locate whatever definition you prefer to see
See how it was defined for Hyundai
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
here it is
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
There maybe a few candidates, press 'enter' key to choose which one you love it
Here it is
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
you must choose
Here it is
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
Re: Use Emacs to navigate through FreeEMS source code
Posted: Wed Jan 18, 2012 9:25 am
by johntramp
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.