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

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

[elpa] externals/cape 45dee11563 1/3: Experiment with a different synchr


From: ELPA Syncer
Subject: [elpa] externals/cape 45dee11563 1/3: Experiment with a different synchronization method (See #25)
Date: Wed, 9 Feb 2022 11:57:25 -0500 (EST)

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

    Experiment with a different synchronization method (See #25)
---
 cape.el | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/cape.el b/cape.el
index 5fcaafa3fb..d000bd5d65 100644
--- a/cape.el
+++ b/cape.el
@@ -879,23 +879,17 @@ If INTERACTIVE is nil the function acts like a capf."
          (if toi
              (unwind-protect
                  (progn
-                   (funcall fetch (lambda (arg)
-                                    (when (eq res 'cape--waiting)
-                                      (push 'cape--done unread-command-events))
-                                    (setq res arg)))
-                   ;; Force synchronization, interruptible!
-                   (while (eq res 'cape--waiting)
-                     ;; When we've got input, interrupt the computation.
-                     (when unread-command-events (throw toi nil))
-                     (sit-for 0.1 'noredisplay)))
-               ;; Remove cape--done introduced by future callback.
-               ;; NOTE: `sit-for' converts cape--done to (t . cape--done).
-               ;; It seems that `sit-for' does not use a robust method to
-               ;; reinject inputs, maybe the implementation will change in
-               ;; the future.
-               (setq unread-command-events (delq 'cape--done
-                                                 (delete '(t . cape--done)
-                                                         
unread-command-events))))
+                   (funcall fetch
+                            (lambda (arg)
+                              (when (eq res 'cape--waiting)
+                                (push 'cape--done unread-command-events))
+                              (setq res arg)))
+                   (let ((input-method-function nil))
+                     (read-event nil t))
+                   (when (eq res 'cape--waiting)
+                     (throw toi nil)))
+               (setq unread-command-events
+                     (delq 'cape--done unread-command-events)))
            (funcall fetch (lambda (arg) (setq res arg)))
            ;; Force synchronization, not interruptible! We use polling
            ;; here and ignore pending input since we don't use



reply via email to

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