branch: master
commit f7fc3ad48bebd70bcac121de57c5ea1e01a7644a
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    Work around grep-read-files
    
    * ivy.el (ivy--done): If history is `grep-files-history', the caller is
      `grep-read-files'. Don't expand the file name, since it's probably a
      glob, and `find' doesn't work with expanded globs.
    
    It should now be possible to simply "M-x" rgrep "RET" "RET" "RET".
    
    Fixes #72
---
 ivy.el |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ivy.el b/ivy.el
index 0f3a56d..0bf8f04 100644
--- a/ivy.el
+++ b/ivy.el
@@ -187,11 +187,11 @@ When non-nil, it should contain one %d.")
 
 (defun ivy--done (text)
   "Insert TEXT and exit minibuffer."
-  (insert
-   (if ivy--directory
-       (expand-file-name
-        text ivy--directory)
-     text))
+  (if (and ivy--directory
+           (not (eq (ivy-state-history ivy-last) 'grep-files-history)))
+      (insert (expand-file-name
+                 text ivy--directory))
+    (insert text))
   (setq ivy-exit 'done)
   (exit-minibuffer))
 

Reply via email to