[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a7a4ba6 014/173: Merge branch 'release'
From: |
Dmitry Gutov |
Subject: |
[elpa] master a7a4ba6 014/173: Merge branch 'release' |
Date: |
Thu, 23 Jun 2016 00:28:34 +0000 (UTC) |
branch: master
commit a7a4ba681cf99afbd94077554f0161a7e37f0400
Merge: 12f55f5 e085a33
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Merge branch 'release'
Conflicts:
company.el
---
company.el | 26 ++++++++++++------------
test/async-tests.el | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 13 deletions(-)
diff --git a/company.el b/company.el
index 4c2c150..28e2cde 100644
--- a/company.el
+++ b/company.el
@@ -934,26 +934,26 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
(cons
:async
(lambda (callback)
- (let* (lst pending
+ (let* (lst
+ (pending (mapcar #'car pairs))
(finisher (lambda ()
(unless pending
(funcall callback
(funcall merger
(nreverse lst)))))))
(dolist (pair pairs)
- (let ((val (car pair))
- (mapper (cdr pair)))
+ (push nil lst)
+ (let* ((cell lst)
+ (val (car pair))
+ (mapper (cdr pair))
+ (this-finisher (lambda (res)
+ (setq pending (delq val pending))
+ (setcar cell (funcall mapper res))
+ (funcall finisher))))
(if (not (eq :async (car-safe val)))
- (push (funcall mapper val) lst)
- (push nil lst)
- (let ((cell lst)
- (fetcher (cdr val)))
- (push fetcher pending)
- (funcall fetcher
- (lambda (res)
- (setq pending (delq fetcher pending))
- (setcar cell (funcall mapper res))
- (funcall finisher)))))))))))))
+ (funcall this-finisher val)
+ (let ((fetcher (cdr val)))
+ (funcall fetcher this-finisher)))))))))))
(defun company--prefix-str (prefix)
(or (car-safe prefix) prefix))
diff --git a/test/async-tests.el b/test/async-tests.el
index 5d8be3e..c548898 100644
--- a/test/async-tests.el
+++ b/test/async-tests.el
@@ -159,3 +159,59 @@
(company-call-backend 'candidates "foo")))
(let ((company-backend (list immediate)))
(should (equal '("f") (company-call-backend 'candidates "foo")))))))
+
+(ert-deftest company-multi-backend-merges-deferred-candidates-2 ()
+ (with-temp-buffer
+ (let ((company-backend (list (lambda (command &optional _)
+ (pcase command
+ (`prefix "foo")
+ (`candidates
+ (cons :async
+ (lambda (cb) (funcall cb '("a"
"b")))))))
+ (lambda (command &optional _)
+ (pcase command
+ (`prefix "foo")
+ (`candidates
+ (cons :async
+ (lambda (cb) (funcall cb '("c"
"d")))))))
+ (lambda (command &optional _)
+ (pcase command
+ (`prefix "foo")
+ (`candidates
+ (cons :async
+ (lambda (cb) (funcall cb '("e"
"f"))))))))))
+ (should (equal :async (car (company-call-backend-raw 'candidates
"foo"))))
+ (should (equal '("a" "b" "c" "d" "e" "f")
+ (company-call-backend 'candidates "foo"))))))
+
+(ert-deftest company-multi-backend-merges-deferred-candidates-3 ()
+ (with-temp-buffer
+ (let ((company-backend (list (lambda (command &optional _)
+ (pcase command
+ (`prefix "foo")
+ (`candidates
+ (cons :async
+ (lambda (cb) (funcall cb '("a"
"b")))))))
+ (lambda (command &optional _)
+ (pcase command
+ (`prefix "foo")
+ (`candidates
+ (cons :async
+ (lambda (cb)
+ (run-with-timer
+ 0.01 nil
+ (lambda ()
+ (funcall cb '("c" "d")))))))))
+ (lambda (command &optional _)
+ (pcase command
+ (`prefix "foo")
+ (`candidates
+ (cons :async
+ (lambda (cb)
+ (run-with-timer
+ 0.01 nil
+ (lambda ()
+ (funcall cb '("e"
"f"))))))))))))
+ (should (equal :async (car (company-call-backend-raw 'candidates
"foo"))))
+ (should (equal '("a" "b" "c" "d" "e" "f")
+ (company-call-backend 'candidates "foo"))))))
- [elpa] master e94f2ec 008/173: company-show-doc-buffer: Still call doc-buffer inside the electric block, (continued)
- [elpa] master e94f2ec 008/173: company-show-doc-buffer: Still call doc-buffer inside the electric block, Dmitry Gutov, 2016/06/22
- [elpa] master 125a4da 009/173: company-show-location: Mirror the latest change to company-show-doc-buffer, Dmitry Gutov, 2016/06/22
- [elpa] master 7941f6e 010/173: company-diag: Include Emacs and Company versions, Dmitry Gutov, 2016/06/22
- [elpa] master 5733f2b 011/173: company-diag: Fix the annotation call, Dmitry Gutov, 2016/06/22
- [elpa] master af962d4 012/173: company-diag: Call `annotation' in the right buffer, Dmitry Gutov, 2016/06/22
- [elpa] master 5e107fd 015/173: Accept numeric argument in company-select-next and friends, Dmitry Gutov, 2016/06/22
- [elpa] master 479c676 021/173: Don't use `forward-symbol', apparently it's not in 24.3, Dmitry Gutov, 2016/06/22
- [elpa] master 41f4536 018/173: Add missing require to `company-gtags`, Dmitry Gutov, 2016/06/22
- [elpa] master b0f206a 020/173: Handle function pointers in annotation and template expansion, Dmitry Gutov, 2016/06/22
- [elpa] master d56ddaa 006/173: Allow scrolling the doc window with the mouse wheel, Dmitry Gutov, 2016/06/22
- [elpa] master a7a4ba6 014/173: Merge branch 'release',
Dmitry Gutov <=
- [elpa] master 464a458 022/173: company-lighter: dispatch on whether company-candidates is non-nil, Dmitry Gutov, 2016/06/22
- [elpa] master b94b115 025/173: company--insert-candidate: Don't insert an empty string, Dmitry Gutov, 2016/06/22
- [elpa] master decd537 030/173: Add MELPA badge, Dmitry Gutov, 2016/06/22
- [elpa] master 22ecb92 001/173: company-clang--start-process: Disable undo in the output buffer, Dmitry Gutov, 2016/06/22
- [elpa] master 5fe84a2 028/173: Merge pull request #334 from vermiculus/patch-1, Dmitry Gutov, 2016/06/22
- [elpa] master 2de213e 032/173: company-dabbrev--search-buffer: Save match data, Dmitry Gutov, 2016/06/22
- [elpa] master a0ba593 029/173: Drop githalytics link, Dmitry Gutov, 2016/06/22
- [elpa] master 6301093 023/173: Clarify the meaning of cdr in the prefix cons, Dmitry Gutov, 2016/06/22
- [elpa] master 9f67f1e 027/173: Fix docstring, Dmitry Gutov, 2016/06/22
- [elpa] master 17e6d19 016/173: Remove company-pysmell, Dmitry Gutov, 2016/06/22