]> code.delx.au - gnu-emacs-elpa/blobdiff - company-etags.el
Return nil when etags aren't found.
[gnu-emacs-elpa] / company-etags.el
index 59aee1101c6171a601dc4525cfa53c8395ae8a25..f7d71dcdf1e5ffc6e97b083cb408d4338e2f639f 100644 (file)
@@ -2,7 +2,7 @@
 ;;
 ;; Copyright (C) 2009 Nikolaj Schumacher
 ;;
-;; This file is part of company.
+;; This file is part of company 0.2.
 ;;
 ;; This program is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License
@@ -45,7 +45,8 @@ buffer automatically."
       (unless (file-exists-p (setq file (expand-file-name "TAGS" dir)))
         (setq file nil
               dir (file-name-directory (directory-file-name dir)))))
-    (list file)))
+    (when file
+      (list file))))
 
 (defun company-etags-buffer-table ()
   (or (and company-etags-use-main-table-list tags-table-list)
@@ -65,6 +66,10 @@ buffer automatically."
                        (completion-ignore-case nil))
                    (and (fboundp 'tags-completion-table)
                         (all-completions arg (tags-completion-table)))))
+    ('location (let ((tags-table-list (company-etags-buffer-table)))
+                 (when (fboundp 'find-tag-noselect)
+                   (let ((buffer (find-tag-noselect arg)))
+                     (cons buffer (with-current-buffer buffer (point)))))))
     ('sorted t)))
 
 (add-to-list 'company-backends 'company-etags)