I'm trying to write a command that I would call while using
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
(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:
(ido-exit-minibuffer)switch to the candidate buffer (in the current window) if I had called
ido-switch-bufferor they kill it if I had called
(abort-recursive-edit)(thanks Drew for the tip!) the command does nothing.