aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Kangas2022-11-01 10:30:09 +0100
committerStefan Kangas2022-11-01 10:30:09 +0100
commit123baf3772e71a33eabc1b1169a9b778e2fe3877 (patch)
tree816a3397bbf33328c31d14c20ec599b2e686d421 /src
parente7c105fd73dbede4d00c1f26ad2273d49fabd0da (diff)
parent1862df834c29197cdd339ee369c0ef21694db851 (diff)
downloademacs-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.c35
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
2826DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 3, 0, 2826DEFUN ("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.
2828Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'. 2828Element 2N of the returned list is the position of the beginning of the
2829All the elements are markers or nil (nil if the Nth pair didn't match) 2829match of the Nth subexpression; it corresponds to `(match-beginning N)';
2830if the last match was on a buffer; integers or nil if a string was matched. 2830element 2N + 1 is the position of the end of the match of the Nth
2831Use `set-match-data' to reinstate the data in this list. 2831subexpression; it corresponds to `(match-end N)'. See `match-beginning'
2832and `match-end'.
2833If the last search was on a buffer, all the elements are by default
2834markers or nil (nil when the Nth pair didn't match); they are integers
2835or nil if the search was on a string. But if the optional argument
2836INTEGERS is non-nil, the elements that represent buffer positions are
2837always integers, not markers, and (if the search was on a buffer) the
2838buffer itself is appended to the list as one additional element.
2839
2840Use `set-match-data' to reinstate the match data from the elements of
2841this list.
2832 2842
2833Note that non-matching optional groups at the end of the regexp are 2843Note that non-matching optional groups at the end of the regexp are
2834elided instead of being represented with two `nil's each. For instance: 2844elided 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
2841If INTEGERS (the optional first argument) is non-nil, always use 2851If REUSE is a list, store the value in REUSE by destructively modifying it.
2842integers (rather than markers) to represent buffer positions. In 2852If REUSE is long enough to hold all the values, its length remains the
2843this case, and if the last match was in a buffer, the buffer will get 2853same, and any unused elements are set to nil. If REUSE is not long
2844stored as one additional element at the end of the list. 2854enough, it is extended. Note that if REUSE is long enough and INTEGERS
2855is non-nil, no consing is done to make the return value; this minimizes GC.
2845 2856
2846If REUSE is a list, reuse it as part of the value. If REUSE is long 2857If optional third argument RESEAT is non-nil, any previous markers on the
2847enough to hold all the values, and if INTEGERS is non-nil, no consing
2848is done.
2849
2850If optional third arg RESEAT is non-nil, any previous markers on the
2851REUSE list will be modified to point to nowhere. 2858REUSE list will be modified to point to nowhere.
2852 2859
2853Return value is undefined if the last search failed. */) 2860Return value is undefined if the last search failed. */)