首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在emacs中重建cscope

在emacs中重建cscope
EN

Stack Overflow用户
提问于 2015-10-08 16:41:45
回答 2查看 371关注 0票数 0

我在emacs中内置了cscope。

当我使用emacs修改代码的时候。代码更改导致cscope不能按照我希望的方式运行。例如:如果我想跳转到函数定义,这是由于代码更改。cscope并没有把我带到函数的定义上,相反,它把我带到了另一行。

请告知是否有一种方法可以在不关闭emacs窗口的情况下重建cscope。

EN

回答 2

Stack Overflow用户

发布于 2015-10-09 15:42:43

您将需要https://github.com/dkogan/xcscope.el和配置:

代码语言:javascript
复制
(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)

然后

代码语言:javascript
复制
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

希望这对你有所帮助

票数 1
EN

Stack Overflow用户

发布于 2018-10-11 15:34:14

我使用以下函数来构建/重建cscope数据库:

代码语言:javascript
复制
    (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))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33010759

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档