summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2012-08-10 17:03:10 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2012-08-10 17:03:10 -0400
commitdaa9f1a6076ee5e54c8b56b321bc1d2d991a15c6 (patch)
treedc8d57ac20b4135b872e62e068840298c76a6b3d /lisp/emacs-lisp
parent9d2ed8a27e459dd09cf3f770bae5127f21debc34 (diff)
downloademacs-daa9f1a6076ee5e54c8b56b321bc1d2d991a15c6.tar.gz
emacs-daa9f1a6076ee5e54c8b56b321bc1d2d991a15c6.tar.bz2
emacs-daa9f1a6076ee5e54c8b56b321bc1d2d991a15c6.zip
* lisp/emacs-lisp/rx.el (rx-constituents): Don't define as constant.
(rx-form): Simplify.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/rx.el47
1 files changed, 25 insertions, 22 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index a0fb15ae39f..774c6cd2c38 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -107,7 +107,9 @@
;;; Code:
-(defconst rx-constituents
+;; FIXME: support macros.
+
+(defvar rx-constituents ;Not `const' because some modes extend it.
'((and . (rx-and 1 nil))
(seq . and) ; SRE
(: . and) ; SRE
@@ -831,27 +833,28 @@ If FORM is '(minimal-match FORM1)', non-greedy versions of `*',
FORM is a regular expression in sexp form.
RX-PARENT shows which type of expression calls and controls putting of
shy groups around the result and some more in other functions."
- (if (stringp form)
- (rx-group-if (regexp-quote form)
- (if (and (eq rx-parent '*) (< 1 (length form)))
- rx-parent))
- (cond ((integerp form)
- (regexp-quote (char-to-string form)))
- ((symbolp form)
- (let ((info (rx-info form nil)))
- (cond ((stringp info)
- info)
- ((null info)
- (error "Unknown rx form `%s'" form))
- (t
- (funcall (nth 0 info) form)))))
- ((consp form)
- (let ((info (rx-info (car form) 'head)))
- (unless (consp info)
- (error "Unknown rx form `%s'" (car form)))
- (funcall (nth 0 info) form)))
- (t
- (error "rx syntax error at `%s'" form)))))
+ (cond
+ ((stringp form)
+ (rx-group-if (regexp-quote form)
+ (if (and (eq rx-parent '*) (< 1 (length form)))
+ rx-parent)))
+ ((integerp form)
+ (regexp-quote (char-to-string form)))
+ ((symbolp form)
+ (let ((info (rx-info form nil)))
+ (cond ((stringp info)
+ info)
+ ((null info)
+ (error "Unknown rx form `%s'" form))
+ (t
+ (funcall (nth 0 info) form)))))
+ ((consp form)
+ (let ((info (rx-info (car form) 'head)))
+ (unless (consp info)
+ (error "Unknown rx form `%s'" (car form)))
+ (funcall (nth 0 info) form)))
+ (t
+ (error "rx syntax error at `%s'" form))))
;;;###autoload