Skip to content

Commit

Permalink
use ggtags set up
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Bin committed Mar 21, 2014
1 parent 4e5c0e0 commit 8a84c2a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
1 change: 0 additions & 1 deletion init-cc-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
(add-hook 'c-mode-common-hook
(lambda ()
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
(gtags-mode 1)
(setq gtags-suggested-key-mapping t)
(ggtags-mode 1))
(when (derived-mode-p 'c-mode 'c++-mode)
Expand Down
1 change: 0 additions & 1 deletion init-elpa.el
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ ARCHIVE is the string name of the package archive.")
(require-package 'maxframe)
(require-package 'cpputils-cmake '(0 4 3) t)
(require-package 'flyspell-lazy)
(require-package 'gtags)
(require-package 'bbdb '(20130421 1145 0) nil)
(require-package 'twittering-mode)
(require-package 'iedit)
Expand Down
11 changes: 4 additions & 7 deletions init-evil.el
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
(loop for (mode . state) in
'(
(minibuffer-inactive-mode . emacs)
(ggtags-global-mode . emacs)
(Info-mode . emacs)
(term-mode . emacs)
(sdcv-mode . emacs)
Expand All @@ -51,7 +52,6 @@
;;(message-mode . emacs)
(magit-log-edit-mode . emacs)
(fundamental-mode . emacs)
(gtags-select-mode . emacs)
(weibo-timeline-mode . emacs)
(weibo-post-mode . emacs)
(sr-mode . emacs)
Expand Down Expand Up @@ -161,7 +161,7 @@ to replace the symbol under cursor"
"fp" 'copy-full-path-of-current-buffer
"dj" 'dired-jump ;; open the dired from current file
"ff" 'toggle-full-window ;; I use WIN+F in i3
"gt" 'get-term
"tm" 'get-term
"px" 'paste-from-x-clipboard
;; "ci" 'evilnc-comment-or-uncomment-lines
;; "cl" 'evilnc-comment-or-uncomment-to-the-line
Expand Down Expand Up @@ -229,15 +229,12 @@ to replace the symbol under cursor"
"hf" 'find-function
"hv" 'describe-variable
"hb" 'helm-back-to-last-point
"gf" 'gtags-find-tag-from-here
"gp" 'gtags-pop-stack
"gr" 'gtags-find-rtag
"gt" 'ggtags-find-tag-dwim
"gr" 'ggtags-find-reference
"fb" 'flyspell-buffer
"fe" 'flyspell-goto-next-error
"fa" 'flyspell-auto-correct-word
"fw" 'ispell-word
"gy" 'gtags-find-symbol
"dg" 'djcb-gtags-create-or-update
"bc" '(lambda () (interactive) (wxhelp-browse-class-or-api (thing-at-point 'symbol)))
"ma" 'mc/mark-all-like-this-in-defun
"mw" 'mc/mark-all-words-like-this-in-defun
Expand Down
24 changes: 13 additions & 11 deletions init-gtags.el
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
;; @see http://emacs-fu.blogspot.com.au/2008/01/navigating-through-source-code-using.html
(defun djcb-gtags-create-or-update ()
"create or update the gnu global tag file"
(interactive)
(if (not (= 0 (call-process "global" nil nil nil " -p"))) ; tagfile doesn't exist?
(let ((olddir default-directory)
(topdir (read-directory-name
"gtags: top of source tree:" default-directory)))
(cd topdir)
(defun gtags-ext-produce-tags-if-needed (dir)
(if (not (= 0 (call-process "global" nil nil nil " -p"))) ; tagfile doesn't exist?
(let ((olddir default-directory))
(cd dir)
(shell-command "gtags && echo 'created tagfile'")
(cd olddir)) ; restore
;; tagfile already exists; update it
(shell-command "global -u && echo 'updated tagfile'"))
)

(defun add-gtagslibpath (libdir &optional del)
;; @see http://emacs-fu.blogspot.com.au/2008/01/navigating-through-source-code-using.html
(defun gtags-ext-create-or-update ()
"create or update the gnu global tag file"
(interactive)
(gtags-ext-produce-tags-if-needed (read-directory-name
"gtags: top of source tree:" default-directory)))

(defun gtags-ext-add-gtagslibpath (libdir &optional del)
"add external library directory to environment variable GTAGSLIBPATH.\ngtags will can that directory if needed.\nC-u M-x add-gtagslibpath will remove the directory from GTAGSLIBPATH."
(interactive "DDirectory containing GTAGS:\nP")
(let (sl)
Expand All @@ -31,7 +33,7 @@
(setenv "GTAGSLIBPATH" (mapconcat 'identity sl ":")))
)

(defun print-gtagslibpath ()
(defun gtags-ext-print-gtagslibpath ()
"print the GTAGSLIBPATH (for debug purpose)"
(interactive)
(message "GTAGSLIBPATH=%s" (getenv "GTAGSLIBPATH"))
Expand Down

0 comments on commit 8a84c2a

Please sign in to comment.