如何使用 cscope 浏览源代码

首先下载 http://cscope.sourceforge.net cscope

然后,安装。

tar -zxf cscope-xx.x.tar.gz
cd cscope-xx.x
./configure
make
make install

具体细节,察看 INSTALL 文件。

参考把下面的代码,修改 .emacs ,安装 cscope.el, xcscope.el 中建议的安装方法,如下。

(require 'xcscope)

注意,把 ./contrib/xcscope/xcscope.el 拷贝到 load-path 能够 找到的地方。

常用功能

其他功能可以参考

;; 5. If you intend to use xcscope.el often you can optionally edit your
;;    ~/.emacs file to add keybindings that reduce the number of keystrokes
;;    required.  For example, the following will add "C-f#" keybindings, which
;;    are easier to type than the usual "C-c s" prefixed keybindings.  Note
;;    that specifying "global-map" instead of "cscope:map" makes the
;;    keybindings available in all buffers:
;;
;;      (define-key global-map [(control f3)]  'cscope-set-initial-directory)
;;      (define-key global-map [(control f4)]  'cscope-unset-initial-directory)
;;      (define-key global-map [(control f5)]  'cscope-find-this-symbol)
;;      (define-key global-map [(control f6)]  'cscope-find-global-definition)
;;      (define-key global-map [(control f7)]
;;        'cscope-find-global-definition-no-prompting)
;;      (define-key global-map [(control f8)]  'cscope-pop-mark)
;;      (define-key global-map [(control f9)]  'cscope-next-symbol)
;;      (define-key global-map [(control f10)] 'cscope-next-file)
;;      (define-key global-map [(control f11)] 'cscope-prev-symbol)
;;      (define-key global-map [(control f12)] 'cscope-prev-file)
;;      (define-key global-map [(meta f9)]  'cscope-display-buffer)
;;      (defin-ekey global-map [(meta f10)] 'cscope-display-buffer-toggle)
;;