emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 18/52: extended gtags functionality #90 showing annotations and m


From: Dmitry Gutov
Subject: [elpa] 18/52: extended gtags functionality #90 showing annotations and meta
Date: Tue, 01 Jul 2014 11:53:13 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit aceed8442c66081dd5b49cd2b16398ac61cd39cb
Author: ksjogo <address@hidden>
Date:   Sun Apr 6 23:57:35 2014 +0200

    extended gtags functionality #90
    showing annotations and meta
---
 company-gtags.el |   36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/company-gtags.el b/company-gtags.el
index 0ae98d7..41a8172 100644
--- a/company-gtags.el
+++ b/company-gtags.el
@@ -56,20 +56,23 @@
   (with-temp-buffer
     (let (tags)
       (when (= 0 (call-process company-gtags-executable nil
-                               (list (current-buffer) nil) nil "-c" prefix))
+                               (list (current-buffer) nil) nil "-xGq" (concat 
"^" prefix)))
         (goto-char (point-min))
-        (split-string (buffer-string) "\n" t)))))
-
-(defun company-gtags-location (tag)
-  (with-temp-buffer
-    (when (= 0 (call-process company-gtags-executable nil
-                             (list (current-buffer) nil) nil "-x" tag))
-        (goto-char (point-min))
-        (when (looking-at (concat (regexp-quote tag)
-                                  "[ \t]+\\([[:digit:]]+\\)"
-                                  "[ \t]+\\([^ \t]+\\)"))
-          (cons (expand-file-name (match-string 2))
-                (string-to-number (match-string 1)))))))
+        (cl-loop while
+                 (re-search-forward (concat
+                                     "^"
+                                     "\\([^ ]*\\)" ;; completion
+                                     "[ \t]+\\([[:digit:]]+\\)" ;; linum
+                                     "[ \t]+\\([^ \t]+\\)" ;; file
+                                     "[ \t]+\\(.*\\)" ;; definition 
+                                     "$"
+                                     ) nil t)
+                 collect
+                 (propertize (match-string 1)
+                             'meta (match-string 4)
+                             'location (cons (expand-file-name (match-string 
3))
+                                             (string-to-number (match-string 
2)))
+                             ))))))
 
 ;;;###autoload
 (defun company-gtags (command &optional arg &rest ignored)
@@ -84,7 +87,12 @@
                  (or (company-grab-symbol) 'stop)))
     (candidates (company-gtags-fetch-tags arg))
     (sorted t)
-    (location (company-gtags-location arg))))
+    (duplicates t)
+    (annotation (let (annotation)
+                  (when (string-match (concat arg "\\((.*)\\).*") 
(get-text-property 0 'meta arg))
+                    (match-string 1 (get-text-property 0 'meta arg)))))
+    (meta (get-text-property 0 'meta arg))
+    (location (get-text-property 0 'location arg))))
 
 (provide 'company-gtags)
 ;;; company-gtags.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]