[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 18/35: company--force-sync: change calling convention
From: |
Dmitry Gutov |
Subject: |
[elpa] 18/35: company--force-sync: change calling convention |
Date: |
Sat, 19 Apr 2014 10:12:17 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit a325331ec7cb93a51063e4f06a74e41301a3770a
Author: Dmitry Gutov <address@hidden>
Date: Thu Apr 3 01:28:12 2014 +0300
company--force-sync: change calling convention
---
company.el | 35 +++++++++++++++++------------------
1 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/company.el b/company.el
index cdda9dd..50e2796 100644
--- a/company.el
+++ b/company.el
@@ -791,22 +791,22 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
(nth 3 ppss))))
(defun company-call-backend (&rest args)
- (let ((val (apply #'company-call-backend-raw args)))
- (company--force-sync val company-backend args)))
-
-(defun company--force-sync (value backend args)
- (if (not (eq (car-safe value) :async))
- value
- (let ((res 'trash)
- (start (time-to-seconds)))
- (funcall (cdr value)
- (lambda (result) (setq res result)))
- (while (eq res 'trash)
- (if (> (- (time-to-seconds) start) company-async-timeout)
- (error "Company: Back-end %s async timeout with args %s"
- backend args)
- (sleep-for company-async-wait)))
- res)))
+ (company--force-sync #'company-call-backend-raw args company-backend))
+
+(defun company--force-sync (fun args backend)
+ (let ((value (apply fun args)))
+ (if (not (eq (car-safe value) :async))
+ value
+ (let ((res 'trash)
+ (start (time-to-seconds)))
+ (funcall (cdr value)
+ (lambda (result) (setq res result)))
+ (while (eq res 'trash)
+ (if (> (- (time-to-seconds) start) company-async-timeout)
+ (error "Company: Back-end %s async timeout with args %s"
+ backend args)
+ (sleep-for company-async-wait)))
+ res))))
(defun company-call-backend-raw (&rest args)
(condition-case err
@@ -834,8 +834,7 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
(let (value)
(dolist (backend backends)
(when (setq value (company--force-sync
- (apply backend command args)
- backend (cons command args)))
+ backend (cons command args) backend))
(return value)))))
(_
(let ((arg (car args)))
- [elpa] 04/35: Minor tweaks, (continued)
- [elpa] 04/35: Minor tweaks, Dmitry Gutov, 2014/04/19
- [elpa] 07/35: Drop support for `crop', Dmitry Gutov, 2014/04/19
- [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 <=
- [elpa] 20/35: Change the summary, Dmitry Gutov, 2014/04/19
- [elpa] 22/35: company--multi-backend-adapter-candidates: bind backend locally, Dmitry Gutov, 2014/04/19
- [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