[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 22/35: company--multi-backend-adapter-candidates: bind backend lo
From: |
Dmitry Gutov |
Subject: |
[elpa] 22/35: company--multi-backend-adapter-candidates: bind backend locally |
Date: |
Sat, 19 Apr 2014 10:12:18 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 90c24b6ac06f722283140a7218223b80bc298e9e
Author: Dmitry Gutov <address@hidden>
Date: Fri Apr 4 15:53:42 2014 +0300
company--multi-backend-adapter-candidates: bind backend locally
Fixes #89
---
company-tests.el | 17 ++++++++++++-----
company.el | 12 ++++++------
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/company-tests.el b/company-tests.el
index c2ea35b..9e678af 100644
--- a/company-tests.el
+++ b/company-tests.el
@@ -102,25 +102,32 @@
(ert-deftest company-multi-backend-remembers-candidate-backend ()
(let ((company-backend
- (list (lambda (command &optional arg &rest ignore)
+ (list (lambda (command &optional arg)
(case command
(ignore-case nil)
(annotation "1")
(candidates '("a" "c"))
(post-completion "13")))
- (lambda (command &optional arg &rest ignore)
+ (lambda (command &optional arg)
(case command
(ignore-case t)
(annotation "2")
(candidates '("b" "d"))
- (post-completion "42"))))))
+ (post-completion "42")))
+ (lambda (command &optional arg)
+ (case command
+ (annotation "3")
+ (candidates '("e"))
+ (post-completion "74"))))))
(let ((candidates (company-calculate-candidates nil)))
- (should (equal candidates '("a" "b" "c" "d")))
+ (should (equal candidates '("a" "b" "c" "d" "e")))
(should (equal t (company-call-backend 'ignore-case)))
(should (equal "1" (company-call-backend 'annotation (nth 0
candidates))))
(should (equal "2" (company-call-backend 'annotation (nth 1
candidates))))
(should (equal "13" (company-call-backend 'post-completion (nth 2
candidates))))
- (should (equal "42" (company-call-backend 'post-completion (nth 3
candidates)))))))
+ (should (equal "42" (company-call-backend 'post-completion (nth 3
candidates))))
+ (should (equal "3" (company-call-backend 'annotation (nth 4
candidates))))
+ (should (equal "74" (company-call-backend 'post-completion (nth 4
candidates)))))))
(ert-deftest company-multi-backend-handles-keyword-with ()
(let ((primo (lambda (command &optional arg)
diff --git a/company.el b/company.el
index 24b00cb..1c255bf 100644
--- a/company.el
+++ b/company.el
@@ -859,12 +859,12 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
when (equal (funcall backend 'prefix)
prefix)
collect (cons (funcall backend 'candidates prefix)
- (lambda (candidates)
- (mapcar
- (lambda (str)
- (propertize str 'company-backend
- backend))
- candidates))))))
+ (let ((b backend))
+ (lambda (candidates)
+ (mapcar
+ (lambda (str)
+ (propertize str 'company-backend b))
+ candidates)))))))
(when (equal (funcall (car backends) 'prefix) prefix)
;; Small perf optimization: don't tag the candidates received
;; from the first backend in the group.
- [elpa] 10/35: Bump version, (continued)
- [elpa] 10/35: Bump version, Dmitry Gutov, 2014/04/19
- [elpa] 09/35: Add Package-Requires header, Dmitry Gutov, 2014/04/19
- [elpa] 13/35: Make company-clang work asynchronously, Dmitry Gutov, 2014/04/19
- [elpa] 12/35: Remove `company-locate-dominating-file', Dmitry Gutov, 2014/04/19
- [elpa] 16/35: Update NEWS, Dmitry Gutov, 2014/04/19
- [elpa] 17/35: company--merge-async: tweak, Dmitry Gutov, 2014/04/19
- [elpa] 19/35: Move company-elisp require, Dmitry Gutov, 2014/04/19
- [elpa] 14/35: Implement async operation for grouped backends, Dmitry Gutov, 2014/04/19
- [elpa] 18/35: company--force-sync: change calling convention, Dmitry Gutov, 2014/04/19
- [elpa] 20/35: Change the summary, Dmitry Gutov, 2014/04/19
- [elpa] 22/35: company--multi-backend-adapter-candidates: bind backend locally,
Dmitry Gutov <=
- [elpa] 21/35: Define and use `company-grab-symbol-cons', Dmitry Gutov, 2014/04/19
- [elpa] 23/35: Introduce `company-tooltip-minimum-width', Dmitry Gutov, 2014/04/19
- [elpa] 25/35: Make version string compatible with Emacs < 24.4, Dmitry Gutov, 2014/04/19
- [elpa] 24/35: Lower company-idle-delay, Dmitry Gutov, 2014/04/19
- [elpa] 06/35: Drop Emacs 23 compatibility, Dmitry Gutov, 2014/04/19
- [elpa] 11/35: Initial support for asynchonous backends (#62), Dmitry Gutov, 2014/04/19
- [elpa] 26/35: Merge pull request #100 from bbatsov/version-fix, Dmitry Gutov, 2014/04/19
- [elpa] 27/35: Try to use the more up-to-date snapshot packages, Dmitry Gutov, 2014/04/19
- [elpa] 29/35: Merge pull request #101 from bbatsov/master, Dmitry Gutov, 2014/04/19
- [elpa] 15/35: Merge branch 'clang-async', Dmitry Gutov, 2014/04/19