(defcustom iswitchb-max-to-show nil
"*If non-nil, limit the number of names shown in the minibuffer.
-This can greatly speed up iswitchb if you have a multitude of
-buffers open."
- :type 'integer
+If this value is N, and N is greater than the number of matching
+buffers, the first N/2 and the last N/2 matching buffers are
+shown. This can greatly speed up iswitchb if you have a
+multitude of buffers open."
+ :type '(choice (const :tag "Show all" nil) integer)
:group 'iswitchb)
(defcustom iswitchb-cannot-complete-hook 'iswitchb-completion-help
(substitute-key-definition 'display-buffer ; C-x 4 C-o
'iswitchb-display-buffer map global-map)
map)
- "Global keymap for `iswtichb-mode'.")
+ "Global keymap for `iswitchb-mode'.")
(defvar iswitchb-history nil
"History of buffers selected using `iswitchb-buffer'.")
(iswitchb-possible-new-buffer buf)))
))))
-;;;###autoload
(defun iswitchb-read-buffer (prompt &optional default require-match)
"Replacement for the built-in `read-buffer'.
Return the name of a buffer selected.
(get-buffer-window buffer 0) ; better than 'visible
)))
-;;;###autoload
(defun iswitchb-default-keybindings ()
"Set up default keybindings for `iswitchb-buffer'.
Call this function to override the normal bindings. This function also
(global-set-key "\C-x4\C-o" 'iswitchb-display-buffer)
(global-set-key "\C-x5b" 'iswitchb-buffer-other-frame))
-;;;###autoload
(defun iswitchb-buffer ()
"Switch to another buffer.
(setq iswitchb-method iswitchb-default-method)
(iswitchb))
-;;;###autoload
(defun iswitchb-buffer-other-window ()
"Switch to another buffer and show it in another window.
The buffer name is selected interactively by typing a substring.
(setq iswitchb-method 'otherwindow)
(iswitchb))
-;;;###autoload
(defun iswitchb-display-buffer ()
"Display a buffer in another window but don't select it.
The buffer name is selected interactively by typing a substring.
(setq iswitchb-method 'display)
(iswitchb))
-;;;###autoload
(defun iswitchb-buffer-other-frame ()
"Switch to another buffer and show it in another frame.
The buffer name is selected interactively by typing a substring.
(> (length comps) iswitchb-max-to-show))
(setq comps
(append
- (subseq comps 0 (/ iswitchb-max-to-show 2))
+ (let ((res nil)
+ (comp comps)
+ (end (/ iswitchb-max-to-show 2)))
+ (while (>= (setq end (1- end)) 0)
+ (setq res (cons (car comp) res)
+ comp (cdr comp)))
+ (nreverse res))
(list "...")
- (subseq comps (- (length comps)
- (/ iswitchb-max-to-show 2))))))
+ (nthcdr (- (length comps)
+ (/ iswitchb-max-to-show 2)) comps))))
(let* (
;;(most (try-completion name candidates predicate))
(most nil)