Skip to content

Commit d55f2f7

Browse files
committed
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.
1 parent 0a10795 commit d55f2f7

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

doc/lispref/searching.texi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,11 +1780,11 @@ if it is necessary to ensure that a postfix operator appended to
17801780
it will apply to the whole expression.
17811781
@end table
17821782

1783-
The optional argument @var{keep-order}, if @code{nil} or omitted,
1784-
allows the returned regexp to match the strings in any order. If
1785-
non-@code{nil}, the match is guaranteed to be performed in the order
1786-
given, as if the strings were made into a regexp by joining them with
1787-
the @samp{\|} operator.
1783+
The optional argument @var{keep-order}, if non-@code{nil}, forces the
1784+
match to be performed in the order given, as if the strings were made
1785+
into a regexp by joining them with the @samp{\|} operator. If nil or
1786+
omitted, the returned regexp will always match the longest string
1787+
possible.
17881788

17891789
Up to reordering, the resulting regexp of @code{regexp-opt} is
17901790
equivalent to but usually more efficient than that of a simplified

lisp/emacs-lisp/regexp-opt.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ nil
114114
necessary to ensure that a postfix operator appended to it will
115115
apply to the whole expression.
116116
117-
The optional argument KEEP-ORDER, if nil or omitted, allows the
118-
returned regexp to match the strings in any order. If non-nil,
119-
the match is guaranteed to be performed in the order given, as if
120-
the strings were made into a regexp by joining them with the
121-
`\\|' operator.
117+
The optional argument KEEP-ORDER, if non-nil, forces the match to
118+
be performed in the order given, as if the strings were made into
119+
a regexp by joining them with the `\\|' operator. If nil or
120+
omitted, the returned regexp is will always match the longest
121+
string possible.
122122
123123
Up to reordering, the resulting regexp is equivalent to but
124124
usually more efficient than that of a simplified version:

0 commit comments

Comments
 (0)