]> code.delx.au - gnu-emacs-elpa/commitdiff
ivy.el (ivy--format-minibuffer-line): Add ignore-errors
authorOleh Krehel <ohwoeowho@gmail.com>
Wed, 13 Apr 2016 17:08:55 +0000 (19:08 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Wed, 13 Apr 2016 17:08:55 +0000 (19:08 +0200)
It's OK to have a bad regex there while editing.

ivy.el

diff --git a/ivy.el b/ivy.el
index ba76632ae85ddd93cc6ee8e9aba0561c2f87d4f9..18f9dca681977b0388a3d7adba3192eaf3d9e726 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -2424,23 +2424,24 @@ SEPARATOR is used to join the candidates."
                 (not (eq ivy--regex-function 'ivy--regex-fuzzy)))
            (unless ivy--old-re
              (setq ivy--old-re (funcall ivy--regex-function ivy-text)))
-           (while (and (string-match ivy--old-re str start)
-                       (> (- (match-end 0) (match-beginning 0)) 0))
-             (setq start (match-end 0))
-             (let ((i 0))
-               (while (<= i ivy--subexps)
-                 (let ((face
-                        (cond ((zerop ivy--subexps)
-                               (cadr ivy-minibuffer-faces))
-                              ((zerop i)
-                               (car ivy-minibuffer-faces))
-                              (t
-                               (nth (1+ (mod (+ i 2) (1- (length ivy-minibuffer-faces))))
-                                    ivy-minibuffer-faces)))))
-                   (ivy-add-face-text-property
-                    (match-beginning i) (match-end i)
-                    face str))
-                 (cl-incf i))))))
+           (ignore-errors
+             (while (and (string-match ivy--old-re str start)
+                         (> (- (match-end 0) (match-beginning 0)) 0))
+               (setq start (match-end 0))
+               (let ((i 0))
+                 (while (<= i ivy--subexps)
+                   (let ((face
+                          (cond ((zerop ivy--subexps)
+                                 (cadr ivy-minibuffer-faces))
+                                ((zerop i)
+                                 (car ivy-minibuffer-faces))
+                                (t
+                                 (nth (1+ (mod (+ i 2) (1- (length ivy-minibuffer-faces))))
+                                      ivy-minibuffer-faces)))))
+                     (ivy-add-face-text-property
+                      (match-beginning i) (match-end i)
+                      face str))
+                   (cl-incf i)))))))
     str))
 
 (ivy-set-display-transformer