]> git.eshelyaron.com Git - emacs.git/commitdiff
(iswitchb-get-matched-buffers): Handle invalid-regexp errors in
authorEli Zaretskii <eliz@gnu.org>
Sat, 4 Jun 2005 18:50:38 +0000 (18:50 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 4 Jun 2005 18:50:38 +0000 (18:50 +0000)
post-command-hook.

lisp/iswitchb.el

index 52915c46950721924cd3990e4199a53cf97431b7..5c01e77aabbbb98f0ce708f77252fa793e6e9c3b 100644 (file)
@@ -889,22 +889,27 @@ BUFFER-LIST can be list of buffers or list of strings."
          (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)
+    (catch 'invalid-regexp
+      (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
+                        (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))
     ret))
 
 (defun iswitchb-ignore-buffername-p (bufname)