comparison src/search.c @ 40123:e528f2adeed4

Change doc-string comments to `new style' [w/`doc:' keyword].
author Pavel Janík <Pavel@Janik.cz>
date Sun, 21 Oct 2001 12:13:46 +0000
parents 579177964efa
children 613a0932bd77
comparison
equal deleted inserted replaced
40122:4a487543a226 40123:e528f2adeed4
328 XSETBUFFER (last_thing_searched, current_buffer); 328 XSETBUFFER (last_thing_searched, current_buffer);
329 return val; 329 return val;
330 } 330 }
331 331
332 DEFUN ("looking-at", Flooking_at, Slooking_at, 1, 1, 0, 332 DEFUN ("looking-at", Flooking_at, Slooking_at, 1, 1, 0,
333 "Return t if text after point matches regular expression REGEXP.\n\ 333 doc: /* Return t if text after point matches regular expression REGEXP.
334 This function modifies the match data that `match-beginning',\n\ 334 This function modifies the match data that `match-beginning',
335 `match-end' and `match-data' access; save and restore the match\n\ 335 `match-end' and `match-data' access; save and restore the match
336 data if you want to preserve them.") 336 data if you want to preserve them. */)
337 (regexp) 337 (regexp)
338 Lisp_Object regexp; 338 Lisp_Object regexp;
339 { 339 {
340 return looking_at_1 (regexp, 0); 340 return looking_at_1 (regexp, 0);
341 } 341 }
342 342
343 DEFUN ("posix-looking-at", Fposix_looking_at, Sposix_looking_at, 1, 1, 0, 343 DEFUN ("posix-looking-at", Fposix_looking_at, Sposix_looking_at, 1, 1, 0,
344 "Return t if text after point matches regular expression REGEXP.\n\ 344 doc: /* Return t if text after point matches regular expression REGEXP.
345 Find the longest match, in accord with Posix regular expression rules.\n\ 345 Find the longest match, in accord with Posix regular expression rules.
346 This function modifies the match data that `match-beginning',\n\ 346 This function modifies the match data that `match-beginning',
347 `match-end' and `match-data' access; save and restore the match\n\ 347 `match-end' and `match-data' access; save and restore the match
348 data if you want to preserve them.") 348 data if you want to preserve them. */)
349 (regexp) 349 (regexp)
350 Lisp_Object regexp; 350 Lisp_Object regexp;
351 { 351 {
352 return looking_at_1 (regexp, 1); 352 return looking_at_1 (regexp, 1);
353 } 353 }
354 354
412 412
413 return make_number (string_byte_to_char (string, val)); 413 return make_number (string_byte_to_char (string, val));
414 } 414 }
415 415
416 DEFUN ("string-match", Fstring_match, Sstring_match, 2, 3, 0, 416 DEFUN ("string-match", Fstring_match, Sstring_match, 2, 3, 0,
417 "Return index of start of first match for REGEXP in STRING, or nil.\n\ 417 doc: /* Return index of start of first match for REGEXP in STRING, or nil.
418 Case is ignored if `case-fold-search' is non-nil in the current buffer.\n\ 418 Case is ignored if `case-fold-search' is non-nil in the current buffer.
419 If third arg START is non-nil, start search at that index in STRING.\n\ 419 If third arg START is non-nil, start search at that index in STRING.
420 For index of first char beyond the match, do (match-end 0).\n\ 420 For index of first char beyond the match, do (match-end 0).
421 `match-end' and `match-beginning' also give indices of substrings\n\ 421 `match-end' and `match-beginning' also give indices of substrings
422 matched by parenthesis constructs in the pattern.") 422 matched by parenthesis constructs in the pattern. */)
423 (regexp, string, start) 423 (regexp, string, start)
424 Lisp_Object regexp, string, start; 424 Lisp_Object regexp, string, start;
425 { 425 {
426 return string_match_1 (regexp, string, start, 0); 426 return string_match_1 (regexp, string, start, 0);
427 } 427 }
428 428
429 DEFUN ("posix-string-match", Fposix_string_match, Sposix_string_match, 2, 3, 0, 429 DEFUN ("posix-string-match", Fposix_string_match, Sposix_string_match, 2, 3, 0,
430 "Return index of start of first match for REGEXP in STRING, or nil.\n\ 430 doc: /* Return index of start of first match for REGEXP in STRING, or nil.
431 Find the longest match, in accord with Posix regular expression rules.\n\ 431 Find the longest match, in accord with Posix regular expression rules.
432 Case is ignored if `case-fold-search' is non-nil in the current buffer.\n\ 432 Case is ignored if `case-fold-search' is non-nil in the current buffer.
433 If third arg START is non-nil, start search at that index in STRING.\n\ 433 If third arg START is non-nil, start search at that index in STRING.
434 For index of first char beyond the match, do (match-end 0).\n\ 434 For index of first char beyond the match, do (match-end 0).
435 `match-end' and `match-beginning' also give indices of substrings\n\ 435 `match-end' and `match-beginning' also give indices of substrings
436 matched by parenthesis constructs in the pattern.") 436 matched by parenthesis constructs in the pattern. */)
437 (regexp, string, start) 437 (regexp, string, start)
438 Lisp_Object regexp, string, start; 438 Lisp_Object regexp, string, start;
439 { 439 {
440 return string_match_1 (regexp, string, start, 1); 440 return string_match_1 (regexp, string, start, 1);
441 } 441 }
442 442
2016 2016
2017 return val; 2017 return val;
2018 } 2018 }
2019 2019
2020 DEFUN ("search-backward", Fsearch_backward, Ssearch_backward, 1, 4, 2020 DEFUN ("search-backward", Fsearch_backward, Ssearch_backward, 1, 4,
2021 "MSearch backward: ", 2021 "MSearch backward: ",
2022 "Search backward from point for STRING.\n\ 2022 doc: /* Search backward from point for STRING.
2023 Set point to the beginning of the occurrence found, and return point.\n\ 2023 Set point to the beginning of the occurrence found, and return point.
2024 An optional second argument bounds the search; it is a buffer position.\n\ 2024 An optional second argument bounds the search; it is a buffer position.
2025 The match found must not extend before that position.\n\ 2025 The match found must not extend before that position.
2026 Optional third argument, if t, means if fail just return nil (no error).\n\ 2026 Optional third argument, if t, means if fail just return nil (no error).
2027 If not nil and not t, position at limit of search and return nil.\n\ 2027 If not nil and not t, position at limit of search and return nil.
2028 Optional fourth argument is repeat count--search for successive occurrences.\n\ 2028 Optional fourth argument is repeat count--search for successive occurrences.
2029 \n\ 2029
2030 Search case-sensitivity is determined by the value of the variable\n\ 2030 Search case-sensitivity is determined by the value of the variable
2031 `case-fold-search', which see.\n\ 2031 `case-fold-search', which see.
2032 \n\ 2032
2033 See also the functions `match-beginning', `match-end' and `replace-match'.") 2033 See also the functions `match-beginning', `match-end' and `replace-match'. */)
2034 (string, bound, noerror, count) 2034 (string, bound, noerror, count)
2035 Lisp_Object string, bound, noerror, count; 2035 Lisp_Object string, bound, noerror, count;
2036 { 2036 {
2037 return search_command (string, bound, noerror, count, -1, 0, 0); 2037 return search_command (string, bound, noerror, count, -1, 0, 0);
2038 } 2038 }
2039 2039
2040 DEFUN ("search-forward", Fsearch_forward, Ssearch_forward, 1, 4, "MSearch: ", 2040 DEFUN ("search-forward", Fsearch_forward, Ssearch_forward, 1, 4, "MSearch: ",
2041 "Search forward from point for STRING.\n\ 2041 doc: /* Search forward from point for STRING.
2042 Set point to the end of the occurrence found, and return point.\n\ 2042 Set point to the end of the occurrence found, and return point.
2043 An optional second argument bounds the search; it is a buffer position.\n\ 2043 An optional second argument bounds the search; it is a buffer position.
2044 The match found must not extend after that position. nil is equivalent\n\ 2044 The match found must not extend after that position. nil is equivalent
2045 to (point-max).\n\ 2045 to (point-max).
2046 Optional third argument, if t, means if fail just return nil (no error).\n\ 2046 Optional third argument, if t, means if fail just return nil (no error).
2047 If not nil and not t, move to limit of search and return nil.\n\ 2047 If not nil and not t, move to limit of search and return nil.
2048 Optional fourth argument is repeat count--search for successive occurrences.\n\ 2048 Optional fourth argument is repeat count--search for successive occurrences.
2049 \n\ 2049
2050 Search case-sensitivity is determined by the value of the variable\n\ 2050 Search case-sensitivity is determined by the value of the variable
2051 `case-fold-search', which see.\n\ 2051 `case-fold-search', which see.
2052 \n\ 2052
2053 See also the functions `match-beginning', `match-end' and `replace-match'.") 2053 See also the functions `match-beginning', `match-end' and `replace-match'. */)
2054 (string, bound, noerror, count) 2054 (string, bound, noerror, count)
2055 Lisp_Object string, bound, noerror, count; 2055 Lisp_Object string, bound, noerror, count;
2056 { 2056 {
2057 return search_command (string, bound, noerror, count, 1, 0, 0); 2057 return search_command (string, bound, noerror, count, 1, 0, 0);
2058 } 2058 }
2059 2059
2060 DEFUN ("word-search-backward", Fword_search_backward, Sword_search_backward, 1, 4, 2060 DEFUN ("word-search-backward", Fword_search_backward, Sword_search_backward, 1, 4,
2061 "sWord search backward: ", 2061 "sWord search backward: ",
2062 "Search backward from point for STRING, ignoring differences in punctuation.\n\ 2062 doc: /* Search backward from point for STRING, ignoring differences in punctuation.
2063 Set point to the beginning of the occurrence found, and return point.\n\ 2063 Set point to the beginning of the occurrence found, and return point.
2064 An optional second argument bounds the search; it is a buffer position.\n\ 2064 An optional second argument bounds the search; it is a buffer position.
2065 The match found must not extend before that position.\n\ 2065 The match found must not extend before that position.
2066 Optional third argument, if t, means if fail just return nil (no error).\n\ 2066 Optional third argument, if t, means if fail just return nil (no error).
2067 If not nil and not t, move to limit of search and return nil.\n\ 2067 If not nil and not t, move to limit of search and return nil.
2068 Optional fourth argument is repeat count--search for successive occurrences.") 2068 Optional fourth argument is repeat count--search for successive occurrences. */)
2069 (string, bound, noerror, count) 2069 (string, bound, noerror, count)
2070 Lisp_Object string, bound, noerror, count; 2070 Lisp_Object string, bound, noerror, count;
2071 { 2071 {
2072 return search_command (wordify (string), bound, noerror, count, -1, 1, 0); 2072 return search_command (wordify (string), bound, noerror, count, -1, 1, 0);
2073 } 2073 }
2074 2074
2075 DEFUN ("word-search-forward", Fword_search_forward, Sword_search_forward, 1, 4, 2075 DEFUN ("word-search-forward", Fword_search_forward, Sword_search_forward, 1, 4,
2076 "sWord search: ", 2076 "sWord search: ",
2077 "Search forward from point for STRING, ignoring differences in punctuation.\n\ 2077 doc: /* Search forward from point for STRING, ignoring differences in punctuation.
2078 Set point to the end of the occurrence found, and return point.\n\ 2078 Set point to the end of the occurrence found, and return point.
2079 An optional second argument bounds the search; it is a buffer position.\n\ 2079 An optional second argument bounds the search; it is a buffer position.
2080 The match found must not extend after that position.\n\ 2080 The match found must not extend after that position.
2081 Optional third argument, if t, means if fail just return nil (no error).\n\ 2081 Optional third argument, if t, means if fail just return nil (no error).
2082 If not nil and not t, move to limit of search and return nil.\n\ 2082 If not nil and not t, move to limit of search and return nil.
2083 Optional fourth argument is repeat count--search for successive occurrences.") 2083 Optional fourth argument is repeat count--search for successive occurrences. */)
2084 (string, bound, noerror, count) 2084 (string, bound, noerror, count)
2085 Lisp_Object string, bound, noerror, count; 2085 Lisp_Object string, bound, noerror, count;
2086 { 2086 {
2087 return search_command (wordify (string), bound, noerror, count, 1, 1, 0); 2087 return search_command (wordify (string), bound, noerror, count, 1, 1, 0);
2088 } 2088 }
2089 2089
2090 DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4, 2090 DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4,
2091 "sRE search backward: ", 2091 "sRE search backward: ",
2092 "Search backward from point for match for regular expression REGEXP.\n\ 2092 doc: /* Search backward from point for match for regular expression REGEXP.
2093 Set point to the beginning of the match, and return point.\n\ 2093 Set point to the beginning of the match, and return point.
2094 The match found is the one starting last in the buffer\n\ 2094 The match found is the one starting last in the buffer
2095 and yet ending before the origin of the search.\n\ 2095 and yet ending before the origin of the search.
2096 An optional second argument bounds the search; it is a buffer position.\n\ 2096 An optional second argument bounds the search; it is a buffer position.
2097 The match found must start at or after that position.\n\ 2097 The match found must start at or after that position.
2098 Optional third argument, if t, means if fail just return nil (no error).\n\ 2098 Optional third argument, if t, means if fail just return nil (no error).
2099 If not nil and not t, move to limit of search and return nil.\n\ 2099 If not nil and not t, move to limit of search and return nil.
2100 Optional fourth argument is repeat count--search for successive occurrences.\n\ 2100 Optional fourth argument is repeat count--search for successive occurrences.
2101 See also the functions `match-beginning', `match-end', `match-string',\n\ 2101 See also the functions `match-beginning', `match-end', `match-string',
2102 and `replace-match'.") 2102 and `replace-match'. */)
2103 (regexp, bound, noerror, count) 2103 (regexp, bound, noerror, count)
2104 Lisp_Object regexp, bound, noerror, count; 2104 Lisp_Object regexp, bound, noerror, count;
2105 { 2105 {
2106 return search_command (regexp, bound, noerror, count, -1, 1, 0); 2106 return search_command (regexp, bound, noerror, count, -1, 1, 0);
2107 } 2107 }
2108 2108
2109 DEFUN ("re-search-forward", Fre_search_forward, Sre_search_forward, 1, 4, 2109 DEFUN ("re-search-forward", Fre_search_forward, Sre_search_forward, 1, 4,
2110 "sRE search: ", 2110 "sRE search: ",
2111 "Search forward from point for regular expression REGEXP.\n\ 2111 doc: /* Search forward from point for regular expression REGEXP.
2112 Set point to the end of the occurrence found, and return point.\n\ 2112 Set point to the end of the occurrence found, and return point.
2113 An optional second argument bounds the search; it is a buffer position.\n\ 2113 An optional second argument bounds the search; it is a buffer position.
2114 The match found must not extend after that position.\n\ 2114 The match found must not extend after that position.
2115 Optional third argument, if t, means if fail just return nil (no error).\n\ 2115 Optional third argument, if t, means if fail just return nil (no error).
2116 If not nil and not t, move to limit of search and return nil.\n\ 2116 If not nil and not t, move to limit of search and return nil.
2117 Optional fourth argument is repeat count--search for successive occurrences.\n\ 2117 Optional fourth argument is repeat count--search for successive occurrences.
2118 See also the functions `match-beginning', `match-end', `match-string',\n\ 2118 See also the functions `match-beginning', `match-end', `match-string',
2119 and `replace-match'.") 2119 and `replace-match'. */)
2120 (regexp, bound, noerror, count) 2120 (regexp, bound, noerror, count)
2121 Lisp_Object regexp, bound, noerror, count; 2121 Lisp_Object regexp, bound, noerror, count;
2122 { 2122 {
2123 return search_command (regexp, bound, noerror, count, 1, 1, 0); 2123 return search_command (regexp, bound, noerror, count, 1, 1, 0);
2124 } 2124 }
2125 2125
2126 DEFUN ("posix-search-backward", Fposix_search_backward, Sposix_search_backward, 1, 4, 2126 DEFUN ("posix-search-backward", Fposix_search_backward, Sposix_search_backward, 1, 4,
2127 "sPosix search backward: ", 2127 "sPosix search backward: ",
2128 "Search backward from point for match for regular expression REGEXP.\n\ 2128 doc: /* Search backward from point for match for regular expression REGEXP.
2129 Find the longest match in accord with Posix regular expression rules.\n\ 2129 Find the longest match in accord with Posix regular expression rules.
2130 Set point to the beginning of the match, and return point.\n\ 2130 Set point to the beginning of the match, and return point.
2131 The match found is the one starting last in the buffer\n\ 2131 The match found is the one starting last in the buffer
2132 and yet ending before the origin of the search.\n\ 2132 and yet ending before the origin of the search.
2133 An optional second argument bounds the search; it is a buffer position.\n\ 2133 An optional second argument bounds the search; it is a buffer position.
2134 The match found must start at or after that position.\n\ 2134 The match found must start at or after that position.
2135 Optional third argument, if t, means if fail just return nil (no error).\n\ 2135 Optional third argument, if t, means if fail just return nil (no error).
2136 If not nil and not t, move to limit of search and return nil.\n\ 2136 If not nil and not t, move to limit of search and return nil.
2137 Optional fourth argument is repeat count--search for successive occurrences.\n\ 2137 Optional fourth argument is repeat count--search for successive occurrences.
2138 See also the functions `match-beginning', `match-end', `match-string',\n\ 2138 See also the functions `match-beginning', `match-end', `match-string',
2139 and `replace-match'.") 2139 and `replace-match'. */)
2140 (regexp, bound, noerror, count) 2140 (regexp, bound, noerror, count)
2141 Lisp_Object regexp, bound, noerror, count; 2141 Lisp_Object regexp, bound, noerror, count;
2142 { 2142 {
2143 return search_command (regexp, bound, noerror, count, -1, 1, 1); 2143 return search_command (regexp, bound, noerror, count, -1, 1, 1);
2144 } 2144 }
2145 2145
2146 DEFUN ("posix-search-forward", Fposix_search_forward, Sposix_search_forward, 1, 4, 2146 DEFUN ("posix-search-forward", Fposix_search_forward, Sposix_search_forward, 1, 4,
2147 "sPosix search: ", 2147 "sPosix search: ",
2148 "Search forward from point for regular expression REGEXP.\n\ 2148 doc: /* Search forward from point for regular expression REGEXP.
2149 Find the longest match in accord with Posix regular expression rules.\n\ 2149 Find the longest match in accord with Posix regular expression rules.
2150 Set point to the end of the occurrence found, and return point.\n\ 2150 Set point to the end of the occurrence found, and return point.
2151 An optional second argument bounds the search; it is a buffer position.\n\ 2151 An optional second argument bounds the search; it is a buffer position.
2152 The match found must not extend after that position.\n\ 2152 The match found must not extend after that position.
2153 Optional third argument, if t, means if fail just return nil (no error).\n\ 2153 Optional third argument, if t, means if fail just return nil (no error).
2154 If not nil and not t, move to limit of search and return nil.\n\ 2154 If not nil and not t, move to limit of search and return nil.
2155 Optional fourth argument is repeat count--search for successive occurrences.\n\ 2155 Optional fourth argument is repeat count--search for successive occurrences.
2156 See also the functions `match-beginning', `match-end', `match-string',\n\ 2156 See also the functions `match-beginning', `match-end', `match-string',
2157 and `replace-match'.") 2157 and `replace-match'. */)
2158 (regexp, bound, noerror, count) 2158 (regexp, bound, noerror, count)
2159 Lisp_Object regexp, bound, noerror, count; 2159 Lisp_Object regexp, bound, noerror, count;
2160 { 2160 {
2161 return search_command (regexp, bound, noerror, count, 1, 1, 1); 2161 return search_command (regexp, bound, noerror, count, 1, 1, 1);
2162 } 2162 }
2163 2163
2164 DEFUN ("replace-match", Freplace_match, Sreplace_match, 1, 5, 0, 2164 DEFUN ("replace-match", Freplace_match, Sreplace_match, 1, 5, 0,
2165 "Replace text matched by last search with NEWTEXT.\n\ 2165 doc: /* Replace text matched by last search with NEWTEXT.
2166 If second arg FIXEDCASE is non-nil, do not alter case of replacement text.\n\ 2166 If second arg FIXEDCASE is non-nil, do not alter case of replacement text.
2167 Otherwise maybe capitalize the whole text, or maybe just word initials,\n\ 2167 Otherwise maybe capitalize the whole text, or maybe just word initials,
2168 based on the replaced text.\n\ 2168 based on the replaced text.
2169 If the replaced text has only capital letters\n\ 2169 If the replaced text has only capital letters
2170 and has at least one multiletter word, convert NEWTEXT to all caps.\n\ 2170 and has at least one multiletter word, convert NEWTEXT to all caps.
2171 If the replaced text has at least one word starting with a capital letter,\n\ 2171 If the replaced text has at least one word starting with a capital letter,
2172 then capitalize each word in NEWTEXT.\n\n\ 2172 then capitalize each word in NEWTEXT.
2173 If third arg LITERAL is non-nil, insert NEWTEXT literally.\n\ 2173
2174 Otherwise treat `\\' as special:\n\ 2174 If third arg LITERAL is non-nil, insert NEWTEXT literally.
2175 `\\&' in NEWTEXT means substitute original matched text.\n\ 2175 Otherwise treat `\\' as special:
2176 `\\N' means substitute what matched the Nth `\\(...\\)'.\n\ 2176 `\\&' in NEWTEXT means substitute original matched text.
2177 If Nth parens didn't match, substitute nothing.\n\ 2177 `\\N' means substitute what matched the Nth `\\(...\\)'.
2178 `\\\\' means insert one `\\'.\n\ 2178 If Nth parens didn't match, substitute nothing.
2179 FIXEDCASE and LITERAL are optional arguments.\n\ 2179 `\\\\' means insert one `\\'.
2180 Leaves point at end of replacement text.\n\ 2180 FIXEDCASE and LITERAL are optional arguments.
2181 \n\ 2181 Leaves point at end of replacement text.
2182 The optional fourth argument STRING can be a string to modify.\n\ 2182
2183 This is meaningful when the previous match was done against STRING,\n\ 2183 The optional fourth argument STRING can be a string to modify.
2184 using `string-match'. When used this way, `replace-match'\n\ 2184 This is meaningful when the previous match was done against STRING,
2185 creates and returns a new string made by copying STRING and replacing\n\ 2185 using `string-match'. When used this way, `replace-match'
2186 the part of STRING that was matched.\n\ 2186 creates and returns a new string made by copying STRING and replacing
2187 \n\ 2187 the part of STRING that was matched.
2188 The optional fifth argument SUBEXP specifies a subexpression;\n\ 2188
2189 it says to replace just that subexpression with NEWTEXT,\n\ 2189 The optional fifth argument SUBEXP specifies a subexpression;
2190 rather than replacing the entire matched text.\n\ 2190 it says to replace just that subexpression with NEWTEXT,
2191 This is, in a vague sense, the inverse of using `\\N' in NEWTEXT;\n\ 2191 rather than replacing the entire matched text.
2192 `\\N' copies subexp N into NEWTEXT, but using N as SUBEXP puts\n\ 2192 This is, in a vague sense, the inverse of using `\\N' in NEWTEXT;
2193 NEWTEXT in place of subexp N.\n\ 2193 `\\N' copies subexp N into NEWTEXT, but using N as SUBEXP puts
2194 This is useful only after a regular expression search or match,\n\ 2194 NEWTEXT in place of subexp N.
2195 since only regular expressions have distinguished subexpressions.") 2195 This is useful only after a regular expression search or match,
2196 (newtext, fixedcase, literal, string, subexp) 2196 since only regular expressions have distinguished subexpressions. */)
2197 (newtext, fixedcase, literal, string, subexp)
2197 Lisp_Object newtext, fixedcase, literal, string, subexp; 2198 Lisp_Object newtext, fixedcase, literal, string, subexp;
2198 { 2199 {
2199 enum { nochange, all_caps, cap_initial } case_action; 2200 enum { nochange, all_caps, cap_initial } case_action;
2200 register int pos, pos_byte; 2201 register int pos, pos_byte;
2201 int some_multiletter_word; 2202 int some_multiletter_word;
2595 return (make_number ((beginningp) ? search_regs.start[n] 2596 return (make_number ((beginningp) ? search_regs.start[n]
2596 : search_regs.end[n])); 2597 : search_regs.end[n]));
2597 } 2598 }
2598 2599
2599 DEFUN ("match-beginning", Fmatch_beginning, Smatch_beginning, 1, 1, 0, 2600 DEFUN ("match-beginning", Fmatch_beginning, Smatch_beginning, 1, 1, 0,
2600 "Return position of start of text matched by last search.\n\ 2601 doc: /* Return position of start of text matched by last search.
2601 SUBEXP, a number, specifies which parenthesized expression in the last\n\ 2602 SUBEXP, a number, specifies which parenthesized expression in the last
2602 regexp.\n\ 2603 regexp.
2603 Value is nil if SUBEXPth pair didn't match, or there were less than\n\ 2604 Value is nil if SUBEXPth pair didn't match, or there were less than
2604 SUBEXP pairs.\n\ 2605 SUBEXP pairs.
2605 Zero means the entire text matched by the whole regexp or whole string.") 2606 Zero means the entire text matched by the whole regexp or whole string. */)
2606 (subexp) 2607 (subexp)
2607 Lisp_Object subexp; 2608 Lisp_Object subexp;
2608 { 2609 {
2609 return match_limit (subexp, 1); 2610 return match_limit (subexp, 1);
2610 } 2611 }
2611 2612
2612 DEFUN ("match-end", Fmatch_end, Smatch_end, 1, 1, 0, 2613 DEFUN ("match-end", Fmatch_end, Smatch_end, 1, 1, 0,
2613 "Return position of end of text matched by last search.\n\ 2614 doc: /* Return position of end of text matched by last search.
2614 SUBEXP, a number, specifies which parenthesized expression in the last\n\ 2615 SUBEXP, a number, specifies which parenthesized expression in the last
2615 regexp.\n\ 2616 regexp.
2616 Value is nil if SUBEXPth pair didn't match, or there were less than\n\ 2617 Value is nil if SUBEXPth pair didn't match, or there were less than
2617 SUBEXP pairs.\n\ 2618 SUBEXP pairs.
2618 Zero means the entire text matched by the whole regexp or whole string.") 2619 Zero means the entire text matched by the whole regexp or whole string. */)
2619 (subexp) 2620 (subexp)
2620 Lisp_Object subexp; 2621 Lisp_Object subexp;
2621 { 2622 {
2622 return match_limit (subexp, 0); 2623 return match_limit (subexp, 0);
2623 } 2624 }
2624 2625
2625 DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 2, 0, 2626 DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 2, 0,
2626 "Return a list containing all info on what the last search matched.\n\ 2627 doc: /* Return a list containing all info on what the last search matched.
2627 Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'.\n\ 2628 Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'.
2628 All the elements are markers or nil (nil if the Nth pair didn't match)\n\ 2629 All the elements are markers or nil (nil if the Nth pair didn't match)
2629 if the last match was on a buffer; integers or nil if a string was matched.\n\ 2630 if the last match was on a buffer; integers or nil if a string was matched.
2630 Use `store-match-data' to reinstate the data in this list.\n\ 2631 Use `store-match-data' to reinstate the data in this list.
2631 \n\ 2632
2632 If INTEGERS (the optional first argument) is non-nil, always use integers\n\ 2633 If INTEGERS (the optional first argument) is non-nil, always use integers
2633 \(rather than markers) to represent buffer positions.\n\ 2634 \(rather than markers) to represent buffer positions.
2634 If REUSE is a list, reuse it as part of the value. If REUSE is long enough\n\ 2635 If REUSE is a list, reuse it as part of the value. If REUSE is long enough
2635 to hold all the values, and if INTEGERS is non-nil, no consing is done.") 2636 to hold all the values, and if INTEGERS is non-nil, no consing is done. */)
2636 (integers, reuse) 2637 (integers, reuse)
2637 Lisp_Object integers, reuse; 2638 Lisp_Object integers, reuse;
2638 { 2639 {
2639 Lisp_Object tail, prev; 2640 Lisp_Object tail, prev;
2640 Lisp_Object *data; 2641 Lisp_Object *data;
2641 int i, len; 2642 int i, len;
2705 return reuse; 2706 return reuse;
2706 } 2707 }
2707 2708
2708 2709
2709 DEFUN ("set-match-data", Fset_match_data, Sset_match_data, 1, 1, 0, 2710 DEFUN ("set-match-data", Fset_match_data, Sset_match_data, 1, 1, 0,
2710 "Set internal data on last search match from elements of LIST.\n\ 2711 doc: /* Set internal data on last search match from elements of LIST.
2711 LIST should have been created by calling `match-data' previously.") 2712 LIST should have been created by calling `match-data' previously. */)
2712 (list) 2713 (list)
2713 register Lisp_Object list; 2714 register Lisp_Object list;
2714 { 2715 {
2715 register int i; 2716 register int i;
2716 register Lisp_Object marker; 2717 register Lisp_Object marker;
2717 2718
2836 } 2837 }
2837 2838
2838 /* Quote a string to inactivate reg-expr chars */ 2839 /* Quote a string to inactivate reg-expr chars */
2839 2840
2840 DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0, 2841 DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
2841 "Return a regexp string which matches exactly STRING and nothing else.") 2842 doc: /* Return a regexp string which matches exactly STRING and nothing else. */)
2842 (string) 2843 (string)
2843 Lisp_Object string; 2844 Lisp_Object string;
2844 { 2845 {
2845 register unsigned char *in, *out, *end; 2846 register unsigned char *in, *out, *end;
2846 register unsigned char *temp; 2847 register unsigned char *temp;
2847 int backslashes_added = 0; 2848 int backslashes_added = 0;