0

I have cscope built-in in emacs.

When ever I change the code using emacs. The code change causes cscope to not behave the way I want it to. eg. Due to code change If I want to jump to the function definition. cscope does not take me to the definition of the func, instead it takes me to some other line.

Please tell if there is a way to rebuild cscope without closing the emacs window.

Deepak
  • 373
  • 1
  • 2
  • 7

2 Answers2

1

You will need https://github.com/dkogan/xcscope.el and configuration :

(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)

and then

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

Hope this help

djangoliv
  • 1,698
  • 14
  • 26
  • And there's a cool package to use xcscope interactively with helm: http://wikemacs.org/wiki/Python#Interactivity_with_helm-cscope – Ehvince Oct 13 '15 at 00:14
  • in the results buffer (named \*cscope\*) I (uppercase i) is bound to cscope-index-files as well. – daladd Oct 25 '15 at 02:33
0

I use the following function to build/rebuild cscope database:

    (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))
CodyChan
  • 1,776
  • 22
  • 35