diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2019-02-24 22:12:52 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2019-03-02 15:35:28 +0100 |
commit | da758046da74e33273265cd2e72a8aa1a0c9c7e3 (patch) | |
tree | 4337523f0b56c12d69f27a91ee0a1b61376c0e7e /etc/NEWS | |
parent | dbffbe08815644fd30404891ef81496277ed27da (diff) | |
download | emacs-da758046da74e33273265cd2e72a8aa1a0c9c7e3.tar.gz |
rx: fix `or' ordering by adding argument to regexp-opt
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.
Diffstat (limited to 'etc/NEWS')
-rw-r--r-- | etc/NEWS | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1642,6 +1642,13 @@ MS-Windows. ** New module environment function 'process_input' to process user input while module code is running. ++++ +** The function 'regexp-opt' accepts an additional optional argument. +By default, the regexp returned by 'regexp-opt' may match the strings +in any order. If the new third argument is non-nil, the match is +guaranteed to be performed in the order given, as if the strings were +made into a regexp by joining them with '\|'. + * Changes in Emacs 27.1 on Non-Free Operating Systems |