• Mattias Engdegård's avatar
    rx: fix `or' ordering by adding argument to regexp-opt · da758046
    Mattias Engdegård authored
    The rx `or' form may reorder its arguments in an unpredictable way,
    contrary to user expectation, since it sometimes uses `regexp-opt'.
    Add a NOREORDER option to `regexp-opt' for preventing it from
    producing a reordered regexp (Bug#34641).
    
    * doc/lispref/searching.texi (Regular Expression Functions):
    * etc/NEWS (Lisp Changes in Emacs 27.1):
    Describe the new regexp-opt NOREORDER argument.
    * lisp/emacs-lisp/regexp-opt.el (regexp-opt): Add NOREORDER.
    Make no attempt at regexp improvement if the set of strings contains
    a prefix of another string.
    (regexp-opt--contains-prefix): New.
    * lisp/emacs-lisp/rx.el (rx-or): Call regexp-opt with NOREORDER.
    * test/lisp/emacs-lisp/rx-tests.el: Test rx `or' form match order.
    da758046
NEWS 64.7 KB