]> code.delx.au - gnu-emacs/blobdiff - lisp/iswitchb.el
2004-05-08 John Wiegley <johnw@newartisans.com>
[gnu-emacs] / lisp / iswitchb.el
index 0c43c27075116c75c1f09cacf15574b7d735bec9..7bada72310c0971d90a9b407d750278d5fdf62a6 100644 (file)
@@ -300,9 +300,11 @@ example functions that filter buffernames."
 
 (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
@@ -462,7 +464,7 @@ interfere with other minibuffer usage.")
     (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'.")
@@ -569,7 +571,6 @@ in a separate window.
                 (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.
@@ -1071,7 +1072,6 @@ If BUFFER is visible in the current frame, return nil."
       (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
@@ -1085,7 +1085,6 @@ Obsolescent.  Use `iswitchb-mode'."
   (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.
 
@@ -1098,7 +1097,6 @@ For details of keybindings, do `\\[describe-function] iswitchb'."
   (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.
@@ -1107,7 +1105,6 @@ For details of keybindings, do `\\[describe-function] iswitchb'."
   (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.
@@ -1116,7 +1113,6 @@ For details of keybindings, do `\\[describe-function] iswitchb'."
   (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.
@@ -1244,10 +1240,16 @@ Modified from `icomplete-completions'."
                    (> (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)