;; (global-set-key [remap other-window] 'other-window-or-prompt) | |
(defun other-window-or-prompt (count &optional all-frames) | |
"Calls `other-window' as you'd expect from \\[C-x o] with the exception when | |
there is an active prompt. In this case the minibuffer | |
window will become active. If the prompt was active on a different frame than | |
the current one that frame will be gain focus." | |
(interactive "p") | |
(if (minibuffer-prompt) | |
(unwind-protect | |
(let* ((minibuf (active-minibuffer-window)) | |
(minibuf-frame (window-frame minibuf))) | |
(unless (equal minibuf-frame (selected-frame)) | |
(select-frame minibuf-frame) | |
(raise-frame minibuf-frame)) | |
(when (window-live-p minibuf) | |
(select-window minibuf)))) | |
(other-window count all-frames))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment