How to simulate return in emacs minibuffer
-
27-10-2019 - |
Question
What I want to do is, when I find myself using a function that prompts me for a value, and this value is ALWAYS the right one, to be able to bind the function to a key and auto-accept the answer, simulating a RET in the minibuffer.
Take for instance "ido-switch-buffer". When entered, it prompts you for a buffer name, and proposes the last visited one.
(It can do a lot more, that's why I dont want to re-define it, I just want a wrapper around it)
Say I want to switch between the last visited two buffers, how would I say that in my .emacs ?
Solution
You may bind any keyboard macro, which is essentially a sequence of keys, to a key. For example,
(global-set-key (kbd "C-c b") (kbd "C-x b <return>"))
OTHER TIPS
You can do this with:
(switch-to-buffer (other-buffer))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow