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

    Use catch+throw in output-filter
---
 helm-core.el | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/helm-core.el b/helm-core.el
index 3a63d82d1c..5b7149cc31 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -5578,26 +5578,27 @@ This will work only in Emacs-26+, i.e. Emacs versions 
that have
             (setq candidates (helm-transform-candidates
                               (nreverse candidates) source t))
             ;; Now insert each candidate in helm buffer.
-            (cl-dolist (candidate candidates)
-              (setq candidate (helm--maybe-process-filter-one-by-one-candidate
-                               candidate source))
-              (let ((start (point)))
-                (unless (or (not multiline)
-                            (zerop (cdr (assq 'item-count source))))
-                  (helm-insert-candidate-separator))
-                (helm-insert-match candidate 'insert-before-markers
-                                   (1+ (cdr (assq 'item-count source)))
-                                   source)
-                (when multiline
-                  (put-text-property start (point) 'helm-multiline t)))
-              (cl-incf (cdr item-count-info))
-              ;; Exit when we reach candidate-number-limit.
-              (when (>= (cdr item-count-info) (helm-candidate-number-limit 
source))
-                (process-put process 'reach-limit t)
-                (helm-kill-async-process process #'kill-process)
-                (helm-log-run-hook "helm-output-filter"
-                                   'helm-async-outer-limit-hook)
-                (cl-return)))))))
+            (catch 'reach-limit
+              (dolist (candidate candidates)
+                (setq candidate 
(helm--maybe-process-filter-one-by-one-candidate
+                                 candidate source))
+                (let ((start (point)))
+                  (unless (or (not multiline)
+                              (zerop (cdr (assq 'item-count source))))
+                    (helm-insert-candidate-separator))
+                  (helm-insert-match candidate 'insert-before-markers
+                                     (1+ (cdr (assq 'item-count source)))
+                                     source)
+                  (when multiline
+                    (put-text-property start (point) 'helm-multiline t)))
+                (cl-incf (cdr item-count-info))
+                ;; Exit when we reach candidate-number-limit.
+                (when (>= (cdr item-count-info) (helm-candidate-number-limit 
source))
+                  (process-put process 'reach-limit t)
+                  (helm-kill-async-process process #'kill-process)
+                  (helm-log-run-hook "helm-output-filter"
+                                     'helm-async-outer-limit-hook)
+                  (throw 'reach-limit nil))))))))
     (helm-output-filter--post-process)))
 
 (defun helm-output-filter--post-process ()

Reply via email to