;;
;; Copyright (C) 2009 Nikolaj Schumacher
;;
-;; This file is part of company.
+;; This file is part of company 0.2.1.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
(forward-line)))
(nreverse tags))))
+(defun company-gtags-location (tag)
+ (with-temp-buffer
+ (when (= 0 (call-process "global" 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)))))))
+
(defun company-gtags (command &optional arg &rest ignored)
"A `company-mode' completion back-end for GNU Global."
(case command
(company-gtags-available)
(or (company-grab company-gtags-symbol-regexp) "")))
('candidates (company-gtags-fetch-tags arg))
- ('sorted t)))
+ ('sorted t)
+ ('location (company-gtags-location arg))))
(provide 'company-gtags)
;;; company-gtags.el ends here