How can I prevent the mini-buffer from displaying previous commands in Emacs?

旧城冷巷雨未停 提交于 2019-12-05 05:02:01

The mini-buffer has lost focus. Try C-x o (Control+x o) to regain focus. To cancel the command press C-g when you have focus in the mini-buffer.

Trey Jackson

Chances are you're getting into the situation because you started a command and used your mouse to select something in a different window. If that's the case, you can have Emacs automatically abort the command when you do such an action.

This is the code you'd add to your .emacs:

(defun stop-using-minibuffer ()
  "kill the minibuffer"
  (when (and (>= (recursion-depth) 1) (active-minibuffer-window))
    (abort-recursive-edit)))

(add-hook 'mouse-leave-buffer-hook 'stop-using-minibuffer)

Note: I grabbed this from my blog post on the topic.

And there is also a super user question that addresses this issue, and my answer there provides a command to jump back to the minibuffer.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!