From c5cbeb128e3d3fc20d6e481308f154526c96e6cf Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Wed, 21 Apr 2010 07:00:58 -0400 Subject: [PATCH] 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. --- lisp/ChangeLog | 8 ++++++++ lisp/ido.el | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0aca3a2697d..1162638f8a9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2010-04-21 John Wiegley + + * 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 Use `define-derived-mode'; fix window selection; doc fixes. diff --git a/lisp/ido.el b/lisp/ido.el index 57aa7d4a723..14a5c14ff09 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -1633,6 +1633,7 @@ This function also adds a hook to the minibuffer." (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 @@ 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) (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 @@ C-x C-f ... C-d enter `dired' on current directory." (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 -- 2.11.4.GIT