From b34a46f9fac60caead855c0f98bef2cc78dd033a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 5 Sep 2010 11:44:55 +0200 Subject: [PATCH] * emacs-lisp/rx.el (rx-any): Don't explode ranges that end in - or ]. (rx-any-condense-range): Explode 2-char ranges. --- lisp/ChangeLog | 6 ++++++ lisp/emacs-lisp/rx.el | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4477011f25e..72703689dd1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-09-05 Stefan Monnier + + * emacs-lisp/rx.el (rx-any): Don't explode ranges that end in special + chars like - or ] (bug#6984). + (rx-any-condense-range): Explode 2-char ranges. + 2010-09-02 Stefan Monnier * textmodes/bibtex.el: diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 85fe3514b01..522d452c2dc 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -427,7 +427,7 @@ Only both edges of each range is checked." (mapcar (lambda (e) (cond ((= (car e) (cdr e)) (list (car e))) - ;; ((= (1+ (car e)) (cdr e)) (list (car e) (cdr e))) + ((= (1+ (car e)) (cdr e)) (list (car e) (cdr e))) ((list e)))) l)) (delete-dups str)))) @@ -545,7 +545,10 @@ ARG is optional." ((numberp e) (string e)) ((consp e) (if (and (= (1+ (car e)) (cdr e)) - (null (memq (car e) '(?\] ?-)))) + ;; rx-any-condense-range should + ;; prevent this case from happening. + (null (memq (car e) '(?\] ?-))) + (null (memq (cdr e) '(?\] ?-)))) (string (car e) (cdr e)) (string (car e) ?- (cdr e)))) (e))) -- 2.11.4.GIT