[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 3f4f080 226/272: counsel-ag now works with ivy-occur-rever

From: Oleh Krehel
Subject: [elpa] master 3f4f080 226/272: counsel-ag now works with ivy-occur-revert-buffer
Date: Mon, 25 Apr 2016 10:13:27 +0000

branch: master
commit 3f4f0809de70703fc3706c541d3fc27c5fc49a11
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel-ag now works with ivy-occur-revert-buffer
    * ivy.el (ivy-occur-revert-buffer): Add `counsel-ag' to the list.
    * counsel.el (counsel-ag-occur): Don't call `ivy-occur-grep-mode' unless
    > (string-match "\"\\(.*\\)\"" (buffer-name))
    Is a hack to recover the old `ivy-text', since it's not a field in
    `ivy-last', and may have changed in the meantime.
    TODO: Fix this sort of hacks, all necessary session data should really be 
in `ivy-last'.
 counsel.el |    7 +++++--
 ivy.el     |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index cce85dc..5472969 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1337,11 +1337,14 @@ INITIAL-INPUT can be given as the initial minibuffer 
 (defun counsel-ag-occur ()
   "Generate a custom occur buffer for `counsel-ag'."
-  (ivy-occur-grep-mode)
+  (unless (eq major-mode 'ivy-occur-grep-mode)
+    (ivy-occur-grep-mode))
   (setq default-directory counsel--git-grep-dir)
   (let* ((regex (counsel-unquote-regex-parens
                  (setq ivy--old-re
-                       (ivy--regex ivy-text))))
+                       (ivy--regex
+                        (progn (string-match "\"\\(.*\\)\"" (buffer-name))
+                               (match-string 1 (buffer-name)))))))
          (cands (split-string
                   (format counsel-ag-base-command (shell-quote-argument 
diff --git a/ivy.el b/ivy.el
index 5b23a4e..8d25e28 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2853,7 +2853,7 @@ updated original buffer."
              (let ((inhibit-read-only t))
                (funcall (plist-get ivy--occurs-list caller) t))))
-          ((memq caller '(counsel-git-grep counsel-grep))
+          ((memq caller '(counsel-git-grep counsel-grep counsel-ag))
            (let ((inhibit-read-only t))
              (funcall (plist-get ivy--occurs-list caller)))))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]