diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2020-02-11 13:23:10 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2020-02-12 11:20:47 +0100 |
commit | 5a21aaff468ec3f0337117707cda4254cbef8de7 (patch) | |
tree | 0afe3c99c133c701c549ee20cb2073a90aa0dc25 /lisp/emacs-lisp/rx.el | |
parent | 2b12c2b6f22187536f54f32b11589bf5f21c1f09 (diff) | |
download | emacs-5a21aaff468ec3f0337117707cda4254cbef8de7.tar.gz |
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.
Diffstat (limited to 'lisp/emacs-lisp/rx.el')
-rw-r--r-- | lisp/emacs-lisp/rx.el | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 03af053c91e..b4cab5715da 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -290,7 +290,7 @@ Return (REGEXP . PRECEDENCE)." ((null (cdr body)) ; Single item. (rx--translate (car body))) ((rx--every #'stringp body) ; All strings. - (cons (list (regexp-opt body nil t)) + (cons (list (regexp-opt body nil)) t)) ((rx--every #'rx--charset-p body) ; All charsets. (rx--translate-union nil body)) |