emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: iswitchb and regexps.]


From: Daniel Brockman
Subject: Re: address@hidden: iswitchb and regexps.]
Date: Tue, 14 Jun 2005 04:30:51 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

I believe the following patch fixes the problem.

I haven't signed copyright papers yet, but I have sent a request
for them.  So I guess you can't install this just yet.

*** iswitchb.el 22 Aug 2004 12:58:16 +0200      1.55
--- iswitchb.el 14 Jun 2005 04:24:33 +0200      
***************
*** 889,910 ****
           (do-string         (stringp (car list)))
           name
           ret)
!     (mapcar
!      (lambda (x)
! 
!        (if do-string
!          (setq name x)               ;We already have the name
!        (setq name (buffer-name x)))
! 
!        (cond
!       ((and (or (and string-format (string-match regexp name))
!                 (and (null string-format)
!                      (string-match (regexp-quote regexp) name)))
! 
!             (not (iswitchb-ignore-buffername-p name)))
!        (setq ret (cons name ret))
!           )))
!      list)
      ret))
  
  (defun iswitchb-ignore-buffername-p (bufname)
--- 889,908 ----
           (do-string         (stringp (car list)))
           name
           ret)
!     (condition-case nil
!         (mapcar
!          (lambda (x)
!            (if do-string
!                (setq name x)               ; We already have the name
!              (setq name (buffer-name x)))
!            (cond
!             ((and (or (and string-format (string-match regexp name))
!                       (and (null string-format)
!                            (string-match (regexp-quote regexp) name)))
!                   (not (iswitchb-ignore-buffername-p name)))
!              (setq ret (cons name ret)))))
!          list)
!         (invalid-regexp nil))
      ret))
  
  (defun iswitchb-ignore-buffername-p (bufname)
***************
*** 1243,1248 ****
--- 1241,1259 ----
         (setq most-is-exact t))
      (substring com most-len)))
  
+ (defun iswitchb-regexp-valid-p (regexp)
+   "Non-nil if REGEXP is syntactically valid."
+   (condition-case nil
+       (progn (string-match regexp "") t)
+     (invalid-regexp nil)))
+ 
+ (defun iswitchb-text-valid-p ()
+   "Non-nil if `iswitchb-text' is syntactically valid.
+ This fails only when `iswitchb-regexp' is non-nil and `iswitchb-text'
+ is an invalid regexp."
+   (or (not iswitchb-regexp)
+       (iswitchb-regexp-valid-p iswitchb-text)))
+ 
  (defun iswitchb-completions (name require-match)
    "Return the string that is displayed after the user's text.
  Modified from `icomplete-completions'."
***************
*** 1296,1304 ****
                               (car comp))
            (setq comp (cdr comp))))))
  
!     (cond ((null comps) (format " %sNo match%s"
!                               open-bracket-determined
!                               close-bracket-determined))
  
          ((null (cdr comps))           ;one match
           (concat (if (and (> (length (car comps))
--- 1307,1317 ----
                               (car comp))
            (setq comp (cdr comp))))))
  
!     (cond ((null comps)
!            (format (if (iswitchb-text-valid-p)
!                        " %sNo match%s" " %sInvalid regexp%s")
!                    open-bracket-determined
!                    close-bracket-determined))
  
          ((null (cdr comps))           ;one match
           (concat (if (and (> (length (car comps))
-- 
Daniel Brockman <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]