>>>>> Michael Cadilhac writes:
> With iswitchb-mode, C-x b, then hit C-t to enable regexp mode, and
> then `['.
> This gives me the following error message: Error in
> post-command-hook: (invalid-regexp Unmatched [ or [^) then makes
> buffer switching completely unusable until C-g.
This is documented in the source:
;; Regexp matching
;; There is limited provision for regexp matching within iswitchb,
;; enabled through `iswitchb-regexp'. This allows you to type `c$'
;; for example and see all buffer names ending in `c'. This facility
;; is quite limited though in two respects. First, you can't
;; currently type in expressions like `[0-9]' directly -- you have to
;; type them in when iswitchb-regexp is nil and then toggle on the
;; regexp functionality. Likewise, don't enter an expression
;; containing `\' in regexp mode. If you try, iswitchb gets confused,
;; so just hit C-g and try again. Secondly, no completion mechanism
;; is currently offered when regexp searching.
However, I think the error in post-command-hook should be handled.
The attached patch shows how this might be done, but isn't a complete
solution.
Index: iswitchb.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/iswitchb.el,v
retrieving revision 1.55
diff -u -r1.55 iswitchb.el
--- iswitchb.el 22 Aug 2004 10:58:16 -0000 1.55
+++ iswitchb.el 22 May 2005 09:26:36 -0000
@@ -889,22 +889,27 @@
(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)
_______________________________________________
Emacs-pretest-bug mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug