1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

More precise 'regexp-opt' documentation

* lisp/emacs-lisp/regexp-opt.el (regexp-opt):
* doc/lispref/searching.texi (Regexp Functions):
Be more specific about how the KEEP-ORDER argument actually works.
If nil, the regexp guarantees a longest match; this is the behaviour
that many callers implicitly rely on.
This commit is contained in:
Mattias Engdegård 2019-12-15 22:17:11 +01:00
parent 0a10795d0b
commit d55f2f74f5
2 changed files with 10 additions and 10 deletions

View file

@ -1780,11 +1780,11 @@ if it is necessary to ensure that a postfix operator appended to
it will apply to the whole expression. it will apply to the whole expression.
@end table @end table
The optional argument @var{keep-order}, if @code{nil} or omitted, The optional argument @var{keep-order}, if non-@code{nil}, forces the
allows the returned regexp to match the strings in any order. If match to be performed in the order given, as if the strings were made
non-@code{nil}, the match is guaranteed to be performed in the order into a regexp by joining them with the @samp{\|} operator. If nil or
given, as if the strings were made into a regexp by joining them with omitted, the returned regexp will always match the longest string
the @samp{\|} operator. possible.
Up to reordering, the resulting regexp of @code{regexp-opt} is Up to reordering, the resulting regexp of @code{regexp-opt} is
equivalent to but usually more efficient than that of a simplified equivalent to but usually more efficient than that of a simplified

View file

@ -114,11 +114,11 @@ nil
necessary to ensure that a postfix operator appended to it will necessary to ensure that a postfix operator appended to it will
apply to the whole expression. apply to the whole expression.
The optional argument KEEP-ORDER, if nil or omitted, allows the The optional argument KEEP-ORDER, if non-nil, forces the match to
returned regexp to match the strings in any order. If non-nil, be performed in the order given, as if the strings were made into
the match is guaranteed to be performed in the order given, as if a regexp by joining them with the `\\|' operator. If nil or
the strings were made into a regexp by joining them with the omitted, the returned regexp is will always match the longest
`\\|' operator. string possible.
Up to reordering, the resulting regexp is equivalent to but Up to reordering, the resulting regexp is equivalent to but
usually more efficient than that of a simplified version: usually more efficient than that of a simplified version: