branch: elpa/helm
commit 2d0f5e7e30f3b5133cf661e513dc882bea4fcc49
Author: Thierry Volpiatto <thie...@posteo.net>
Commit: Thierry Volpiatto <thie...@posteo.net>

    Fallback to a simple timer in PA
---
 helm-core.el | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/helm-core.el b/helm-core.el
index 277010acbe4..5f074335742 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -8128,6 +8128,9 @@ They are bound by default to 
\\[helm-follow-action-forward] and
 This happen after: DELAY or the \\='follow-attr value of current
 source or `helm-follow-input-idle-delay'."
   (let* ((src (helm-get-current-source))
+         (at (or delay
+                 (assoc-default 'follow-delay src)
+                 helm-follow-input-idle-delay))
          (suspend (and helm--in-update
                        ;; Specific to helm-find-files.
                        (assoc-default 'suspend-follow-in-update src))))
@@ -8141,26 +8144,9 @@ source or `helm-follow-input-idle-delay'."
                (null (eq (assoc-default 'follow src) 'never))
                (helm-get-selection nil nil src))
       (helm-follow-mode-set-source 1 src)
-      (helm--execute-persistent-action-when-idle delay src))))
-
-(defvar helm--execute-persistent-action-timer nil)
-(defun helm--execute-persistent-action-when-idle (&optional delay src)
-  ;; More or less similar to what the debounce fn in timeout package does,
-  ;; except the timer is stored in a global var instead of beeing stored in a
-  ;; closure and there is no default output, we just execute
-  ;; helm-execute-persistent-action once emacs is idle.
-  (when helm-alive-p
-    (let ((at (or delay
-                  (assoc-default 'follow-delay src)
-                  helm-follow-input-idle-delay)))
-      (unless (timerp helm--execute-persistent-action-timer)
-        (setq helm--execute-persistent-action-timer
-              (run-with-idle-timer
-               at nil
-               (lambda ()
-                 (cancel-timer helm--execute-persistent-action-timer)
-                 (setq helm--execute-persistent-action-timer nil)
-                 (helm-execute-persistent-action))))))))
+      (run-with-idle-timer at nil (lambda ()
+                                    (when helm-alive-p
+                                      (helm-execute-persistent-action)))))))
 
 (defun helm-follow-mode-p (&optional source)
   (with-helm-buffer

Reply via email to