The Computer Oracle

How to get back to an active minibuffer prompt in emacs without the mouse

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Puzzle3

--

Chapters
00:00 How To Get Back To An Active Minibuffer Prompt In Emacs Without The Mouse
00:30 Answer 1 Score 25
00:55 Accepted Answer Score 26
01:12 Answer 3 Score 6
01:42 Answer 4 Score 0
01:57 Thank you

--

Full question
https://superuser.com/questions/132225/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#emacs #focus #mouseless #minibuffer

#avk47



ACCEPTED ANSWER

Score 26


This will do what you want. Bind to the key of your choice:

(defun switch-to-minibuffer-window ()
  "switch to minibuffer window (if active)"
  (interactive)
  (when (active-minibuffer-window)
    (select-frame-set-input-focus (window-frame (active-minibuffer-window)))
    (select-window (active-minibuffer-window))))
(global-set-key (kbd "<f7>") 'switch-to-minibuffer-window)



ANSWER 2

Score 25


C-x o 

Repeat as necessary.

C-x o runs the command other-window, which is an interactive built-in function in `C source code'.

If you do not want to cycle through windows, you can add a function in your init file and bind it to a key. Something like this might work:

(defun select-minibuffer ()
 "Make the active minibuffer the selected window."
 (interactive)
 (when (active-minibuffer-window)
   (select-window (active-minibuffer-window))))



ANSWER 3

Score 6


Another option is using switch-window

I find it to be a really useful package: it allows you to quickly move to any Emacs window, visually (and I do use a lot of open windows in Emacs).

But I just find out it also allows you to move to the minibuffer, if it is active:

enter image description here

Hope it helps.




ANSWER 4

Score 0


;; faster switching between windows in the same frame
(windmove-default-keybindings)

Adding two above lines of code to .emacs.el will enable simple and efficient moving, not just to minibuffer, but also navigating all other windows on Emacs frame using Shift-Arrow.