changeset 21326:8150549598cc

Many doc fixes. (iswitchb-method): No longer a user variable. (iswitchb-minibuffer-setup-hook): Customized. (iswitchb-default): New variable. (iswitchb-complete): Use iswitchb-common-match-string rather than recomputing the value. (iswitchb-toggle-ignore): Recompute list of buffers. (iswitchb-init-XEmacs-trick): Renamed from iswitchb-init-Xemacs-trick.
author Stephen Eglen <stephen@gnu.org>
date Tue, 31 Mar 1998 20:14:55 +0000
parents 8b4db8ce1da3
children 01870b9b4f2a
files lisp/iswitchb.el
diffstat 1 files changed, 53 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/iswitchb.el	Tue Mar 31 18:08:36 1998 +0000
+++ b/lisp/iswitchb.el	Tue Mar 31 20:14:55 1998 +0000
@@ -120,7 +120,7 @@
 ;;  (define-key iswitchb-mode-map " " 'iswitchb-next-match)
 ;;  )
 ;;
-;; Seeing all the matching buffers.
+;; Seeing all the matching buffers
 ;;
 ;; If you have many matching buffers, they may not all fit onto one
 ;; line of the minibuffer.  In this case, you should use rsz-mini
@@ -129,7 +129,7 @@
 ;; `iswitchb-minibuffer-setup-hook'.
 
 
-;; Changing the list of buffers.
+;; Changing the list of buffers
 
 ;; By default, the list of current buffers is most recent first,
 ;; oldest last, with the exception that the buffers visible in the
@@ -154,7 +154,7 @@
 ;; name was suggested by Carsten Dominik (dominik@strw.leidenuniv.nl)
 
 
-;; Replacement for read-buffer.
+;; Replacement for read-buffer
 
 ;; iswitchb-read-buffer has been written to be a drop in replacement
 ;; for the normal buffer selection routine `read-buffer'.  To use
@@ -165,6 +165,19 @@
 ;; (defalias 'read-buffer 'iswitchb-read-buffer) 
 ;; since `read-buffer' is defined in lisp.
 
+;; Regexp matching
+
+;; There is limited provision for regexp matching within iswitchb,
+;; enabled through `iswitchb-regexp'.  This allows you to type `c$'
+;; for example and see all buffer names ending in `c'.  This facility
+;; is quite limited though in two respects.  First, you can't
+;; currently type in expressions like `[0-9]' directly -- you have to
+;; type them in when iswitchb-regexp is nil and then toggle on the
+;; regexp functionality.  Likewise, don't enter an expression
+;; containing `\' in regexp mode.  If you try, iswitchb gets confused,
+;; so just hit C-g and try again.  Secondly, no completion mechanism
+;; is currently offered when regexp searching.
+
 ;;; TODO
 
 ;;; Acknowledgements
@@ -223,13 +236,13 @@
 
 
 ;;; Examples for setting the value of iswitchb-buffer-ignore
-;(defun -c-mode (name)
+;(defun iswitchb-ignore-c-mode (name)
 ;  "Ignore all c mode buffers -- example function for iswitchb."
 ;  (save-excursion
 ;    (set-buffer name)
 ;    (string-match "^C$" mode-name)))
 
-;(setq iswitchb-buffer-ignore '("^ " ignore-c-mode))
+;(setq iswitchb-buffer-ignore '("^ " iswitchb-ignore-c-mode))
 ;(setq iswitchb-buffer-ignore '("^ " "\\.c$" "\\.h$"))
 
 (defcustom iswitchb-default-method  'always-frame
@@ -255,7 +268,7 @@
 
 (defcustom iswitchb-regexp nil
   "*Non-nil means that `iswitchb' will do regexp matching.
-Value can be toggled within `iswitchb'."
+Value can be toggled within `iswitchb' using `iswitchb-toggle-regexp'."
   :type 'boolean
   :group 'iswitchb)
 
@@ -282,7 +295,7 @@
 
 
 (defcustom iswitchb-use-fonts t
-  "*Non-nil means use fonts for showing first match."
+  "*Non-nil means use font-lock fonts for showing first match."
   :type 'boolean
   :group 'iswitchb)
 
@@ -292,26 +305,12 @@
   :type 'hook
   :group 'iswitchb)
 
-
-
-(defvar iswitchb-method nil
-  "*Stores the method for viewing the selected buffer.  
-Its value is one of `samewindow', `otherwindow', `display', `otherframe',
-`maybe-frame' or `always-frame'.  See `iswitchb-default-method' for
-details of values.")
-
 (defvar iswitchb-all-frames 'visible
   "*Argument to pass to `walk-windows' when finding visible buffers.
 See documentation of `walk-windows' for useful values.")
 
-
-
-;; Do we need the variable iswitchb-use-mycompletion?
-
-
-;;; Internal Variables
-(defvar iswitchb-minibuffer-setup-hook nil
-  "Iswitchb-specific customization of minibuffer setup.
+(defcustom iswitchb-minibuffer-setup-hook nil
+  "*Iswitchb-specific customization of minibuffer setup.
 
 This hook is run during minibuffer setup iff `iswitchb' will be active.
 It is intended for use in customizing iswitchb for interoperation
@@ -324,7 +323,20 @@
 	       \(setq resize-minibuffer-window-max-height 3))))
 
 will constrain rsz-mini to a maximum minibuffer height of 3 lines when
