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

[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)))



reply via email to

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