diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-09-26 13:32:28 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-09-26 13:32:28 -0700 |
commit | dcd90f60eb8952d119d97efcef9564ec96def054 (patch) | |
tree | 2d3a5bbac64d7fbd94f3af0774218911a522e61f /lisp/emacs-lisp | |
parent | c44ecb77ab33f0a0559c3e5da42fb486d6b014dd (diff) | |
parent | 0ffc9cef49b0fceb3c5e904837ea5675fe4306ac (diff) | |
download | emacs-dcd90f60eb8952d119d97efcef9564ec96def054.tar.gz emacs-dcd90f60eb8952d119d97efcef9564ec96def054.tar.bz2 emacs-dcd90f60eb8952d119d97efcef9564ec96def054.zip |
Merge from origin/emacs-25
0ffc9ce Update admin/authors.el
0ad7410 Update Antinews in ELisp manual
ea0f750 Fix comments on window height macros
0bbdeed Fix 'url-http-create-request' when cookies are used
0045998 Fix cross reference in frames.texi
1392894 ; * 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-subseq
ed4530d * lisp/emacs-lisp/gv.el (gv-ref): Fix example of PLACE in doc...
88ea396 ; Spelling fixes
17197d0 Fix tags-query-replace docstring
80a7f8b Clarify documentation of precision in format specs
88a5052 Improve and clarify documentation of subprocesses
89eb09f * etc/PROBLEMS: Mention gnutls-cli 3.5.3 (Bug#24247).
# Conflicts:
# etc/PROBLEMS
# src/process.c
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/gv.el | 2 | ||||
-rw-r--r-- | lisp/emacs-lisp/regexp-opt.el | 46 | ||||
-rw-r--r-- | lisp/emacs-lisp/seq.el | 2 |
3 files changed, 38 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index 93572e5e658..fa7ac64bf04 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -536,7 +536,7 @@ This macro only makes sense when used in a place." "Return a reference to PLACE. This is like the `&' operator of the C language. Note: this only works reliably with lexical binding mode, except for very -simple PLACEs such as (function-symbol \\='foo) which will also work in dynamic +simple PLACEs such as (symbol-function \\='foo) which will also work in dynamic binding mode." (let ((code (gv-letplace (getter setter) place diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index cf6653046b5..ef752858a4c 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el @@ -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) diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index e5004f8cdab..9859f28f8e8 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -137,7 +137,7 @@ the sequence, and its index within the sequence." (cl-defgeneric seq-subseq (sequence start &optional end) "Return the sequence of elements of SEQUENCE from START to END. -END is inclusive. +END is exclusive. If END is omitted, it defaults to the length of the sequence. If START or END is negative, it counts from the end. Signal an |