]> git.eshelyaron.com Git - emacs.git/commit
rx: Use longest match for all-string 'or' forms (bug#37659)
authorMattias Engdegård <mattiase@acm.org>
Tue, 11 Feb 2020 12:23:10 +0000 (13:23 +0100)
committerMattias Engdegård <mattiase@acm.org>
Wed, 12 Feb 2020 10:20:47 +0000 (11:20 +0100)
commit5a21aaff468ec3f0337117707cda4254cbef8de7
tree0afe3c99c133c701c549ee20cb2073a90aa0dc25
parent2b12c2b6f22187536f54f32b11589bf5f21c1f09
rx: Use longest match for all-string 'or' forms (bug#37659)

Revert to the Emacs 26 semantics that always gave the longest match
for rx 'or' forms with only string arguments.  This guarantee was
never well documented, but it is useful and people likely have come to
rely on it.  For example, prior to this change,

 (rx (or ">" ">="))

matched ">" even if the text contained ">=".

* lisp/emacs-lisp/rx.el (rx--translate-or): Don't tell regexp-opt to
preserve the matching order.
* doc/lispref/searching.texi (Rx Constructs): Document the
longest-match guarantee for all-string 'or' forms.
* test/lisp/emacs-lisp/rx-tests.el (rx-or): Update test.
doc/lispref/searching.texi
lisp/emacs-lisp/rx.el
test/lisp/emacs-lisp/rx-tests.el