]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/symref/global.el
Perform xref searches without visiting unopened files
[gnu-emacs] / lisp / cedet / semantic / symref / global.el
index 88713474d69bf00f5741bbbf4ae839ecf8193cc2..a33427e93a652fa35c1e7fd0af11a4bf9cac5ee5 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/symref/global.el --- Use GNU Global for symbol references
 
-;; Copyright (C) 2008-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2016 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
 
@@ -49,6 +49,9 @@ See the function `cedet-gnu-global-search' for more details.")
     (semantic-symref-parse-tool-output tool b)
     ))
 
+(defconst semantic-symref-global--line-re
+  "^\\([^ ]+\\) +\\([0-9]+\\) \\([^ ]+\\) ")
+
 (cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-global))
   "Parse one line of grep output, and return it as a match list.
 Moves cursor to end of the match."
@@ -57,8 +60,13 @@ Moves cursor to end of the match."
         ;; Search for files
         (when (re-search-forward "^\\([^\n]+\\)$" nil t)
           (match-string 1)))
+        ((eq (oref tool :resulttype) 'line-and-text)
+         (when (re-search-forward semantic-symref-global--line-re nil t)
+           (list (string-to-number (match-string 2))
+                 (match-string 3)
+                 (buffer-substring-no-properties (point) (line-end-position)))))
        (t
-        (when (re-search-forward "^\\([^ ]+\\) +\\([0-9]+\\) \\([^ ]+\\) " nil t)
+        (when (re-search-forward semantic-symref-global--line-re nil t)
           (cons (string-to-number (match-string 2))
                 (match-string 3))
           ))))