]> git.eshelyaron.com Git - emacs.git/commitdiff
Make ido-display-buffer work interactively more like display-buffer
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 7 Oct 2019 15:14:10 +0000 (17:14 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 7 Oct 2019 15:14:15 +0000 (17:14 +0200)
* 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

index faa6e678f9f49a9ada7c47a123e8e5693655af73..1cfcb0f53587377b217d3204ca57762e40e43ff9 100644 (file)
@@ -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 ()