Merge from origin/emacs-25
0ffc9ce
Update admin/authors.el0ad7410
Update Antinews in ELisp manualea0f750
Fix comments on window height macros0bbdeed
Fix 'url-http-create-request' when cookies are used0045998
Fix cross reference in frames.texi1392894
; * etc/DEBUG: Minor copyedits.304a5c8
; * etc/DEBUG: Improve documentation of getting control to GDB.56bf7d7
Fix regexp-opt documentation (bug #17862)803ad6f
; Fix documentation of seq-subseqed4530d
* lisp/emacs-lisp/gv.el (gv-ref): Fix example of PLACE in doc...88ea396
; Spelling fixes17197d0
Fix tags-query-replace docstring80a7f8b
Clarify documentation of precision in format specs88a5052
Improve and clarify documentation of subprocesses89eb09f
* etc/PROBLEMS: Mention gnutls-cli 3.5.3 (Bug#24247). # Conflicts: # etc/PROBLEMS # src/process.c
This commit is contained in:
commit
dcd90f60eb
17 changed files with 619 additions and 445 deletions
|
@ -86,18 +86,44 @@
|
|||
;;;###autoload
|
||||
(defun regexp-opt (strings &optional paren)
|
||||
"Return a regexp to match a string in the list STRINGS.
|
||||
Each string should be unique in STRINGS and should not contain any regexps,
|
||||
quoted or not. If optional PAREN is non-nil, ensure that the returned regexp
|
||||
is enclosed by at least one regexp grouping construct.
|
||||
The returned regexp is typically more efficient than the equivalent regexp:
|
||||
Each string should be unique in STRINGS and should not contain
|
||||
any regexps, quoted or not. Optional PAREN specifies how the
|
||||
returned regexp is surrounded by grouping constructs.
|
||||
|
||||
(let ((open (if PAREN \"\\\\(\" \"\")) (close (if PAREN \"\\\\)\" \"\")))
|
||||
(concat open (mapconcat \\='regexp-quote STRINGS \"\\\\|\") close))
|
||||
The optional argument PAREN can be any of the following:
|
||||
|
||||
If PAREN is `words', then the resulting regexp is additionally surrounded
|
||||
by \\=\\< and \\>.
|
||||
If PAREN is `symbols', then the resulting regexp is additionally surrounded
|
||||
by \\=\\_< and \\_>."
|
||||
a string
|
||||
the resulting regexp is preceded by PAREN and followed by
|
||||
\\), e.g. use \"\\\\(?1:\" to produce an explicitly numbered
|
||||
group.
|
||||
|
||||
`words'
|
||||
the resulting regexp is surrounded by \\=\\<\\( and \\)\\>.
|
||||
|
||||
`symbols'
|
||||
the resulting regexp is surrounded by \\_<\\( and \\)\\_>.
|
||||
|
||||
non-nil
|
||||
the resulting regexp is surrounded by \\( and \\).
|
||||
|
||||
nil
|
||||
the resulting regexp is surrounded by \\(?: and \\), if it is
|
||||
necessary to ensure that a postfix operator appended to it will
|
||||
apply to the whole expression.
|
||||
|
||||
The resulting regexp is equivalent to but usually more efficient
|
||||
than that of a simplified version:
|
||||
|
||||
(defun simplified-regexp-opt (strings &optional paren)
|
||||
(let ((parens
|
||||
(cond ((stringp paren) (cons paren \"\\\\)\"))
|
||||
((eq paren 'words) '(\"\\\\\\=<\\\\(\" . \"\\\\)\\\\>\"))
|
||||
((eq paren 'symbols) '(\"\\\\_<\\\\(\" . \"\\\\)\\\\_>\"))
|
||||
((null paren) '(\"\\\\(?:\" . \"\\\\)\"))
|
||||
(t '(\"\\\\(\" . \"\\\\)\")))))
|
||||
(concat (car paren)
|
||||
(mapconcat 'regexp-quote strings \"\\\\|\")
|
||||
(cdr paren))))"
|
||||
(save-match-data
|
||||
;; Recurse on the sorted list.
|
||||
(let* ((max-lisp-eval-depth 10000)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue