From 672fb2c769512730ba6dabe6f95dd1aa94aeb489 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 7 Oct 2019 17:14:10 +0200 Subject: [PATCH] Make ido-display-buffer work interactively more like display-buffer * lisp/ido.el (ido-display-buffer): Take an interactive parameter, like `display-buffer' (bug#14904). (ido-visit-buffer): Use it to emulate `C-u M-x display-buffer'. --- lisp/ido.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lisp/ido.el b/lisp/ido.el index faa6e678f9f..1cfcb0f5358 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -4141,6 +4141,9 @@ Record command in `command-history' if optional RECORD is non-nil." ((eq method 'display) (display-buffer buffer)) + ((eq method 'display-even-when-displayed) + (display-buffer buffer t)) + ((eq method 'other-frame) (switch-to-buffer-other-frame buffer) (select-frame-set-input-focus (selected-frame))) @@ -4225,12 +4228,20 @@ For details of keybindings, see `ido-switch-buffer'." (ido-buffer-internal 'other-window 'switch-to-buffer-other-window)) ;;;###autoload -(defun ido-display-buffer () +(defun ido-display-buffer (&optional action) "Display a buffer in another window but don't select it. + +If ACTION (the prefix argument interactively), display the buffer +in another windown even if it's already displayed in the current +window. + The buffer name is selected interactively by typing a substring. For details of keybindings, see `ido-switch-buffer'." - (interactive) - (ido-buffer-internal 'display 'display-buffer nil nil nil 'ignore)) + (interactive "P") + (ido-buffer-internal (if action + 'display-even-when-displayed + 'display) + 'display-buffer nil nil nil 'ignore)) ;;;###autoload (defun ido-display-buffer-other-frame () -- 2.39.5