[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 04/07: Fix #52: Search references and symbols in GTAGSLIBPATH
From: |
Leo Liu |
Subject: |
[elpa] 04/07: Fix #52: Search references and symbols in GTAGSLIBPATH |
Date: |
Tue, 06 May 2014 06:34:19 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 99da3b43abf80260670ce0bb1d18f50decc17b62
Author: Leo Liu <address@hidden>
Date: Sat Apr 19 20:23:23 2014 +0800
Fix #52: Search references and symbols in GTAGSLIBPATH
---
ggtags.el | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/ggtags.el b/ggtags.el
index 05f8363..9218a98 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -295,6 +295,8 @@ properly update `ggtags-mode-map'."
(defvar ggtags-global-last-buffer nil)
+(defvar ggtags-global-continuation nil)
+
(defvar ggtags-current-tag-name nil)
(defvar ggtags-highlight-tag-overlay nil)
@@ -791,6 +793,8 @@ Do nothing if GTAGS exceeds the oversize limit unless
FORCE."
(defvar ggtags-auto-jump-to-match-target nil)
+(defvar-local ggtags-global-exit-info nil) ; (EXIT-STATUS COUNT DB)
+
(defun ggtags-global-save-start-marker ()
(when (markerp ggtags-global-start-marker)
(setq ggtags-tag-ring-index nil)
@@ -801,7 +805,8 @@ Do nothing if GTAGS exceeds the oversize limit unless
FORCE."
(let* ((default-directory (or directory (ggtags-current-project-root)))
(split-window-preferred-function ggtags-split-window-function)
(env ggtags-process-environment))
- (setq ggtags-global-start-marker (point-marker))
+ (unless (markerp ggtags-global-start-marker)
+ (setq ggtags-global-start-marker (point-marker)))
(setq ggtags-auto-jump-to-match-target
(nth 4 (assoc (ggtags-global-search-id command default-directory)
ggtags-global-search-history)))
@@ -872,13 +877,31 @@ definition tags."
(ggtags-project-relative-file
buffer-file-name)))
(shell-quote-argument name)))))
+(defun ggtags-setup-libpath-search (type name)
+ (pcase (ggtags-get-libpath)
+ ((and libs (guard libs))
+ (cl-labels ((cont (buf how)
+ (pcase ggtags-global-exit-info
+ (`(0 0 ,_)
+ (with-temp-buffer
+ (setq default-directory
+ (file-name-as-directory (pop libs)))
+ (and libs (setq ggtags-global-continuation #'cont))
+ (if (ggtags-find-project)
+ (ggtags-find-tag type (shell-quote-argument
name))
+ (cont buf how))))
+ (_ (ggtags-global-handle-exit buf how)))))
+ (setq ggtags-global-continuation #'cont)))))
+
(defun ggtags-find-reference (name)
(interactive (list (ggtags-read-tag 'reference current-prefix-arg)))
+ (ggtags-setup-libpath-search 'reference name)
(ggtags-find-tag 'reference (shell-quote-argument name)))
(defun ggtags-find-other-symbol (name)
"Find tag NAME that is a reference without a definition."
(interactive (list (ggtags-read-tag 'symbol current-prefix-arg)))
+ (ggtags-setup-libpath-search 'symbol name)
(ggtags-find-tag 'symbol (shell-quote-argument name)))
(defun ggtags-quote-pattern (pattern)
@@ -1250,8 +1273,6 @@ commands `next-error' and `previous-error'.
(match-string 2))))
(cons 0 nil))))
-(defvar-local ggtags-global-exit-info nil) ; (EXIT-STATUS COUNT DB)
-
(defun ggtags-global-exit-message-function (_process-status exit-status msg)
"A function for `compilation-exit-message-function'."
(pcase (ggtags-global-exit-message-1)
@@ -1260,6 +1281,7 @@ commands `next-error' and `previous-error'.
;; Clear the start marker in case of zero matches.
(and (zerop count)
(markerp ggtags-global-start-marker)
+ (not ggtags-global-continuation)
(setq ggtags-global-start-marker nil))
(cons (if (> exit-status 0)
msg
@@ -1399,6 +1421,10 @@ commands `next-error' and `previous-error'.
(defun ggtags-global-handle-exit (buf how)
"A function for `compilation-finish-functions' (which see)."
(cond
+ (ggtags-global-continuation
+ (let ((cont (prog1 ggtags-global-continuation
+ (setq ggtags-global-continuation nil))))
+ (funcall cont buf how)))
((string-prefix-p "exited abnormally" how)
;; If exit abnormally display the buffer for inspection.
(ggtags-global--display-buffer))
- [elpa] branch master updated (f53bd6e -> 2d2431c), Leo Liu, 2014/05/06
- [elpa] 03/07: For #34 and #48: Always update tags for current file on save, Leo Liu, 2014/05/06
- [elpa] 02/07: Remove redundant function ggtags-navigation-first-error, Leo Liu, 2014/05/06
- [elpa] 01/07: Fix #48: Enhance ggtags-find-tag-dwim to handle new files, Leo Liu, 2014/05/06
- [elpa] 04/07: Fix #52: Search references and symbols in GTAGSLIBPATH,
Leo Liu <=
- [elpa] 06/07: For #52: new var ggtags-global-search-libpath-for-reference, Leo Liu, 2014/05/06
- [elpa] 07/07: Merge branch 'master' of github.com:leoliu/ggtags, Leo Liu, 2014/05/06
- [elpa] 05/07: Doc and indentation fix, Leo Liu, 2014/05/06