/[emacs]/emacs/lisp/iswitchb.el
ViewVC logotype

Diff of /emacs/lisp/iswitchb.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.58 by kfstorm, Mon Jun 6 14:21:14 2005 UTC revision 1.59 by monnier, Tue Jun 14 15:51:11 2005 UTC
# Line 1  Line 1 
1  ;;; iswitchb.el --- switch between buffers using substrings  ;;; iswitchb.el --- switch between buffers using substrings
2    
3  ;; Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005  Free Software Foundation, Inc.  ;; Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
4    ;;           Free Software Foundation, Inc.
5    
6  ;; Author: Stephen Eglen <stephen@gnu.org>  ;; Author: Stephen Eglen <stephen@gnu.org>
7  ;; Maintainer: Stephen Eglen <stephen@gnu.org>  ;; Maintainer: Stephen Eglen <stephen@gnu.org>
# Line 871  it is put to the start of the list." Line 872  it is put to the start of the list."
872    
873  (defun iswitchb-to-end (lst)  (defun iswitchb-to-end (lst)
874    "Move the elements from LST to the end of `iswitchb-temp-buflist'."    "Move the elements from LST to the end of `iswitchb-temp-buflist'."
875    (mapcar    (dolist (elem lst)
876     (lambda (elem)      (setq iswitchb-temp-buflist (delq elem iswitchb-temp-buflist)))
      (setq iswitchb-temp-buflist (delq elem iswitchb-temp-buflist)))  
    lst)  
877    (setq iswitchb-temp-buflist (nconc iswitchb-temp-buflist lst)))    (setq iswitchb-temp-buflist (nconc iswitchb-temp-buflist lst)))
878    
879  (defun iswitchb-get-buffers-in-frames (&optional current)  (defun iswitchb-get-buffers-in-frames (&optional current)
# Line 915  current frame, rather than all frames, r Line 914  current frame, rather than all frames, r
914    "Return buffers matching REGEXP.    "Return buffers matching REGEXP.
915  If STRING-FORMAT is nil, consider REGEXP as just a string.  If STRING-FORMAT is nil, consider REGEXP as just a string.
916  BUFFER-LIST can be list of buffers or list of strings."  BUFFER-LIST can be list of buffers or list of strings."
917    (let* ((case-fold-search  (iswitchb-case))    (let* ((case-fold-search (iswitchb-case))
918           ;; need reverse since we are building up list backwards           name ret)
919           (list              (reverse buffer-list))      (if (null string-format) (setq regexp (regexp-quote regexp)))
          (do-string         (stringp (car list)))  
          name  
          ret)  
920      (setq iswitchb-invalid-regexp nil)      (setq iswitchb-invalid-regexp nil)
921      (catch 'invalid-regexp      (condition-case error
922        (mapcar          (dolist (x buffer-list (nreverse ret))
923         (lambda (x)            (setq name (if (stringp x) x (buffer-name x)))
924              (when (and (string-match regexp name)
925           (if do-string                       (not (iswitchb-ignore-buffername-p name)))
926               (setq name x)              ;We already have the name              (push name ret)))
927             (setq name (buffer-name x)))        (invalid-regexp
928           (setq iswitchb-invalid-regexp t)
929           (cond         (cdr error)))))
           ((and (if (not string-format)  
                     (string-match (regexp-quote regexp) name)  
                   (condition-case error  
                       (string-match regexp name)  
                     (invalid-regexp  
                      (setq iswitchb-invalid-regexp t)  
                      (throw 'invalid-regexp (setq ret (cdr error))))))  
                 (not (iswitchb-ignore-buffername-p name)))  
            (setq ret (cons name ret)))))  
        list))  
     ret))  
930    
931  (defun iswitchb-ignore-buffername-p (bufname)  (defun iswitchb-ignore-buffername-p (bufname)
932    "Return t if the buffer BUFNAME should be ignored."    "Return t if the buffer BUFNAME should be ignored."
# Line 1476  This mode enables switching between buff Line 1461  This mode enables switching between buff
1461    
1462  (provide 'iswitchb)  (provide 'iswitchb)
1463    
1464  ;;; arch-tag: d74198ae-753f-44f2-b34f-0c515398d90a  ;; arch-tag: d74198ae-753f-44f2-b34f-0c515398d90a
1465  ;;; iswitchb.el ends here  ;;; iswitchb.el ends here

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.59

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26