]> code.delx.au - gnu-emacs-elpa/commitdiff
ivy.el (ivy-call): Add selected-window work-around for M-x
authorOleh Krehel <ohwoeowho@gmail.com>
Wed, 22 Jul 2015 20:24:11 +0000 (22:24 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Wed, 22 Jul 2015 20:24:11 +0000 (22:24 +0200)
* ivy.el (ivy-call): For some commands that depend on the buffer, like
`counsel-git-grep' the action needs to be performed in
`ivy-state-window'. However, this results in wrong window for M-x calc.
Add a workaround until I figure out why this happens.

Fixes #176

ivy.el

diff --git a/ivy.el b/ivy.el
index 59221e24c58d18f1c4f80b01eef8841a9d39d8a0..82377040bd18c7970292fde994730d960038a0e3 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -550,8 +550,10 @@ If the input is empty, select the previous history element instead."
                          (consp (car collection)))
                     (cdr (assoc ivy--current collection))
                   ivy--current)))
-        (with-selected-window (ivy-state-window ivy-last)
-          (funcall action x))))))
+        (if (eq (ivy-state-history ivy-last) 'extended-command-history)
+            (funcall action x)
+          (with-selected-window (ivy-state-window ivy-last)
+            (funcall action x)))))))
 
 (defun ivy-next-line-and-call (&optional arg)
   "Move cursor vertically down ARG candidates.