Window focus issue when using counsel-M-x #176

kaushalmodi opened this Issue Jul 22, 2015 · 1 comment


None yet

2 participants


I recently noticed that I get window focus issue only when using counsel-M-x, not when using smex or execute-extended-command.

Here's an example:

If I do M-x counsel-M-x calc RET, the Calculator buffer opens but then the focus switches back to the window from where I executed that M-x counsel-M-x.

To test it out, do the below binding:

(global-set-key (kbd "C-c :") #'counsel-M-x)

and then do C-c : calc RET.

This issue does not occur when I do M-x smex calc RET or M-x execute-extended-command calc RET.

[my counsel setup]

@abo-abo abo-abo added a commit that closed this issue Jul 22, 2015
@abo-abo ivy.el (ivy-call): Add selected-window work-around for M-x
* 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
@abo-abo abo-abo closed this in adad288 Jul 22, 2015
abo-abo commented Jul 22, 2015

Thanks, it's a very strange bug. I don't quite understand it: a combination of with-selected-window and execute-extended-command leads to failure. I'm not sure it should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment