diff options
| author | Chong Yidong | 2012-01-26 23:48:27 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-01-26 23:48:27 +0800 |
| commit | acc28cb93b4b332053381e2cdcdab3ab8c5b73f9 (patch) | |
| tree | 7bea0b3a648d03e14223fdc91b4f7b7a22db5bad | |
| parent | 8681f11d3b4c9e9d9b85cc997db7e091c19e6c13 (diff) | |
| download | emacs-acc28cb93b4b332053381e2cdcdab3ab8c5b73f9.tar.gz emacs-acc28cb93b4b332053381e2cdcdab3ab8c5b73f9.zip | |
Document negative repeat counts for search-forward and search-backward.
* doc/lispref/searching.texi (String Search): Document negative repeat count.
* src/search.c (Fsearch_forward, Fsearch_backward): Document negative
repeat counts (Bug#10507).
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/searching.texi | 20 | ||||
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/search.c | 8 |
4 files changed, 27 insertions, 11 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 145d2dbc4f5..89174f3ca0e 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-01-26 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * searching.texi (String Search): Document negative repeat count | ||
| 4 | (Bug#10507). | ||
| 5 | |||
| 1 | 2012-01-26 Glenn Morris <rgm@gnu.org> | 6 | 2012-01-26 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * variables.texi (Using Lexical Binding): | 8 | * variables.texi (Using Lexical Binding): |
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 21481568276..3dc777897c1 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -49,7 +49,6 @@ This function searches forward from point for an exact match for | |||
| 49 | @var{string}. If successful, it sets point to the end of the occurrence | 49 | @var{string}. If successful, it sets point to the end of the occurrence |
| 50 | found, and returns the new value of point. If no match is found, the | 50 | found, and returns the new value of point. If no match is found, the |
| 51 | value and side effects depend on @var{noerror} (see below). | 51 | value and side effects depend on @var{noerror} (see below). |
| 52 | @c Emacs 19 feature | ||
| 53 | 52 | ||
| 54 | In the following example, point is initially at the beginning of the | 53 | In the following example, point is initially at the beginning of the |
| 55 | line. Then @code{(search-forward "fox")} moves point after the last | 54 | line. Then @code{(search-forward "fox")} moves point after the last |
| @@ -91,18 +90,21 @@ The argument @var{noerror} only affects valid searches which fail to | |||
| 91 | find a match. Invalid arguments cause errors regardless of | 90 | find a match. Invalid arguments cause errors regardless of |
| 92 | @var{noerror}. | 91 | @var{noerror}. |
| 93 | 92 | ||
| 94 | If @var{repeat} is supplied (it must be a positive number), then the | 93 | If @var{repeat} is a positive number @var{n}, it serves as a repeat |
| 95 | search is repeated that many times (each time starting at the end of the | 94 | count: the search is repeated @var{n} times, each time starting at the |
| 96 | previous time's match). If these successive searches succeed, the | 95 | end of the previous time's match. If these successive searches |
| 97 | function succeeds, moving point and returning its new value. Otherwise | 96 | succeed, the function succeeds, moving point and returning its new |
| 98 | the search fails, with results depending on the value of | 97 | value. Otherwise the search fails, with results depending on the |
| 99 | @var{noerror}, as described above. | 98 | value of @var{noerror}, as described above. If @var{repeat} is a |
| 99 | negative number -@var{n}, it serves as a repeat count of @var{n} for a | ||
| 100 | search in the opposite (backward) direction. | ||
| 100 | @end deffn | 101 | @end deffn |
| 101 | 102 | ||
| 102 | @deffn Command search-backward string &optional limit noerror repeat | 103 | @deffn Command search-backward string &optional limit noerror repeat |
| 103 | This function searches backward from point for @var{string}. It is | 104 | This function searches backward from point for @var{string}. It is |
| 104 | just like @code{search-forward} except that it searches backwards and | 105 | like @code{search-forward}, except that it searches backwards rather |
| 105 | leaves point at the beginning of the match. | 106 | than forwards. Backward searches leave point at the beginning of the |
| 107 | match. | ||
| 106 | @end deffn | 108 | @end deffn |
| 107 | 109 | ||
| 108 | @deffn Command word-search-forward string &optional limit noerror repeat | 110 | @deffn Command word-search-forward string &optional limit noerror repeat |
diff --git a/src/ChangeLog b/src/ChangeLog index 9d37a04da2c..7222cfb9dd4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-01-26 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * search.c (Fsearch_forward, Fsearch_backward): Document negative | ||
| 4 | repeat counts (Bug#10507). | ||
| 5 | |||
| 1 | 2012-01-26 Glenn Morris <rgm@gnu.org> | 6 | 2012-01-26 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * lread.c (syms_of_lread): Doc fix. | 8 | * lread.c (syms_of_lread): Doc fix. |
diff --git a/src/search.c b/src/search.c index 67323b3c6e7..55a6d893479 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -2181,7 +2181,9 @@ An optional second argument bounds the search; it is a buffer position. | |||
| 2181 | The match found must not extend before that position. | 2181 | The match found must not extend before that position. |
| 2182 | Optional third argument, if t, means if fail just return nil (no error). | 2182 | Optional third argument, if t, means if fail just return nil (no error). |
| 2183 | If not nil and not t, position at limit of search and return nil. | 2183 | If not nil and not t, position at limit of search and return nil. |
| 2184 | Optional fourth argument is repeat count--search for successive occurrences. | 2184 | Optional fourth argument COUNT, if non-nil, means to search for COUNT |
| 2185 | successive occurrences. If COUNT is negative, search forward, | ||
| 2186 | instead of backward, for -COUNT occurrences. | ||
| 2185 | 2187 | ||
| 2186 | Search case-sensitivity is determined by the value of the variable | 2188 | Search case-sensitivity is determined by the value of the variable |
| 2187 | `case-fold-search', which see. | 2189 | `case-fold-search', which see. |
| @@ -2200,7 +2202,9 @@ The match found must not extend after that position. A value of nil is | |||
| 2200 | equivalent to (point-max). | 2202 | equivalent to (point-max). |
| 2201 | Optional third argument, if t, means if fail just return nil (no error). | 2203 | Optional third argument, if t, means if fail just return nil (no error). |
| 2202 | If not nil and not t, move to limit of search and return nil. | 2204 | If not nil and not t, move to limit of search and return nil. |
| 2203 | Optional fourth argument is repeat count--search for successive occurrences. | 2205 | Optional fourth argument COUNT, if non-nil, means to search for COUNT |
| 2206 | successive occurrences. If COUNT is negative, search backward, | ||
| 2207 | instead of forward, for -COUNT occurrences. | ||
| 2204 | 2208 | ||
| 2205 | Search case-sensitivity is determined by the value of the variable | 2209 | Search case-sensitivity is determined by the value of the variable |
| 2206 | `case-fold-search', which see. | 2210 | `case-fold-search', which see. |