Skip to content

Instantly share code, notes, and snippets.

@snikulov
Created September 7, 2010 10:22
Show Gist options
  • Save snikulov/568133 to your computer and use it in GitHub Desktop.
Save snikulov/568133 to your computer and use it in GitHub Desktop.
;;; from here http://www.emacswiki.org/emacs/CyclingGTagsResult
(require 'gtags)
(defun ww-next-gtag ()
"Find next matching tag, for GTAGS."
(interactive)
(let ((latest-gtags-buffer
(car (delq nil (mapcar (lambda (x) (and (string-match "GTAGS SELECT" (buffer-name x)) (buffer-name x)) )
(buffer-list)) ))))
(cond (latest-gtags-buffer
(switch-to-buffer latest-gtags-buffer)
(next-line)
(gtags-select-it nil))
) ))
;;; Here’s my key binding for using GNU Global.
(global-set-key "\M-;" 'ww-next-gtag) ;; M-; cycles to next result, after doing M-. C-M-. or C-M-,
(global-set-key "\M-." 'gtags-find-tag) ;; M-. finds tag
(global-set-key [(control meta .)] 'gtags-find-rtag) ;; C-M-. find all references of tag
(global-set-key [(control meta ,)] 'gtags-find-symbol) ;; C-M-, find all usages of symbol.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment