Linux kernel source browsing under emacs with cscope

Emacs can be used to browse Linux kernel source with cscope integration. Download xcscope.el and add these lines to your ~/.emacs file:
(setq load-path (cons "~/.elisp" load-path))
(require 'xcscope)
assuming you downloaded xcscope.el to ~/.elisp directory.
 
Restart emacs. Whenever you open a C file, a "Cscope" menu appears. You can look up symbols easily with the menu or through keyboard shortcuts.
 
However, the default xcscope interface is painfully slow with Linux kernel source. Also, if you build the cscope index through xcscope, the index will include sources from all CPU platforms. Thankfully the Linux Makefile has a "cscope" target that will prune the index for you.
 
Browse to the Linux source tree, usually /usr/src/linux, and build the cscope database:
cd /usr/src/linux
make cscope
The xcscope slowness is because it tries to rebuild the database. Disable it by changing the line:
(defcustom cscope-do-not-update-database nil
to:
(defcustom cscope-do-not-update-database t
in xcscope.el.
 
Now you should be all set for quick source browsing of the Linux kernel tree.
This file created: 21/Jan/2009
Back home