[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2e4f2fb 213/399: Fix grep-occur when using multi-pass re-b
From: |
Oleh Krehel |
Subject: |
[elpa] master 2e4f2fb 213/399: Fix grep-occur when using multi-pass re-builders |
Date: |
Sat, 20 Jul 2019 14:57:25 -0400 (EDT) |
branch: master
commit 2e4f2fb589921a8e0748dc41094a987929555d12
Author: Troy Hinckley <address@hidden>
Commit: Oleh Krehel <address@hidden>
Fix grep-occur when using multi-pass re-builders
Fixes #2033
---
counsel.el | 44 +++++++++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 19 deletions(-)
diff --git a/counsel.el b/counsel.el
index 5610334..0b6df50 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2614,23 +2614,28 @@ NEEDLE is the search string."
(funcall ivy--regex-function str))
counsel--regex-look-around))
+(defun counsel--ag-extra-switches (regex)
+ "Get additional switches needed for look-arounds."
+ (and (stringp counsel--regex-look-around)
+ ;; using look-arounds
+ (string-match-p "\\`\\^(\\?[=!]" regex)
+ (concat " " counsel--regex-look-around " ")))
+
(defun counsel-ag-function (string)
"Grep in the current directory for STRING."
- (let ((command-args (counsel--split-command-args string)))
- (let ((switches (car command-args))
- (search-term (cdr command-args)))
- (or
- (let ((ivy-text search-term))
- (ivy-more-chars))
- (let ((default-directory (ivy-state-directory ivy-last))
- (regex (counsel--grep-regex search-term)))
- (if (and (stringp counsel--regex-look-around)
- (string-match-p "\\`\\^(\\?[=!]" regex)) ;; using
look-arounds
- (setq switches (concat switches " " counsel--regex-look-around)))
- (counsel--async-command (counsel--format-ag-command
- switches
- (shell-quote-argument regex)))
- nil)))))
+ (let* ((command-args (counsel--split-command-args string))
+ (search-term (cdr command-args)))
+ (or
+ (let ((ivy-text search-term))
+ (ivy-more-chars))
+ (let* ((default-directory (ivy-state-directory ivy-last))
+ (regex (counsel--grep-regex search-term))
+ (switches (concat (car command-args)
+ (counsel--ag-extra-switches regex))))
+ (counsel--async-command (counsel--format-ag-command
+ switches
+ (shell-quote-argument regex)))
+ nil))))
;;;###autoload
(cl-defun counsel-ag (&optional initial-input initial-directory extra-ag-args
ag-prompt
@@ -2692,12 +2697,13 @@ CALLER is passed to `ivy-read'."
(and (string-match "\"\\(.*\\)\"" (buffer-name))
(match-string 1 (buffer-name))))
(let* ((command-args (counsel--split-command-args ivy-text))
+ (regex (counsel--grep-regex (cdr command-args)))
+ (switches (concat (car command-args)
+ (counsel--ag-extra-switches regex)))
(cmd (format cmd-template
(concat
- (car command-args)
- (shell-quote-argument
- (counsel--elisp-to-pcre
- (ivy--regex (cdr command-args)))))))
+ switches
+ (shell-quote-argument regex))))
(cands (split-string (shell-command-to-string cmd)
counsel-async-split-string-re
t)))
- [elpa] master 9c1e1c3 216/399: swiper.el (swiper-isearch-function): Obey ivy-case-fold-search-default, (continued)
- [elpa] master 9c1e1c3 216/399: swiper.el (swiper-isearch-function): Obey ivy-case-fold-search-default, Oleh Krehel, 2019/07/20
- [elpa] master 6f56049 230/399: ivy.el (ivy--minibuffer-index-bounds): Make pure, Oleh Krehel, 2019/07/20
- [elpa] master 9eb5275 227/399: ivy.el (ivy--minibuffer-index-bounds): Extract, Oleh Krehel, 2019/07/20
- [elpa] master f292ed3 226/399: ivy.el (ivy-help): Reveal all Org contents, Oleh Krehel, 2019/07/20
- [elpa] master 3a16cec 223/399: ivy.el (ivy-occur): Don't setq-local ivy--directory, Oleh Krehel, 2019/07/20
- [elpa] master 9e513d0 211/399: swiper.el (swiper-thing-at-point): Add, Oleh Krehel, 2019/07/20
- [elpa] master ecff164 215/399: ivy.el (ivy-insert-current): Minor simplification, Oleh Krehel, 2019/07/20
- [elpa] master 8a8aea2 219/399: counsel.el (counsel-company): Use company-prefix, Oleh Krehel, 2019/07/20
- [elpa] master fa9acdb 222/399: swiper.el (swiper-isearch-thing-at-point): Add symbol boundaries, Oleh Krehel, 2019/07/20
- [elpa] master 6768214 221/399: ivy.el (ivy--insert-symbol-boundaries): Extract, Oleh Krehel, 2019/07/20
- [elpa] master 2e4f2fb 213/399: Fix grep-occur when using multi-pass re-builders,
Oleh Krehel <=
- [elpa] master a9e81f8 220/399: ivy.el: Don't offer virtual buffers for plain switch-to-buffer, Oleh Krehel, 2019/07/20
- [elpa] master 5eea0af 229/399: ivy.el (ivy--minibuffer-index-bounds): Simplify logic, Oleh Krehel, 2019/07/20
- [elpa] master c1ff0d6 228/399: ivy.el: Fix compiler warning, Oleh Krehel, 2019/07/20
- [elpa] master 6ec1126 225/399: ivy.el (ivy-help): Set org-hide-emphasis-markers, Oleh Krehel, 2019/07/20
- [elpa] master cc56ec0 231/399: swiper.el (swiper-isearch-format-function): Add, Oleh Krehel, 2019/07/20
- [elpa] master 6fd1620 235/399: swiper.el (swiper--recenter-p): Extract, Oleh Krehel, 2019/07/20
- [elpa] master 1d08b29 233/399: swiper.el (swiper-isearch): Ensure font lock, Oleh Krehel, 2019/07/20
- [elpa] master b49f17f 224/399: counsel.el (counsel-ag-function): Add dynamic case folding, Oleh Krehel, 2019/07/20
- [elpa] master e9f0772 218/399: ivy-test.el (counsel-find-file-with-dollars): Adjust, Oleh Krehel, 2019/07/20
- [elpa] master eee9716 236/399: Add open in dired action to counsel-file-jump, Oleh Krehel, 2019/07/20