changeset 108022:2db141e51824

Added C-o keybinding to toggle use of virtual buffers * ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o toggles the use of virtual buffers. (ido-buffer-internal): Guard `ido-use-virtual-buffers' global value. (ido-toggle-virtual-buffers): New function.
author John Wiegley <jwiegley@gmail.com>
date Wed, 21 Apr 2010 07:00:58 -0400
parents 3aba143264de
children 150fd3d78f5a
files lisp/ChangeLog lisp/ido.el
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Apr 20 23:49:28 2010 -0700
+++ b/lisp/ChangeLog	Wed Apr 21 07:00:58 2010 -0400
@@ -1,3 +1,11 @@
+2010-04-21  John Wiegley  <jwiegley@gmail.com>
+
+	* ido.el (ido-init-completion-maps): For ido-switch-buffer, C-o
+	toggles the use of virtual buffers.
+	(ido-buffer-internal): Guard `ido-use-virtual-buffers' global
+	value.
+	(ido-toggle-virtual-buffers): New function.
+
 2010-04-21  Juanma Barranquero  <lekktu@gmail.com>
 
 	Use `define-derived-mode'; fix window selection; doc fixes.
--- a/lisp/ido.el	Tue Apr 20 23:49:28 2010 -0700
+++ b/lisp/ido.el	Wed Apr 21 07:00:58 2010 -0400
@@ -1633,6 +1633,7 @@
     (define-key map "\C-x\C-f" 'ido-enter-find-file)
     (define-key map "\C-x\C-b" 'ido-fallback-command)
     (define-key map "\C-k" 'ido-kill-buffer-at-head)
+    (define-key map "\C-o" 'ido-toggle-virtual-buffers)
     (set-keymap-parent map ido-common-completion-map)
     (setq ido-buffer-completion-map map)))
 
@@ -2182,6 +2183,7 @@
 	   (ido-current-directory nil)
 	   (ido-directory-nonreadable nil)
 	   (ido-directory-too-big nil)
+	   (ido-use-virtual-buffers ido-use-virtual-buffers)
 	   (require-match (confirm-nonexistent-file-or-buffer))
 	   (buf (ido-read-internal 'buffer (or prompt "Buffer: ") 'ido-buffer-history default
 				   require-match initial))
@@ -2705,6 +2707,16 @@
 	(setq ido-exit 'keep)
 	(exit-minibuffer))))
 
+(defun ido-toggle-virtual-buffers ()
+  "Toggle the use of virtual buffers.
+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-text-init ido-text)
+    (setq ido-exit 'refresh)
+    (exit-minibuffer)))
+
 (defun ido-reread-directory ()
   "Read current directory again.
 May be useful if cached version is no longer valid, but directory