emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rx: no shy group around `or' expression


From: Oliver Scholz
Subject: rx: no shy group around `or' expression
Date: Fri, 24 Oct 2003 18:01:41 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux)

Currently

(rx (and ?a (or ?b ?c) ?d))

compiles to "\\(?:ab\\|cd\\)". It should be:
"\\(?:a\\(?:b\\|c\\)d\\)".

This patch fixes this:

--- rx.el       2003/10/24 15:03:10     1.1
+++ rx.el       2003/10/24 15:59:54
@@ -286,9 +286,11 @@
     (dolist (arg (cdr form))
       (unless (stringp arg)
        (setq all-args-strings nil)))
-    (if all-args-strings
-       (regexp-opt (cdr form))
-      (mapconcat #'rx-to-string (cdr form) "\\|"))))
+    (concat "\\(?:"
+           (if all-args-strings
+               (regexp-opt (cdr form))
+             (mapconcat #'rx-to-string (cdr form) "\\|"))
+           "\\)")))
 
 
 (defun rx-quote-for-set (string)
    Oliver
-- 
Oliver Scholz               3 Brumaire an 212 de la Révolution
Taunusstr. 25               Liberté, Egalité, Fraternité!
60329 Frankfurt a. M.       http://www.jungdemokratenhessen.de
Tel. (069) 97 40 99 42      http://www.jdjl.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]