diff options
| author | Stefan Kangas | 2022-11-01 10:30:09 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2022-11-01 10:30:09 +0100 |
| commit | 123baf3772e71a33eabc1b1169a9b778e2fe3877 (patch) | |
| tree | 816a3397bbf33328c31d14c20ec599b2e686d421 /src | |
| parent | e7c105fd73dbede4d00c1f26ad2273d49fabd0da (diff) | |
| parent | 1862df834c29197cdd339ee369c0ef21694db851 (diff) | |
| download | emacs-123baf3772e71a33eabc1b1169a9b778e2fe3877.tar.gz emacs-123baf3772e71a33eabc1b1169a9b778e2fe3877.zip | |
Merge from origin/emacs-28
1862df834c ; * src/search.c (Fmatch_data): Doc fix.
15fc5225b1 ; * lisp/whitespace.el (whitespace-trailing): Fix a typo.
9f3c896f7c ; * doc/emacs/text.texi (Quotation Marks): Typo fix. (Bug...
# Conflicts:
# src/search.c
Diffstat (limited to 'src')
| -rw-r--r-- | src/search.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/search.c b/src/search.c index b5d6a442c0f..a7f958c362b 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -2824,11 +2824,21 @@ Return value is undefined if the last search failed. */) | |||
| 2824 | } | 2824 | } |
| 2825 | 2825 | ||
| 2826 | DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 3, 0, | 2826 | DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 3, 0, |
| 2827 | doc: /* Return a list describing what the last search matched. | 2827 | doc: /* Return a list of positions that record text matched by the last search. |
| 2828 | Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'. | 2828 | Element 2N of the returned list is the position of the beginning of the |
| 2829 | All the elements are markers or nil (nil if the Nth pair didn't match) | 2829 | match of the Nth subexpression; it corresponds to `(match-beginning N)'; |
| 2830 | if the last match was on a buffer; integers or nil if a string was matched. | 2830 | element 2N + 1 is the position of the end of the match of the Nth |
| 2831 | Use `set-match-data' to reinstate the data in this list. | 2831 | subexpression; it corresponds to `(match-end N)'. See `match-beginning' |
| 2832 | and `match-end'. | ||
| 2833 | If the last search was on a buffer, all the elements are by default | ||
| 2834 | markers or nil (nil when the Nth pair didn't match); they are integers | ||
| 2835 | or nil if the search was on a string. But if the optional argument | ||
| 2836 | INTEGERS is non-nil, the elements that represent buffer positions are | ||
| 2837 | always integers, not markers, and (if the search was on a buffer) the | ||
| 2838 | buffer itself is appended to the list as one additional element. | ||
| 2839 | |||
| 2840 | Use `set-match-data' to reinstate the match data from the elements of | ||
| 2841 | this list. | ||
| 2832 | 2842 | ||
| 2833 | Note that non-matching optional groups at the end of the regexp are | 2843 | Note that non-matching optional groups at the end of the regexp are |
| 2834 | elided instead of being represented with two `nil's each. For instance: | 2844 | elided instead of being represented with two `nil's each. For instance: |
| @@ -2838,16 +2848,13 @@ elided instead of being represented with two `nil's each. For instance: | |||
| 2838 | (match-data)) | 2848 | (match-data)) |
| 2839 | => (0 1 nil nil 0 1) | 2849 | => (0 1 nil nil 0 1) |
| 2840 | 2850 | ||
| 2841 | If INTEGERS (the optional first argument) is non-nil, always use | 2851 | If REUSE is a list, store the value in REUSE by destructively modifying it. |
| 2842 | integers (rather than markers) to represent buffer positions. In | 2852 | If REUSE is long enough to hold all the values, its length remains the |
| 2843 | this case, and if the last match was in a buffer, the buffer will get | 2853 | same, and any unused elements are set to nil. If REUSE is not long |
| 2844 | stored as one additional element at the end of the list. | 2854 | enough, it is extended. Note that if REUSE is long enough and INTEGERS |
| 2855 | is non-nil, no consing is done to make the return value; this minimizes GC. | ||
| 2845 | 2856 | ||
| 2846 | If REUSE is a list, reuse it as part of the value. If REUSE is long | 2857 | If optional third argument RESEAT is non-nil, any previous markers on the |
| 2847 | enough to hold all the values, and if INTEGERS is non-nil, no consing | ||
| 2848 | is done. | ||
| 2849 | |||
| 2850 | If optional third arg RESEAT is non-nil, any previous markers on the | ||
| 2851 | REUSE list will be modified to point to nowhere. | 2858 | REUSE list will be modified to point to nowhere. |
| 2852 | 2859 | ||
| 2853 | Return value is undefined if the last search failed. */) | 2860 | Return value is undefined if the last search failed. */) |