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

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

[elpa] master af962d4 012/173: company-diag: Call `annotation' in the ri


From: Dmitry Gutov
Subject: [elpa] master af962d4 012/173: company-diag: Call `annotation' in the right buffer
Date: Thu, 23 Jun 2016 00:28:34 +0000 (UTC)

branch: master
commit af962d47817fb232f23f527e4ee1bcb61f31bbcf
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    company-diag: Call `annotation' in the right buffer
---
 company.el |   23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/company.el b/company.el
index e8d8db7..9909d5b 100644
--- a/company.el
+++ b/company.el
@@ -2147,10 +2147,15 @@ If SHOW-VERSION is non-nil, show the version in the 
echo area."
                           thereis (let ((company-backend b))
                                     (setq backend b)
                                     (company-call-backend 'prefix))))
-         cc)
+         (buf (current-buffer))
+         cc annotations)
     (when (stringp prefix)
-      (setq cc (let ((company-backend backend))
-                 (company-call-backend 'candidates prefix))))
+      (let ((company-backend backend))
+        (setq cc (company-call-backend 'candidates prefix)
+              annotations
+              (mapcar
+               (lambda (c) (cons c (company-call-backend 'annotation c)))
+               cc))))
     (pop-to-buffer (get-buffer-create "*company-diag*"))
     (setq buffer-read-only nil)
     (erase-buffer)
@@ -2168,13 +2173,11 @@ If SHOW-VERSION is non-nil, show the version in the 
echo area."
     (insert (message  "Completions:"))
     (unless cc (insert " none"))
     (save-excursion
-      (let ((company-backend backend))
-        (dolist (c cc)
-          (insert "\n  " (prin1-to-string c))
-          (let ((ann (company-call-backend 'annotation c)))
-            (when ann
-              (insert " " (prin1-to-string ann))))))
-      (special-mode))))
+      (dolist (c annotations)
+        (insert "\n  " (prin1-to-string (car c)))
+        (when (cdr c)
+          (insert " " (prin1-to-string (cdr c))))))
+    (special-mode)))
 
 ;;; pseudo-tooltip 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 



reply via email to

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