【问题标题】:Rebuild cscope in emacs在 emacs 中重建 cscope
【发布时间】:2015-10-08 08:41:44
【问题描述】:

我在 emacs 中内置了 cscope。

每当我使用 emacs 更改代码时。代码更改导致 cscope 无法按照我想要的方式运行。 例如。 由于代码更改如果我想跳转到函数定义。 cscope 不会带我到 func 的定义,而是带我到其他行。

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

【问题讨论】:

    标签: emacs cscope rebuild


    【解决方案1】:

    你需要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
    

    希望有帮助

    【讨论】:

    【解决方案2】:

    我使用以下函数来构建/重建 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))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多