diff --git a/lisp/ido.el b/lisp/ido.el
index cbcca62..1e470c8 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -775,8 +775,10 @@ can be completed using TAB,
   :type '(repeat string)
   :group 'ido)
 
-(defcustom ido-use-virtual-buffers nil
-  "If non-nil, refer to past buffers as well as existing ones.
+(defcustom ido-use-virtual-buffers 'never
+  "If `always', refer to past buffers as well as existing ones.
+If `auto', refer to past buffers only when the current input
+doesn't match an existing buffer.
 Essentially it works as follows: Say you are visiting a file and
 the buffer gets cleaned up by mignight.el.  Later, you want to
 switch to that buffer, but find it's no longer open.  With
@@ -786,11 +788,12 @@ you select it, it opens the file back up again.  This allows you
 to think less about whether recently opened files are still open
 or not.  Most of the time you can quit Emacs, restart, and then
 switch to a file buffer that was previously open as if it still
-were.
-    This feature relies upon the `recentf' package, which will be
-enabled if this variable is configured to a non-nil value."
+were.  This feature relies upon the `recentf' package, which will
+be enabled if this variable is configured to a non-nil value."
   :version "24.1"
-  :type 'boolean
+  :type '(choice (const always)
+		 (const auto)
+		 (const never))
   :group 'ido)
 
 (defcustom ido-handle-duplicate-virtual-buffers 1
@@ -799,14 +802,6 @@ enabled if this variable is configured to a non-nil value."
   :type 'integer
   :group 'ido)
 
-(defcustom ido-use-virtual-buffers-automatically nil
-  "Use virtual buffers automatically.
-If non-nil, virtual buffers are automatically enabled when user
-input does not match any existing buffers."
-  :version "24.1"
-  :type 'boolean
-  :group 'ido)
-
 (defcustom ido-use-faces t
   "Non-nil means use ido faces to highlighting first match, only match and
 subdirs in the alternatives."
@@ -1071,7 +1066,7 @@ Value is an integer which is number of chars to right of prompt.")
 (defvar ido-virtual-buffers nil
   "List of virtual buffers, that is, past visited files.
 This is a copy of `recentf-list', pared down and with faces applied.
-Only used if `ido-use-virtual-buffers' is non-nil.")
+Only used if `ido-use-virtual-buffers' is not `never'.")
 
 ;;; Variables with dynamic bindings.
 ;;; Declared here to keep the byte compiler quiet.
@@ -1861,6 +1856,7 @@ If INITIAL is non-nil, it specifies the initial input string."
        (icomplete-mode nil) ;; prevent icomplete starting up
        ;; Exported dynamic variables:
        ido-cur-list
+       ido-existing-buffers
        ido-ignored-list
        (ido-rotate-temp nil)
        (ido-keep-item-list nil)
@@ -1879,6 +1875,11 @@ If INITIAL is non-nil, it specifies the initial input string."
 
     (run-hooks 'ido-setup-hook)
 
+    (when (eq ido-cur-item 'buffer)
+      (setq ido-existing-buffers
+	    (let (ido-virtual-buffers-enabled)
+	      (ido-make-buffer-list nil))))
+
     (while (not done)
       (ido-trace "\n_LOOP_" ido-text-init)
       (setq ido-exit nil)
@@ -2201,7 +2202,8 @@ If cursor is not at the end of the user input, move to end of input."
 	   (ido-current-directory nil)
 	   (ido-directory-nonreadable nil)
 	   (ido-directory-too-big nil)
-	   (ido-use-virtual-buffers ido-use-virtual-buffers)
+	   (ido-virtual-buffers-enabled (eq ido-use-virtual-buffers 'always))
+	   (ido-virtual-buffers-inhibit (not ido-virtual-buffers-enabled))
 	   (require-match (confirm-nonexistent-file-or-buffer))
 	   (buf (ido-read-internal 'buffer (or prompt "Buffer: ") 'ido-buffer-history default
 				   require-match initial))
@@ -2242,7 +2244,9 @@ If cursor is not at the end of the user input, move to end of input."
 	  (ido-visit-buffer buf method t)))
 
        ;; check for a virtual buffer reference
-       ((and ido-use-virtual-buffers ido-virtual-buffers
+       ((and (or (eq ido-use-virtual-buffers 'always)
+		 (eq ido-use-virtual-buffers 'auto))
+	     ido-virtual-buffers
 	     (setq filename (assoc buf ido-virtual-buffers)))
 	(ido-visit-buffer (find-file-noselect (cdr filename)) method t))
 
@@ -2736,7 +2740,8 @@ C-x C-f ... C-d  enter `dired' on current directory."
 See `ido-use-virtual-buffers' for explanation of virtual buffer."
   (interactive)
   (when (and ido-mode (eq ido-cur-item 'buffer))
-    (setq ido-use-virtual-buffers (not ido-use-virtual-buffers))
+    (setq ido-virtual-buffers-enabled
+	  (not ido-virtual-buffers-enabled))
     (setq ido-text-init ido-text)
     (setq ido-exit 'refresh)
     (exit-minibuffer)))
@@ -3427,7 +3432,9 @@ for first matching file."
     (if default
         (setq ido-temp-list
               (cons default (delete default ido-temp-list))))
-    (if ido-use-virtual-buffers
+    (if (or (eq ido-use-virtual-buffers 'always)
+	    (and (boundp ido-virtual-buffers-enabled)
+		 ido-virtual-buffers-enabled))
 	(ido-add-virtual-buffers-to-list))
     (run-hooks 'ido-make-buffer-list-hook)
     ido-temp-list))
@@ -4510,14 +4517,32 @@ For details of keybindings, see `ido-find-file'."
 	    (setq ido-exit 'refresh)
 	    (exit-minibuffer)))
 
-        (when (and ido-use-virtual-buffers-automatically
+	(when (and (eq ido-use-virtual-buffers 'auto)
                    (eq ido-cur-item 'buffer)
                    (not ido-matches)
-                   (not ido-use-virtual-buffers))
+		   ido-virtual-buffers-inhibit)
           (setq ido-text-init ido-text)
-          (setq ido-use-virtual-buffers t)
-          (setq ido-exit 'refresh)
-          (exit-minibuffer))
+	  (setq ido-virtual-buffers-enabled t)
+	  (setq ido-virtual-buffers-inhibit nil)
+	  (setq ido-exit 'refresh)
+	  (exit-minibuffer))
+
+	(when (and (eq ido-use-virtual-buffers 'auto)
+                   (eq ido-cur-item 'buffer)
+		   ido-matches
+		   ido-virtual-buffers-enabled
+		   (not ido-virtual-buffers-inhibit))
+	  ;; protect ido-matches from being modified by ido-set-matches
+	  (let ((ido-matches ido-matches))
+	    (let ((ido-cur-list ido-existing-buffers)
+		  (ido-rotate ido-rotate))
+	      (ido-set-matches))
+	    (when ido-matches
+	      (setq ido-virtual-buffers-enabled nil)
+	      (setq ido-virtual-buffers-inhibit t)
+	      (setq ido-text-init ido-text)
+	      (setq ido-exit 'refresh)
+	      (exit-minibuffer))))
 
 	(when (and
 	       ido-rescan
