From: Eli Zaretskii Date: Sat, 4 Jun 2005 18:50:38 +0000 (+0000) Subject: (iswitchb-get-matched-buffers): Handle invalid-regexp errors in X-Git-Tag: emacs-pretest-22.0.90~9324 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2cf248ab2e66c567e0b4722bfc89bb1d64b0fe3c;p=emacs.git (iswitchb-get-matched-buffers): Handle invalid-regexp errors in post-command-hook. --- diff --git a/lisp/iswitchb.el b/lisp/iswitchb.el index 52915c46950..5c01e77aabb 100644 --- a/lisp/iswitchb.el +++ b/lisp/iswitchb.el @@ -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)