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

    Protect regexp searchs and bounds-of-thing-at-point
---
 isl.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/isl.el b/isl.el
index efb06ce0084..a5f817bf2fc 100644
--- a/isl.el
+++ b/isl.el
@@ -671,19 +671,24 @@ symbol position."
          (initial (or (assq 'identity pattern)
                       '(identity . "")))
          (rest    (cdr pattern)))
-    (cl-loop while (funcall isl-search-function (cdr initial) nil t)
+    (cl-loop while (condition-case _err
+                       (funcall isl-search-function (cdr initial) nil t)
+                     (invalid-regexp nil))
              for bounds = (if rest
                               (bounds-of-thing-at-point
                                (if (derived-mode-p 'prog-mode)
                                    'symbol 'filename))
                             (cons (match-beginning 0) (match-end 0)))
+             unless bounds return nil
              if (or (not rest)
                     (cl-loop for (pred . re) in rest
                              always (funcall pred
                                              (progn
                                                (goto-char (car bounds))
-                                               (funcall isl-search-function
-                                                        re (cdr bounds) t)))))
+                                               (condition-case _err
+                                                   (funcall isl-search-function
+                                                            re (cdr bounds) t)
+                                                 (invalid-regexp nil))))))
              do (goto-char (cdr bounds)) and return bounds
              else do (goto-char (cdr bounds))
              finally return nil)))

Reply via email to