2

According to helpful-key, C-x b is bound to ivy switch buffer:

enter image description here

According to the code, that is an interactive function. However, when I look for it in the Counsel-M-x menu, it's not found:

enter image description here

I figured since this is an interactive function, I should be able to call it from the M-x menu. I'm able to call it from the scratch buffer using eval-last-sexp, and through C-x b, but not M-x. Why wouldn't this show up in the M-x menu?

1 Answer 1

2

I figured since this is an interactive function, I should be able to call it from the M-x menu.

You can call it from M-x (execute-extended-command), just not from M-x (counsel-M-x). IOW, you have probably enabled counsel-mode which remaps M-x to counsel-M-x.

Quoth Counsel's Changelog file:

counsel-M-x

Some commands are intended to be called only via their key binding. Make them disappear from counsel-M-x like this:

(put 'counsel-find-symbol 'no-counsel-M-x t)

See #2270.

And indeed, by inspection, we see that:

(function-get #'ivy-switch-buffer 'no-counsel-M-x) ; => t

So if you want ivy-switch-buffer (or any similar command) to show up as a candidate in counsel-M-x completion, you can say something like the following:

(function-put #'ivy-switch-buffer 'no-counsel-M-x nil)

See also Why ivy-immediate-done is not shown in counsel-M-x.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.