branch: master
commit de5833ee3de2e6a15ec0ac8cd887fc7bef97cbf3
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
Don't error on incomplete bad regexp in counsel-git-grep
counsel.el (counsel-git-grep-matcher): Update.
---
counsel.el | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/counsel.el b/counsel.el
index ea5496e..194322f 100644
--- a/counsel.el
+++ b/counsel.el
@@ -250,19 +250,20 @@
: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)