Function: iswitchb

iswitchb is a byte-compiled function defined in iswitchb.el.gz.

Signature

(iswitchb)

Documentation

Switch to buffer matching a substring.

As you type in a string, all of the buffers matching the string are displayed. When you have found the buffer you want, it can then be selected. As you type, most keys have their normal keybindings, except for the following:

RET Select the buffer at the front of the list of matches. If the list is empty, possibly prompt to create new buffer.

C-j (iswitchb-select-buffer-text) Select the current prompt as the buffer. If no buffer is found, prompt for a new one.

C-s (iswitchb-next-match) Put the first element at the end of the list. C-r (iswitchb-prev-match) Put the last element at the start of the list. TAB (iswitchb-complete) Complete a common suffix to the current string that matches all buffers. If there is only one match, select that buffer. If there is no common suffix, show a list of all matching buffers in a separate window. C-t (iswitchb-toggle-regexp) Toggle regexp searching. C-c (iswitchb-toggle-case) Toggle case-sensitive searching of buffer names.
? (iswitchb-completion-help) Show list of matching buffers in separate window.
C-x C-f (iswitchb-find-file) Exit iswitchb and drop into find-file. C-k (iswitchb-kill-buffer) Kill buffer at head of buffer list.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/iswitchb.el.gz
;;; FUNCTIONS

;;; MAIN FUNCTION
(defun iswitchb ()
  "Switch to buffer matching a substring.
As you type in a string, all of the buffers matching the string are
displayed.  When you have found the buffer you want, it can then be
selected.  As you type, most keys have their normal keybindings,
except for the following:
\\<iswitchb-mode-map>

RET Select the buffer at the front of the list of matches.  If the
list is empty, possibly prompt to create new buffer.

\\[iswitchb-select-buffer-text] Select the current prompt as the buffer.
If no buffer is found, prompt for a new one.

\\[iswitchb-next-match] Put the first element at the end of the list.
\\[iswitchb-prev-match] Put the last element at the start of the list.
\\[iswitchb-complete] Complete a common suffix to the current string that
matches all buffers.  If there is only one match, select that buffer.
If there is no common suffix, show a list of all matching buffers
in a separate window.
\\[iswitchb-toggle-regexp] Toggle regexp searching.
\\[iswitchb-toggle-case] Toggle case-sensitive searching of buffer names.
\\[iswitchb-completion-help] Show list of matching buffers in separate window.
\\[iswitchb-find-file] Exit iswitchb and drop into `find-file'.
\\[iswitchb-kill-buffer] Kill buffer at head of buffer list."
  ;;\\[iswitchb-toggle-ignore] Toggle ignoring certain buffers (see \
  ;;`iswitchb-buffer-ignore')

  (let* ((prompt "iswitch ")
         iswitchb-invalid-regexp
	 (buf (iswitchb-read-buffer prompt)))

    ;;(message "chosen text %s" iswitchb-final-text)
    ;; Choose the buffer name: either the text typed in, or the head
    ;; of the list of matches

    (cond ( (eq iswitchb-exit 'findfile)
	    (call-interactively 'find-file))
          (iswitchb-invalid-regexp
           (message "Won't make invalid regexp named buffer"))
	  (t
	   ;; View the buffer
	   ;;(message "go to buf %s" buf)
	   ;; Check buf is non-nil.
	   (if buf
	       (if (get-buffer buf)
		   ;; buffer exists, so view it and then exit
		   (iswitchb-visit-buffer buf)
		 ;; else buffer doesn't exist
		 (iswitchb-possible-new-buffer buf)))
	   ))))