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

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

[elpa] 28/31: company-semantic: don't try to fetch doc for tag without b


From: Dmitry Gutov
Subject: [elpa] 28/31: company-semantic: don't try to fetch doc for tag without buffer
Date: Tue, 18 Mar 2014 05:19:39 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit 6d892691ae5cb3747538930051eea97cc558a750
Author: Dmitry Gutov <address@hidden>
Date:   Mon Mar 17 21:17:36 2014 +0200

    company-semantic: don't try to fetch doc for tag without buffer
    
    Fixes #74
---
 company-semantic.el |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/company-semantic.el b/company-semantic.el
index 4fddf28..617388a 100644
--- a/company-semantic.el
+++ b/company-semantic.el
@@ -53,19 +53,25 @@
   "Tags for the current context.")
 (make-variable-buffer-local 'company-semantic--current-tags)
 
+(defun company-semantic-documentation-for-tag (tag)
+  (when (semantic-tag-buffer tag)
+    ;; When TAG's buffer is unknown, the function below raises an error.
+    (semantic-documentation-for-tag tag)))
+
 (defun company-semantic-doc-or-summary (tag)
-  (or (semantic-documentation-for-tag tag)
+  (or (company-semantic-documentation-for-tag tag)
       (and (require 'semantic-idle nil t)
            (require 'semantic/idle nil t)
            (funcall semantic-idle-summary-function tag nil t))))
 
 (defun company-semantic-summary-and-doc (tag)
-  (let ((doc (semantic-documentation-for-tag tag))
+  (debug)
+  (let ((doc (company-semantic-documentation-for-tag tag))
         (summary (funcall semantic-idle-summary-function tag nil t)))
     (and (stringp doc)
          (string-match "\n*\\(.*\\)$" doc)
          (setq doc (match-string 1 doc)))
-    (concat (funcall semantic-idle-summary-function tag nil t)
+    (concat summary
             (when doc
                   (if (< (+ (length doc) (length summary) 4) (window-width))
                       " -- "
@@ -73,7 +79,7 @@
             doc)))
 
 (defun company-semantic-doc-buffer (tag)
-  (let ((doc (semantic-documentation-for-tag tag)))
+  (let ((doc (company-semantic-documentation-for-tag tag)))
     (when doc
       (company-doc-buffer
        (concat (funcall semantic-idle-summary-function tag nil t)



reply via email to

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