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

    Notify sentinels when limit is reached
---
 helm-fd.el     | 5 +++--
 helm-find.el   | 3 ++-
 helm-grep.el   | 9 ++++++---
 helm-locate.el | 3 ++-
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/helm-fd.el b/helm-fd.el
index 0a08000b99..91a5277bcb 100644
--- a/helm-fd.el
+++ b/helm-fd.el
@@ -100,8 +100,9 @@
     (prog1
         proc
       (set-process-sentinel
-       proc (lambda (_process event)
-              (if (string= event "finished\n")
+       proc (lambda (process event)
+              (if (or (string= event "finished\n")
+                      (process-get process 'reach-limit))
                   (with-helm-window
                     (when helm-fd-mode-line-function
                       (funcall helm-fd-mode-line-function start-time 
fd-version)
diff --git a/helm-find.el b/helm-find.el
index 26005339b3..dc81c26265 100644
--- a/helm-find.el
+++ b/helm-find.el
@@ -134,7 +134,8 @@ separator."
        (lambda (process event)
            (helm-process-deferred-sentinel-hook
             process event (helm-default-directory))
-           (if (string= event "finished\n")
+           (if (or (string= event "finished\n")
+                   (process-get process 'reach-limit))
                (helm-locate-update-mode-line "Find")
              (helm-log "helm-find-shell-command-fn sentinel" "Error: Find %s"
                        (replace-regexp-in-string "\n" "" event))))))))
diff --git a/helm-grep.el b/helm-grep.el
index 6bd54d583d..3f52705c97 100644
--- a/helm-grep.el
+++ b/helm-grep.el
@@ -659,6 +659,7 @@ Have no effect when grep backend use \"--color=\"."
                                        ,proc-name)
                                       'face 'helm-grep-finish))))))
                    ((or (string= event "finished\n")
+                        (process-get process 'reach-limit)
                         (and noresult
                              ;; This is a workaround for zgrep
                              ;; that exit with code 1
@@ -1525,8 +1526,9 @@ non-file buffers."
       (message nil)
       (set-process-sentinel
        (get-buffer-process helm-buffer)
-       (lambda (_process event)
-           (if (string= event "finished\n")
+       (lambda (process event)
+           (if (or (string= event "finished\n")
+                   (process-get process 'reach-limit))
                (with-helm-window
                  (setq mode-line-format
                        '(" " mode-line-buffer-identification " "
@@ -1680,7 +1682,8 @@ returns if available with current AG version."
                                      "[%s process finished - (no results)] "
                                      ,(upcase proc-name))
                                     'face 'helm-grep-finish))))))
-                 ((string= event "finished\n")
+                 ((or (string= event "finished\n")
+                      (process-get process 'reach-limit))
                   (helm-log "helm-grep-ag-init" "%s process finished with %s 
results in %fs"
                               proc-name
                               (helm-get-candidate-number)
diff --git a/helm-locate.el b/helm-locate.el
index 26721a171d..8270d2a55d 100644
--- a/helm-locate.el
+++ b/helm-locate.el
@@ -363,7 +363,8 @@ See also `helm-locate'."
                       (insert (concat "* Exit with code 1, no result found,"
                                       " command line was:\n\n "
                                       cmd)))))
-                 ((string= event "finished\n")
+                 ((or (string= event "finished\n")
+                      (process-get process 'reach-limit))
                   (when (and helm-locate-fuzzy-match
                              (not (string-match-p "\\s-" helm-pattern)))
                     (helm-redisplay-buffer))

Reply via email to