I'm trying to write a command that I would call while using ido-switch-buffer
or ido-kill-buffer
to open the current candidate in another window. Ideally it would be able to open virtual buffers as well.
One thing it seems I've got right is that I need to bind it in ido-buffer-completion-map
:
(define-key ido-buffer-completion-map "\C-n" #'ido-visit-buffer-other-window)
But I can't make a function that works. I've given up at
(defun ido-visit-buffer-other-window (candidate)
"Visit the buffer at the head of ‘ido-matches’ in its window or
in a new one if no one is displaying it."
(interactive (list (car ido-matches)))
(let ((buffer (or (get-buffer candidate)
;; Check for a virtual buffer reference.
(find-file-noselect (cdr (assoc candidate ido-virtual-buffers))))))
(switch-to-buffer-other-window buffer)))
Whatever I do the Ido prompt remains lingering in the minibuffer. Every way of getting out of the minibuffer that I've tried breaks the function:
(exit-minibuffer)
or(ido-exit-minibuffer)
switch to the candidate buffer (in the current window) if I had calledido-switch-buffer
or they kill it if I had calledido-kill-buffer
;- with
(minibuffer-keyboard-quit)
and(abort-recursive-edit)
(thanks Drew for the tip!) the command does nothing.
(abort-recursive-edit)
instead of(exit-minibuffer)
? How does Ido normally end its minibuffer interaction - is it withexit-minibuffer
?