]> git.eshelyaron.com Git - emacs.git/commit
rx: Improve 'or' compositionality (bug#37659)
authorMattias Engdegård <mattiase@acm.org>
Tue, 11 Feb 2020 19:04:42 +0000 (20:04 +0100)
committerMattias Engdegård <mattiase@acm.org>
Sun, 1 Mar 2020 09:47:14 +0000 (10:47 +0100)
commit49d3cd90bd80a225d5ec26027318ffb4606ff513
tree13ba7b7faec7014b626d1c4dfdbfec98df44631f
parent6b48aedb6b3b1de0b41b61b727d14ab8277d2f73
rx: Improve 'or' compositionality (bug#37659)

Perform 'regexp-opt' on nested 'or' forms, and after expansion of
user-defined and 'eval' forms.  Characters are now turned into strings
for wider 'regexp-opt' scope.  This preserves the longest-match
semantics for string in 'or' forms over composition.

* doc/lispref/searching.texi (Rx Constructs): Document.
* lisp/emacs-lisp/rx.el (rx--normalise-or-arg)
(rx--all-string-or-args): New.
(rx--translate-or): Normalise arguments first, and check for strings
in subforms.
(rx--expand-eval): Extracted from rx--translate-eval.
(rx--translate-eval): Call rx--expand-eval.
* test/lisp/emacs-lisp/rx-tests.el (rx-or, rx-def-in-or): Add tests.
* etc/NEWS: Announce.
doc/lispref/searching.texi
etc/NEWS
lisp/emacs-lisp/rx.el
test/lisp/emacs-lisp/rx-tests.el