branch: elpa/isl
commit 6af569bd4a240660726029c11308f4d907fb8d6c
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    New function to decide when starting update
    
    This prevent isl hanging forever with bad regexp.
    We use a list of bad regexps and don't start updating as long as input
    is one of these regexps (same as helm).
---
 isl.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/isl.el b/isl.el
index 03bdaca25e5..9f9d3c4d934 100644
--- a/isl.el
+++ b/isl.el
@@ -84,6 +84,11 @@
 ;; User vars
 (defvar isl-timer-delay 0.01)
 
+(defvar isl-update-blacklist-regexps
+  '("^" "^ " "\\'" "$" "!" " " "\\b"
+    "\\<" "\\>" "\\_<" "\\_>" ".*"
+    "??" "?*" "*?" "?"))
+
 (defvar isl-help-string
   "* ISL help\n
 
@@ -766,6 +771,11 @@ symbol or line position according to 
`isl-multi-search-in-line'."
         (set-face-attribute 'isl-on nil :extend nil))
       (isl-update))))
 
+(defun isl-maybe-update (str)
+  (and (> (length str) isl-requires-pattern)
+       (not (member (replace-regexp-in-string "\\s\\ " " " str)
+                    isl-update-blacklist-regexps))))
+
 (defun isl-update ()
   "Update `current-buffer' when `isl-pattern' changes."
   (with-selected-window (minibuffer-selected-window)
@@ -909,7 +919,8 @@ appended at end."
     (let ((input (minibuffer-contents)))
       (when (not (string= input isl-pattern))
         (setq isl-pattern input)
-        (if (> (length input) isl-requires-pattern)
+        (if (and (stringp isl-pattern)
+                 (isl-maybe-update isl-pattern))
             (isl-update)
           (with-selected-window (minibuffer-selected-window)
             (isl-delete-overlays)

Reply via email to