我在emacs中内置了cscope。
当我使用emacs修改代码的时候。代码更改导致cscope不能按照我希望的方式运行。例如:如果我想跳转到函数定义,这是由于代码更改。cscope并没有把我带到函数的定义上,相反,它把我带到了另一行。
请告知是否有一种方法可以在不关闭emacs窗口的情况下重建cscope。
发布于 2015-10-09 15:42:43
您将需要https://github.com/dkogan/xcscope.el和配置:
(defun my-c-mode-common-hook ()
(require 'xcscope)
(cscope-setup)
(setq cscope-initial-directory "path to the cscope directory"))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)然后
C-c s L (or M-x cscope-create-list-of-files-to-index)
C-c s I (or M-x cscope-index-files) => build or rebuild希望这对你有所帮助
发布于 2018-10-11 15:34:14
我使用以下函数来构建/重建cscope数据库:
(require 'xcscope)
(cscope-setup)
(setq cscope-option-use-inverted-index t)
(defadvice cscope-bury-buffer (after cscope-bury-buffer activate)
"Kill the *cscope* window after hitting q or Q instead of leaving it open."
(delete-window))
(defun cscope-create-database (top-directory)
"Create cscope* files in one step containing, do this before using cscope:
1. C-c s L
2. C-c s I
3. C-c s a
"
(interactive "DCreate cscope* database files in directory: ")
(progn
(cscope-create-list-of-files-to-index top-directory)
(cscope-index-files top-directory)
(setq cscope-initial-directory top-directory)
(sit-for 2)
(delete-windows-on "*cscope-indexing-buffer*")
(kill-buffer "*cscope-indexing-buffer*")
))
(bind-keys*
("C-c s r" . cscope-create-database))https://stackoverflow.com/questions/33010759
复制相似问题