]> code.delx.au - gnu-emacs-elpa/commitdiff
Don't error on incomplete bad regexp in counsel-git-grep
authorOleh Krehel <ohwoeowho@gmail.com>
Sat, 16 May 2015 12:43:51 +0000 (14:43 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Sat, 16 May 2015 12:43:51 +0000 (14:43 +0200)
counsel.el (counsel-git-grep-matcher): Update.

counsel.el

index ea5496e8218b4f0a1903badcb49a3304a8bf2b2b..194322f2a5b3d8c172166c1fafead3ec79794f4d 100644 (file)
               :unwind #'swiper--cleanup)))
 
 (defun counsel-git-grep-matcher (x)
-  (when (string-match "^[^:]+:[^:]+:" x)
-    (setq x (substring x (match-end 0)))
-    (if (stringp ivy--old-re)
-        (string-match ivy--old-re x)
-      (let ((res t))
-        (dolist (re ivy--old-re)
-          (setq res
-                (and res
-                     (ignore-errors
-                       (if (cdr re)
-                           (string-match (car re) x)
-                         (not (string-match (car re) x)))))))
-        res))))
+  (ignore-errors
+    (when (string-match "^[^:]+:[^:]+:" x)
+      (setq x (substring x (match-end 0)))
+      (if (stringp ivy--old-re)
+          (string-match ivy--old-re x)
+        (let ((res t))
+          (dolist (re ivy--old-re)
+            (setq res
+                  (and res
+                       (ignore-errors
+                         (if (cdr re)
+                             (string-match (car re) x)
+                           (not (string-match (car re) x)))))))
+          res)))))
 
 (defun counsel-locate-function (str &rest _u)
   (if (< (length str) 3)