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

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

[elpa] externals/cape fd8828cff3 100/146: Make cape--company-call more r


From: ELPA Syncer
Subject: [elpa] externals/cape fd8828cff3 100/146: Make cape--company-call more robust
Date: Sun, 9 Jan 2022 20:57:46 -0500 (EST)

branch: externals/cape
commit fd8828cff312e3294b158118ddaee89c0b30036b
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Make cape--company-call more robust
---
 cape.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/cape.el b/cape.el
index 3a90031b6b..d0a1bcd5a7 100644
--- a/cape.el
+++ b/cape.el
@@ -738,19 +738,21 @@ If INTERACTIVE is nil the function acts like a capf."
 (defun cape--company-call (backend &rest args)
   "Call Company BACKEND with ARGS."
   ;; Company backends are non-interruptible.
-  (pcase (let (throw-on-input) (apply backend args))
-    (`(:async . ,fetcher)
-     (let ((res 'trash)
-           (start (time-to-seconds)))
-       ;; Company backends are non-interruptible.
-       (let (throw-on-input) (funcall fetcher (lambda (arg) (setq res arg))))
-       ;; Force synchronization. The synchronization is interruptible!
-       (while (eq res 'trash)
-         (sleep-for cape-company-async-wait)
-         (when (> (- (time-to-seconds) start) cape-company-async-timeout)
-           (error "Cape company backend async timeout")))
-       res))
-    (res res)))
+  (let ((old-toi throw-on-input)
+        (throw-on-input nil))
+    (pcase (apply backend args)
+      (`(:async . ,fetcher)
+       (let ((res 'trash)
+             (start (time-to-seconds)))
+         (funcall fetcher (lambda (arg) (setq res arg)))
+         ;; Force synchronization. The synchronization is interruptible!
+         (let ((throw-on-input old-toi))
+           (while (eq res 'trash)
+             (sleep-for cape-company-async-wait)
+             (when (> (- (time-to-seconds) start) cape-company-async-timeout)
+               (error "Cape company backend async timeout"))))
+         res))
+      (res res))))
 
 ;;;###autoload
 (defun cape-company-to-capf (backend &optional valid)



reply via email to

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