Emacs: Cannot Kill Minibuffer

I'm new to emacs and I have a problem with the minibuffer turned on when I don't think it should be. I have the following mapping for "other-window:

 (global-set-key (kbd "M-s M-s") 'other-window)

I know that it will be a loop through the minibuffer if it is active, and I like this behavior. The problem is that my minibuffer continues to get stuck in the following state:

Next element matching (regexp):

It sometimes appears there when I don’t even try to do a regular expression search or even a search at all. When I hit C-gto kill him, I get a message Quit, but the minibuffer remains active and returns back to

Next element matching (regexp): 

Also, when it is in this state, I cannot use M-s M-sto go to the next window in my frame. C-x ostill seems to work.

It also seems to me that I can run other minibuffer commands (like searching for files) very well, even when I'm stuck like this.

Is there a way that I can do one of the following:

  • Kill the minibuffer in this mode.
  • Set my own “another window” function M-s M-sto exit the minibuffer and go to the next window?

Any solution would be good, although the first could be better, since getting a stuck microbuffer could have other unexpected consequences.

+4
source share
3 answers

Just do the following:

(define-key minibuffer-local-map "\M-s" nil)

, M-s ( minibuffer-local-must-match-map -) next-matching-history-element, .

, unbind M-s - -: .. nil. ; minibuffer-local-map , minibuffer-local-ns-map. M-x apropos-variable minibuffer map .

[ C-h M-k , , minibuffer-local-must-match-map - ​​ help-fns+.el.]

+4

, , ( , Next element matching (regexp):) M-s M-s .

, .

, , C-g , . , Emacs, . M-s M-s , C-g.

, , , :

(global-set-key (kbd "M-s M-s") 'my-other-window)

(defun my-other-window (count)
  (interactive "p")
  (if (and (>= (recursion-depth) 1) (active-minibuffer-window))
      (abort-recursive-edit)
    (other-window count)))

, ( ), .

+1

, . , , C-].

+1

Source: https://habr.com/ru/post/1539949/


All Articles