-iswitchb is running.  Copied from `icomplete-minibuffer-setup-hook'.")
+iswitchb is running.  Copied from `icomplete-minibuffer-setup-hook'."
+  :type 'hook
+  :group 'iswitchb)
+
+;; Do we need the variable iswitchb-use-mycompletion?
+
+
+;;; Internal Variables
+
+(defvar iswitchb-method nil
+  "Stores the method for viewing the selected buffer.  
+Its value is one of `samewindow', `otherwindow', `display', `otherframe',
+`maybe-frame' or `always-frame'.  See `iswitchb-default-method' for
+details of values.")
 
 (defvar iswitchb-eoinput 1
   "Point where minibuffer input ends and completion info begins.
@@ -348,11 +360,9 @@
 (defvar iswitchb-change-word-sub nil 
   "Private variable used by `iswitchb-word-matching-substring'.")
 
-
 (defvar iswitchb-common-match-string  nil
   "Stores the string that is common to all matching buffers.")
 
-
 (defvar iswitchb-rescan nil
   "Non-nil means we need to regenerate the list of matching buffers.")
 
@@ -379,6 +389,8 @@
 (defvar iswitchb-xemacs  (string-match "XEmacs" (emacs-version))
   "Non-nil if we are running XEmacs.  Otherwise, assume we are running Emacs.")
 
+(defvar iswitchb-default nil
+  "Default buffer for iswitchb.")
 
 ;;; FUNCTIONS
 
@@ -489,10 +501,11 @@
     (setq iswitchb-exit nil)
     (setq iswitchb-rescan t)
     (setq iswitchb-text "")
-    (iswitchb-make-buflist 
-     (if (bufferp default)
-	 (buffer-name default)
-       default))
+    (setq iswitchb-default
+	  (if (bufferp default)
+	      (buffer-name default)
+	    default))
+    (iswitchb-make-buflist iswitchb-default)
     (iswitchb-set-matches)
     (let 
 	((minibuffer-local-completion-map iswitchb-mode-map)
@@ -539,6 +552,7 @@
   (let* (val)
     (setq  iswitchb-common-match-string nil)
     (if (and iswitchb-matches
+	     (not iswitchb-regexp) ;; testing
              (stringp iswitchb-text)
              (> (length iswitchb-text) 0))
         (if (setq val (iswitchb-find-common-substring
@@ -562,9 +576,7 @@
 	  
 	  (t
 	   ;; else there could be some completions
-	   
-	   (setq res (iswitchb-find-common-substring
-		      iswitchb-matches iswitchb-text))
+	   (setq res iswitchb-common-match-string)
 	   (if (and (not (memq res '(t nil)))
 		    (not (equal res iswitchb-text)))
 	       ;; found something to complete, so put it in the minibuffer.
@@ -610,6 +622,7 @@
     ;; else
     (setq iswitchb-buffer-ignore iswitchb-buffer-ignore-orig)
     )
+  (iswitchb-make-buflist iswitchb-default)
   ;; ask for list to be regenerated.
   (setq iswitchb-rescan t)
   )
@@ -752,17 +765,17 @@
 	    (let* ((buflist iswitchb-buflist)
 		   )
 	      (iswitchb-get-matched-buffers iswitchb-text iswitchb-regexp
-						buflist)))))
+					    buflist)))))
 
 (defun iswitchb-get-matched-buffers (regexp
 				     &optional string-format buffer-list)
-  "Return  buffers matching REGEXP.
-If STRING-FORMAT is non-nil, consider REGEXP as string.
+  "Return buffers matching REGEXP.
+If STRING-FORMAT is nil, consider REGEXP as just a string.
 BUFFER-LIST can be list of buffers or list of strings."
   (let* ((case-fold-search  iswitchb-case)
 	 ;; need reverse since we are building up list backwards
 	 (list              (reverse buffer-list))
-         (do-string          (stringp (car list)))
+         (do-string         (stringp (car list)))
          name
          ret
          )
@@ -778,7 +791,7 @@
 		  (and (null string-format)
 		       (string-match (regexp-quote regexp) name)))
 	      
-	      ;; todo (not (iswitchb-ignore-buffername-p name))
+	      (not (iswitchb-ignore-buffername-p name))
 	      )
 	 (setq ret (cons name ret))
           )))
@@ -818,8 +831,6 @@
     ignorep)
   )
 
-
-
 (defun iswitchb-word-matching-substring (word)
   "Return part of WORD before 1st match to `iswitchb-change-word-sub'.
 If `iswitchb-change-word-sub' cannot be found in WORD, return nil."
@@ -830,11 +841,6 @@
         ;; else no match
         nil))))
 
-
-
-
-
-
 (defun iswitchb-find-common-substring (lis subs)
   "Return common string following SUBS in each element of LIS."
   (let (res
@@ -1089,7 +1095,7 @@
 ;; function.  To solve this, we use another entry hook for emacs to
 ;; show the default the first time we enter the minibuffer.
 
-(defun iswitchb-init-Xemacs-trick ()
+(defun iswitchb-init-XEmacs-trick ()
   "Display default buffer when first entering minibuffer.
 This is a hack for XEmacs, and should really be handled by `iswitchb-exhibit'."
   (if (iswitchb-entryfn-p)
@@ -1101,7 +1107,7 @@
 ;; add this hook for XEmacs only.
 (if iswitchb-xemacs
     (add-hook 'iswitchb-minibuffer-setup-hook 
-	      'iswitchb-init-Xemacs-trick))
+	      'iswitchb-init-XEmacs-trick))
 
 
 ;;; XEmacs / backspace key