diff options
| author | Stephen Berman | 2016-07-12 22:11:22 +0200 |
|---|---|---|
| committer | Stephen Berman | 2016-07-12 22:11:22 +0200 |
| commit | 069fc05bd5fabdd5971e2c5230a8586248fb7f38 (patch) | |
| tree | d5481fa5874fa9c2a789e62cafefb72d4bef253d /src | |
| parent | 0a0144a2e15a00b5c3272ad95e62d1d489b453c4 (diff) | |
| download | emacs-069fc05bd5fabdd5971e2c5230a8586248fb7f38.tar.gz emacs-069fc05bd5fabdd5971e2c5230a8586248fb7f38.zip | |
Improve documentation of search functions
Make the documentation of the search functions more accurate,
complete, and uniform; in particular, extend the description of
the effect when the 'count' parameter is a negative number to all
of these functions.
* src/search.c (Fsearch_backward, Fsearch_forward)
(Fre_search_backward, Fre_search_forward)
(Fposix_search_backward, Fposix_search_forward):
* lisp/isearch.el (word-search-backward, word-search-forward)
(word-search-backward-lax, word-search-forward-lax): Improve doc
strings as described above.
* doc/lispref/searching.texi (String Search, Regexp Search)
(POSIX Regexps): Use 'count' instead of 'repeat' as the name of
the fourth parameter of the *-search-{forward,backward} functions
and improve documentation as described above.
Diffstat (limited to 'src')
| -rw-r--r-- | src/search.c | 85 |
1 files changed, 59 insertions, 26 deletions
diff --git a/src/search.c b/src/search.c index bcdd8f16d0b..5c949ad00a4 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -2164,12 +2164,17 @@ DEFUN ("search-backward", Fsearch_backward, Ssearch_backward, 1, 4, | |||
| 2164 | doc: /* Search backward from point for STRING. | 2164 | doc: /* Search backward from point for STRING. |
| 2165 | Set point to the beginning of the occurrence found, and return point. | 2165 | Set point to the beginning of the occurrence found, and return point. |
| 2166 | An optional second argument bounds the search; it is a buffer position. | 2166 | An optional second argument bounds the search; it is a buffer position. |
| 2167 | The match found must not extend before that position. | 2167 | The match found must not begin before that position. A value of nil |
| 2168 | means search to the beginning of the accessible portion of the buffer. | ||
| 2168 | Optional third argument, if t, means if fail just return nil (no error). | 2169 | Optional third argument, if t, means if fail just return nil (no error). |
| 2169 | If not nil and not t, position at limit of search and return nil. | 2170 | If not nil and not t, position at limit of search and return nil. |
| 2170 | Optional fourth argument COUNT, if non-nil, means to search for COUNT | 2171 | Optional fourth argument COUNT, if a positive number, means to search |
| 2171 | successive occurrences. If COUNT is negative, search forward, | 2172 | for COUNT successive occurrences. If COUNT is negative, search |
| 2172 | instead of backward, for -COUNT occurrences. | 2173 | forward, instead of backward, for -COUNT occurrences. A value of |
| 2174 | nil means the same as 1. | ||
| 2175 | With COUNT positive, the match found is the COUNTth to last one (or | ||
| 2176 | last, if COUNT is 1 or nil) in the buffer located entirely before | ||
| 2177 | the origin of the search; correspondingly with COUNT negative. | ||
| 2173 | 2178 | ||
| 2174 | Search case-sensitivity is determined by the value of the variable | 2179 | Search case-sensitivity is determined by the value of the variable |
| 2175 | `case-fold-search', which see. | 2180 | `case-fold-search', which see. |
| @@ -2184,13 +2189,17 @@ DEFUN ("search-forward", Fsearch_forward, Ssearch_forward, 1, 4, "MSearch: ", | |||
| 2184 | doc: /* Search forward from point for STRING. | 2189 | doc: /* Search forward from point for STRING. |
| 2185 | Set point to the end of the occurrence found, and return point. | 2190 | Set point to the end of the occurrence found, and return point. |
| 2186 | An optional second argument bounds the search; it is a buffer position. | 2191 | An optional second argument bounds the search; it is a buffer position. |
| 2187 | The match found must not extend after that position. A value of nil is | 2192 | The match found must not end after that position. A value of nil |
| 2188 | equivalent to (point-max). | 2193 | means search to the end of the accessible portion of the buffer. |
| 2189 | Optional third argument, if t, means if fail just return nil (no error). | 2194 | Optional third argument, if t, means if fail just return nil (no error). |
| 2190 | If not nil and not t, move to limit of search and return nil. | 2195 | If not nil and not t, move to limit of search and return nil. |
| 2191 | Optional fourth argument COUNT, if non-nil, means to search for COUNT | 2196 | Optional fourth argument COUNT, if a positive number, means to search |
| 2192 | successive occurrences. If COUNT is negative, search backward, | 2197 | for COUNT successive occurrences. If COUNT is negative, search |
| 2193 | instead of forward, for -COUNT occurrences. | 2198 | backward, instead of forward, for -COUNT occurrences. A value of |
| 2199 | nil means the same as 1. | ||
| 2200 | With COUNT positive, the match found is the COUNTth one (or first, | ||
| 2201 | if COUNT is 1 or nil) in the buffer located entirely after the | ||
| 2202 | origin of the search; correspondingly with COUNT negative. | ||
| 2194 | 2203 | ||
| 2195 | Search case-sensitivity is determined by the value of the variable | 2204 | Search case-sensitivity is determined by the value of the variable |
| 2196 | `case-fold-search', which see. | 2205 | `case-fold-search', which see. |
| @@ -2204,14 +2213,19 @@ See also the functions `match-beginning', `match-end' and `replace-match'. */) | |||
| 2204 | DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4, | 2213 | DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4, |
| 2205 | "sRE search backward: ", | 2214 | "sRE search backward: ", |
| 2206 | doc: /* Search backward from point for match for regular expression REGEXP. | 2215 | doc: /* Search backward from point for match for regular expression REGEXP. |
| 2207 | Set point to the beginning of the match, and return point. | 2216 | Set point to the beginning of the occurrence found, and return point. |
| 2208 | The match found is the one starting last in the buffer | ||
| 2209 | and yet ending before the origin of the search. | ||
| 2210 | An optional second argument bounds the search; it is a buffer position. | 2217 | An optional second argument bounds the search; it is a buffer position. |
| 2211 | The match found must start at or after that position. | 2218 | The match found must not begin before that position. A value of nil |
| 2219 | means search to the beginning of the accessible portion of the buffer. | ||
| 2212 | Optional third argument, if t, means if fail just return nil (no error). | 2220 | Optional third argument, if t, means if fail just return nil (no error). |
| 2213 | If not nil and not t, move to limit of search and return nil. | 2221 | If not nil and not t, position at limit of search and return nil. |
| 2214 | Optional fourth argument is repeat count--search for successive occurrences. | 2222 | Optional fourth argument COUNT, if a positive number, means to search |
| 2223 | for COUNT successive occurrences. If COUNT is negative, search | ||
| 2224 | forward, instead of backward, for -COUNT occurrences. A value of | ||
| 2225 | nil means the same as 1. | ||
| 2226 | With COUNT positive, the match found is the COUNTth to last one (or | ||
| 2227 | last, if COUNT is 1 or nil) in the buffer located entirely before | ||
| 2228 | the origin of the search; correspondingly with COUNT negative. | ||
| 2215 | 2229 | ||
| 2216 | Search case-sensitivity is determined by the value of the variable | 2230 | Search case-sensitivity is determined by the value of the variable |
| 2217 | `case-fold-search', which see. | 2231 | `case-fold-search', which see. |
| @@ -2228,10 +2242,17 @@ DEFUN ("re-search-forward", Fre_search_forward, Sre_search_forward, 1, 4, | |||
| 2228 | doc: /* Search forward from point for regular expression REGEXP. | 2242 | doc: /* Search forward from point for regular expression REGEXP. |
| 2229 | Set point to the end of the occurrence found, and return point. | 2243 | Set point to the end of the occurrence found, and return point. |
| 2230 | An optional second argument bounds the search; it is a buffer position. | 2244 | An optional second argument bounds the search; it is a buffer position. |
| 2231 | The match found must not extend after that position. | 2245 | The match found must not end after that position. A value of nil |
| 2246 | means search to the end of the accessible portion of the buffer. | ||
| 2232 | Optional third argument, if t, means if fail just return nil (no error). | 2247 | Optional third argument, if t, means if fail just return nil (no error). |
| 2233 | If not nil and not t, move to limit of search and return nil. | 2248 | If not nil and not t, move to limit of search and return nil. |
| 2234 | Optional fourth argument is repeat count--search for successive occurrences. | 2249 | Optional fourth argument COUNT, if a positive number, means to search |
| 2250 | for COUNT successive occurrences. If COUNT is negative, search | ||
| 2251 | backward, instead of forward, for -COUNT occurrences. A value of | ||
| 2252 | nil means the same as 1. | ||
| 2253 | With COUNT positive, the match found is the COUNTth one (or first, | ||
| 2254 | if COUNT is 1 or nil) in the buffer located entirely after the | ||
| 2255 | origin of the search; correspondingly with COUNT negative. | ||
| 2235 | 2256 | ||
| 2236 | Search case-sensitivity is determined by the value of the variable | 2257 | Search case-sensitivity is determined by the value of the variable |
| 2237 | `case-fold-search', which see. | 2258 | `case-fold-search', which see. |
| @@ -2247,14 +2268,19 @@ DEFUN ("posix-search-backward", Fposix_search_backward, Sposix_search_backward, | |||
| 2247 | "sPosix search backward: ", | 2268 | "sPosix search backward: ", |
| 2248 | doc: /* Search backward from point for match for regular expression REGEXP. | 2269 | doc: /* Search backward from point for match for regular expression REGEXP. |
| 2249 | Find the longest match in accord with Posix regular expression rules. | 2270 | Find the longest match in accord with Posix regular expression rules. |
| 2250 | Set point to the beginning of the match, and return point. | 2271 | Set point to the beginning of the occurrence found, and return point. |
| 2251 | The match found is the one starting last in the buffer | ||
| 2252 | and yet ending before the origin of the search. | ||
| 2253 | An optional second argument bounds the search; it is a buffer position. | 2272 | An optional second argument bounds the search; it is a buffer position. |
| 2254 | The match found must start at or after that position. | 2273 | The match found must not begin before that position. A value of nil |
| 2274 | means search to the beginning of the accessible portion of the buffer. | ||
| 2255 | Optional third argument, if t, means if fail just return nil (no error). | 2275 | Optional third argument, if t, means if fail just return nil (no error). |
| 2256 | If not nil and not t, move to limit of search and return nil. | 2276 | If not nil and not t, position at limit of search and return nil. |
| 2257 | Optional fourth argument is repeat count--search for successive occurrences. | 2277 | Optional fourth argument COUNT, if a positive number, means to search |
| 2278 | for COUNT successive occurrences. If COUNT is negative, search | ||
| 2279 | forward, instead of backward, for -COUNT occurrences. A value of | ||
| 2280 | nil means the same as 1. | ||
| 2281 | With COUNT positive, the match found is the COUNTth to last one (or | ||
| 2282 | last, if COUNT is 1 or nil) in the buffer located entirely before | ||
| 2283 | the origin of the search; correspondingly with COUNT negative. | ||
| 2258 | 2284 | ||
| 2259 | Search case-sensitivity is determined by the value of the variable | 2285 | Search case-sensitivity is determined by the value of the variable |
| 2260 | `case-fold-search', which see. | 2286 | `case-fold-search', which see. |
| @@ -2272,10 +2298,17 @@ DEFUN ("posix-search-forward", Fposix_search_forward, Sposix_search_forward, 1, | |||
| 2272 | Find the longest match in accord with Posix regular expression rules. | 2298 | Find the longest match in accord with Posix regular expression rules. |
| 2273 | Set point to the end of the occurrence found, and return point. | 2299 | Set point to the end of the occurrence found, and return point. |
| 2274 | An optional second argument bounds the search; it is a buffer position. | 2300 | An optional second argument bounds the search; it is a buffer position. |
| 2275 | The match found must not extend after that position. | 2301 | The match found must not end after that position. A value of nil |
| 2302 | means search to the end of the accessible portion of the buffer. | ||
| 2276 | Optional third argument, if t, means if fail just return nil (no error). | 2303 | Optional third argument, if t, means if fail just return nil (no error). |
| 2277 | If not nil and not t, move to limit of search and return nil. | 2304 | If not nil and not t, move to limit of search and return nil. |
| 2278 | Optional fourth argument is repeat count--search for successive occurrences. | 2305 | Optional fourth argument COUNT, if a positive number, means to search |
| 2306 | for COUNT successive occurrences. If COUNT is negative, search | ||
| 2307 | backward, instead of forward, for -COUNT occurrences. A value of | ||
| 2308 | nil means the same as 1. | ||
| 2309 | With COUNT positive, the match found is the COUNTth one (or first, | ||
| 2310 | if COUNT is 1 or nil) in the buffer located entirely after the | ||
| 2311 | origin of the search; correspondingly with COUNT negative. | ||
| 2279 | 2312 | ||
| 2280 | Search case-sensitivity is determined by the value of the variable | 2313 | Search case-sensitivity is determined by the value of the variable |
| 2281 | `case-fold-search', which see. | 2314 | `case-fold-search', which see. |