How to use Emacs
There is an amazing amount of Emacs documentation on the net, too much, in fact, for me to find the summary of the commands I tend to forget. To solve this problem, I am adding more Emacs documentation on the net.
Tags
When editing a driver in the Linux kernel, I find it helpful to use Emacs tags to navigate around the source code.
Start by making a TAGS file in the top level kernel directory
etags `find . -name "*.c" -o -name "*.cpp" -o -name "*.h"`
Then load the tags into emacs by running the Emacs visit-tag-table function.
M-x visit-tag-table [location of the TAGS file]
where M-x is <ESC>x on most machines.
Once the tags have been loaded, you can find the definition of a function, variable, or definition by highlighting it and run the Emacs find-tag command. Here is the list of key bindings for the tag related Emacs functions.
Emacs key binding |
Human readable key binding |
Function name | Meaning |
---|---|---|---|
M-. tag <RET> | <ALT>. | find-tag | Find where tag is defined |
C-u M-. | <CNTL>u<ALT>. | Find next place the tag is defined | |
M-* | <SHIFT><ALT>* | pop-tag-mark | Go back to location before find-tag was last run |