changeset 63002:f988a6529f1f

(iswitchb-get-matched-buffers): Handle invalid-regexp errors in post-command-hook.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 04 Jun 2005 18:50:38 +0000
parents 035c9cd93159
children 9920e64ab5fa
files lisp/iswitchb.el
diffstat 1 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/iswitchb.el	Sat Jun 04 18:38:17 2005 +0000
+++ b/lisp/iswitchb.el	Sat Jun 04 18:50:38 2005 +0000
@@ -889,22 +889,27 @@
          (do-string         (stringp (car list)))
          name
          ret)
-    (mapcar
-     (lambda (x)
+    (catch 'invalid-regexp
+      (mapcar
+       (lambda (x)
 
-       (if do-string
-	   (setq name x)               ;We already have the name
-	 (setq name (buffer-name 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)))
+	 (cond
+	  ((and (or (and string-format
+			 (condition-case error
+			     (string-match regexp name)
+			   (invalid-regexp
+                            (throw 'invalid-regexp (setq ret (cdr error))))))
+		    (and (null string-format)
+			 (string-match (regexp-quote regexp) name)))
 
-	      (not (iswitchb-ignore-buffername-p name)))
-	 (setq ret (cons name ret))
-          )))
-     list)
+		(not (iswitchb-ignore-buffername-p name)))
+	   (setq ret (cons name ret))
+	   )))
+       list))
     ret))
 
 (defun iswitchb-ignore-buffername-p (bufname)