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 | |
| 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.
| -rw-r--r-- | doc/lispref/searching.texi | 67 | ||||
| -rw-r--r-- | lisp/isearch.el | 48 | ||||
| -rw-r--r-- | src/search.c | 85 |
3 files changed, 137 insertions, 63 deletions
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 1243d720bc3..acf3d0e9845 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -44,7 +44,7 @@ Searching and Replacement, emacs, The GNU Emacs Manual}. | |||
| 44 | buffer is multibyte; they convert the search string to unibyte if the | 44 | buffer is multibyte; they convert the search string to unibyte if the |
| 45 | buffer is unibyte. @xref{Text Representations}. | 45 | buffer is unibyte. @xref{Text Representations}. |
| 46 | 46 | ||
| 47 | @deffn Command search-forward string &optional limit noerror repeat | 47 | @deffn Command search-forward string &optional limit noerror count |
| 48 | This function searches forward from point for an exact match for | 48 | 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 |
| @@ -95,24 +95,24 @@ The argument @var{noerror} only affects valid searches which fail to | |||
| 95 | find a match. Invalid arguments cause errors regardless of | 95 | find a match. Invalid arguments cause errors regardless of |
| 96 | @var{noerror}. | 96 | @var{noerror}. |
| 97 | 97 | ||
| 98 | If @var{repeat} is a positive number @var{n}, it serves as a repeat | 98 | If @var{count} is a positive number @var{n}, the search is done |
| 99 | count: the search is repeated @var{n} times, each time starting at the | 99 | @var{n} times; each successive search starts at the end of the |
| 100 | end of the previous time's match. If these successive searches | 100 | previous match. If all these successive searches succeed, the |
| 101 | succeed, the function succeeds, moving point and returning its new | 101 | function call succeeds, moving point and returning its new value. |
| 102 | value. Otherwise the search fails, with results depending on the | 102 | Otherwise the function call fails, with results depending on the value |
| 103 | value of @var{noerror}, as described above. If @var{repeat} is a | 103 | of @var{noerror}, as described above. If @var{count} is a negative |
| 104 | negative number -@var{n}, it serves as a repeat count of @var{n} for a | 104 | number -@var{n}, the search is done @var{n} times in the opposite |
| 105 | search in the opposite (backward) direction. | 105 | (backward) direction. |
| 106 | @end deffn | 106 | @end deffn |
| 107 | 107 | ||
| 108 | @deffn Command search-backward string &optional limit noerror repeat | 108 | @deffn Command search-backward string &optional limit noerror count |
| 109 | This function searches backward from point for @var{string}. It is | 109 | This function searches backward from point for @var{string}. It is |
| 110 | like @code{search-forward}, except that it searches backwards rather | 110 | like @code{search-forward}, except that it searches backwards rather |
| 111 | than forwards. Backward searches leave point at the beginning of the | 111 | than forwards. Backward searches leave point at the beginning of the |
| 112 | match. | 112 | match. |
| 113 | @end deffn | 113 | @end deffn |
| 114 | 114 | ||
| 115 | @deffn Command word-search-forward string &optional limit noerror repeat | 115 | @deffn Command word-search-forward string &optional limit noerror count |
| 116 | This function searches forward from point for a word match for | 116 | This function searches forward from point for a word match for |
| 117 | @var{string}. If it finds a match, it sets point to the end of the | 117 | @var{string}. If it finds a match, it sets point to the end of the |
| 118 | match found, and returns the new value of point. | 118 | match found, and returns the new value of point. |
| @@ -156,8 +156,10 @@ returns @code{nil} instead of signaling an error. If @var{noerror} is | |||
| 156 | neither @code{nil} nor @code{t}, it moves point to @var{limit} (or the | 156 | neither @code{nil} nor @code{t}, it moves point to @var{limit} (or the |
| 157 | end of the accessible portion of the buffer) and returns @code{nil}. | 157 | end of the accessible portion of the buffer) and returns @code{nil}. |
| 158 | 158 | ||
| 159 | If @var{repeat} is non-@code{nil}, then the search is repeated that many | 159 | If @var{count} is a positive number, it specifies how many successive |
| 160 | times. Point is positioned at the end of the last match. | 160 | occurrences to search for. Point is positioned at the end of the last |
| 161 | match. If @var{count} is a negative number, the search is backward | ||
| 162 | and point is positioned at the beginning of the last match. | ||
| 161 | 163 | ||
| 162 | @findex word-search-regexp | 164 | @findex word-search-regexp |
| 163 | Internally, @code{word-search-forward} and related functions use the | 165 | Internally, @code{word-search-forward} and related functions use the |
| @@ -165,7 +167,7 @@ function @code{word-search-regexp} to convert @var{string} to a | |||
| 165 | regular expression that ignores punctuation. | 167 | regular expression that ignores punctuation. |
| 166 | @end deffn | 168 | @end deffn |
| 167 | 169 | ||
| 168 | @deffn Command word-search-forward-lax string &optional limit noerror repeat | 170 | @deffn Command word-search-forward-lax string &optional limit noerror count |
| 169 | This command is identical to @code{word-search-forward}, except that | 171 | This command is identical to @code{word-search-forward}, except that |
| 170 | the beginning or the end of @var{string} need not match a word | 172 | the beginning or the end of @var{string} need not match a word |
| 171 | boundary, unless @var{string} begins or ends in whitespace. | 173 | boundary, unless @var{string} begins or ends in whitespace. |
| @@ -173,14 +175,14 @@ For instance, searching for @samp{ball boy} matches @samp{ball boyee}, | |||
| 173 | but does not match @samp{balls boy}. | 175 | but does not match @samp{balls boy}. |
| 174 | @end deffn | 176 | @end deffn |
| 175 | 177 | ||
| 176 | @deffn Command word-search-backward string &optional limit noerror repeat | 178 | @deffn Command word-search-backward string &optional limit noerror count |
| 177 | This function searches backward from point for a word match to | 179 | This function searches backward from point for a word match to |
| 178 | @var{string}. This function is just like @code{word-search-forward} | 180 | @var{string}. This function is just like @code{word-search-forward} |
| 179 | except that it searches backward and normally leaves point at the | 181 | except that it searches backward and normally leaves point at the |
| 180 | beginning of the match. | 182 | beginning of the match. |
| 181 | @end deffn | 183 | @end deffn |
| 182 | 184 | ||
| 183 | @deffn Command word-search-backward-lax string &optional limit noerror repeat | 185 | @deffn Command word-search-backward-lax string &optional limit noerror count |
| 184 | This command is identical to @code{word-search-backward}, except that | 186 | This command is identical to @code{word-search-backward}, except that |
| 185 | the beginning or the end of @var{string} need not match a word | 187 | the beginning or the end of @var{string} need not match a word |
| 186 | boundary, unless @var{string} begins or ends in whitespace. | 188 | boundary, unless @var{string} begins or ends in whitespace. |
| @@ -1005,7 +1007,7 @@ only the search functions useful in programs. The principal one is | |||
| 1005 | the buffer is multibyte; they convert the regular expression to unibyte | 1007 | the buffer is multibyte; they convert the regular expression to unibyte |
| 1006 | if the buffer is unibyte. @xref{Text Representations}. | 1008 | if the buffer is unibyte. @xref{Text Representations}. |
| 1007 | 1009 | ||
| 1008 | @deffn Command re-search-forward regexp &optional limit noerror repeat | 1010 | @deffn Command re-search-forward regexp &optional limit noerror count |
| 1009 | This function searches forward in the current buffer for a string of | 1011 | This function searches forward in the current buffer for a string of |
| 1010 | text that is matched by the regular expression @var{regexp}. The | 1012 | text that is matched by the regular expression @var{regexp}. The |
| 1011 | function skips over any amount of text that is not matched by | 1013 | function skips over any amount of text that is not matched by |
| @@ -1014,14 +1016,12 @@ It returns the new value of point. | |||
| 1014 | 1016 | ||
| 1015 | If @var{limit} is non-@code{nil}, it must be a position in the current | 1017 | If @var{limit} is non-@code{nil}, it must be a position in the current |
| 1016 | buffer. It specifies the upper bound to the search. No match | 1018 | buffer. It specifies the upper bound to the search. No match |
| 1017 | extending after that position is accepted. | 1019 | extending after that position is accepted. If @var{limit} is omitted |
| 1020 | or @code{nil}, it defaults to the end of the accessible portion of the | ||
| 1021 | buffer. | ||
| 1018 | 1022 | ||
| 1019 | If @var{repeat} is supplied, it must be a positive number; the search | 1023 | What @code{re-search-forward} does when the search fails depends on |
| 1020 | is repeated that many times; each repetition starts at the end of the | 1024 | the value of @var{noerror}: |
| 1021 | previous match. If all these successive searches succeed, the search | ||
| 1022 | succeeds, moving point and returning its new value. Otherwise the | ||
| 1023 | search fails. What @code{re-search-forward} does when the search | ||
| 1024 | fails depends on the value of @var{noerror}: | ||
| 1025 | 1025 | ||
| 1026 | @table @asis | 1026 | @table @asis |
| 1027 | @item @code{nil} | 1027 | @item @code{nil} |
| @@ -1033,6 +1033,19 @@ Move point to @var{limit} (or the end of the accessible portion of the | |||
| 1033 | buffer) and return @code{nil}. | 1033 | buffer) and return @code{nil}. |
| 1034 | @end table | 1034 | @end table |
| 1035 | 1035 | ||
| 1036 | The argument @var{noerror} only affects valid searches which fail to | ||
| 1037 | find a match. Invalid arguments cause errors regardless of | ||
| 1038 | @var{noerror}. | ||
| 1039 | |||
| 1040 | If @var{count} is a positive number @var{n}, the search is done | ||
| 1041 | @var{n} times; each successive search starts at the end of the | ||
| 1042 | previous match. If all these successive searches succeed, the | ||
| 1043 | function call succeeds, moving point and returning its new value. | ||
| 1044 | Otherwise the function call fails, with results depending on the value | ||
| 1045 | of @var{noerror}, as described above. If @var{count} is a negative | ||
| 1046 | number -@var{n}, the search is done @var{n} times in the opposite | ||
| 1047 | (backward) direction. | ||
| 1048 | |||
| 1036 | In the following example, point is initially before the @samp{T}. | 1049 | In the following example, point is initially before the @samp{T}. |
| 1037 | Evaluating the search call moves point to the end of that line (between | 1050 | Evaluating the search call moves point to the end of that line (between |
| 1038 | the @samp{t} of @samp{hat} and the newline). | 1051 | the @samp{t} of @samp{hat} and the newline). |
| @@ -1057,7 +1070,7 @@ comes back" twice. | |||
| 1057 | @end example | 1070 | @end example |
| 1058 | @end deffn | 1071 | @end deffn |
| 1059 | 1072 | ||
| 1060 | @deffn Command re-search-backward regexp &optional limit noerror repeat | 1073 | @deffn Command re-search-backward regexp &optional limit noerror count |
| 1061 | This function searches backward in the current buffer for a string of | 1074 | This function searches backward in the current buffer for a string of |
| 1062 | text that is matched by the regular expression @var{regexp}, leaving | 1075 | text that is matched by the regular expression @var{regexp}, leaving |
| 1063 | point at the beginning of the first text found. | 1076 | point at the beginning of the first text found. |
| @@ -1228,13 +1241,13 @@ non-greedy repetition operators (@pxref{Regexp Special, non-greedy}). | |||
| 1228 | This is because POSIX backtracking conflicts with the semantics of | 1241 | This is because POSIX backtracking conflicts with the semantics of |
| 1229 | non-greedy repetition. | 1242 | non-greedy repetition. |
| 1230 | 1243 | ||
| 1231 | @deffn Command posix-search-forward regexp &optional limit noerror repeat | 1244 | @deffn Command posix-search-forward regexp &optional limit noerror count |
| 1232 | This is like @code{re-search-forward} except that it performs the full | 1245 | This is like @code{re-search-forward} except that it performs the full |
| 1233 | backtracking specified by the POSIX standard for regular expression | 1246 | backtracking specified by the POSIX standard for regular expression |
| 1234 | matching. | 1247 | matching. |
| 1235 | @end deffn | 1248 | @end deffn |
| 1236 | 1249 | ||
| 1237 | @deffn Command posix-search-backward regexp &optional limit noerror repeat | 1250 | @deffn Command posix-search-backward regexp &optional limit noerror count |
| 1238 | This is like @code{re-search-backward} except that it performs the full | 1251 | This is like @code{re-search-backward} except that it performs the full |
| 1239 | backtracking specified by the POSIX standard for regular expression | 1252 | backtracking specified by the POSIX standard for regular expression |
| 1240 | matching. | 1253 | matching. |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 7360a0b3742..a97247671cc 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -1624,10 +1624,17 @@ Used in `word-search-forward', `word-search-backward', | |||
| 1624 | "Search backward from point for STRING, ignoring differences in punctuation. | 1624 | "Search backward from point for STRING, ignoring differences in punctuation. |
| 1625 | Set point to the beginning of the occurrence found, and return point. | 1625 | Set point to the beginning of the occurrence found, and return point. |
| 1626 | An optional second argument bounds the search; it is a buffer position. | 1626 | An optional second argument bounds the search; it is a buffer position. |
| 1627 | The match found must not extend before that position. | 1627 | The match found must not begin before that position. A value of nil |
| 1628 | means search to the beginning of the accessible portion of the buffer. | ||
| 1628 | Optional third argument, if t, means if fail just return nil (no error). | 1629 | Optional third argument, if t, means if fail just return nil (no error). |
| 1629 | If not nil and not t, move to limit of search and return nil. | 1630 | If not nil and not t, position at limit of search and return nil. |
| 1630 | Optional fourth argument is repeat count--search for successive occurrences. | 1631 | Optional fourth argument COUNT, if a positive number, means to search |
| 1632 | for COUNT successive occurrences. If COUNT is negative, search | ||
| 1633 | forward, instead of backward, for -COUNT occurrences. A value of | ||
| 1634 | nil means the same as 1. | ||
| 1635 | With COUNT positive, the match found is the COUNTth to last one (or | ||
| 1636 | last, if COUNT is 1 or nil) in the buffer located entirely before | ||
| 1637 | the origin of the search; correspondingly with COUNT negative. | ||
| 1631 | 1638 | ||
| 1632 | Relies on the function `word-search-regexp' to convert a sequence | 1639 | Relies on the function `word-search-regexp' to convert a sequence |
| 1633 | of words in STRING to a regexp used to search words without regard | 1640 | of words in STRING to a regexp used to search words without regard |
| @@ -1641,10 +1648,17 @@ has no effect on it." | |||
| 1641 | "Search forward from point for STRING, ignoring differences in punctuation. | 1648 | "Search forward from point for STRING, ignoring differences in punctuation. |
| 1642 | Set point to the end of the occurrence found, and return point. | 1649 | Set point to the end of the occurrence found, and return point. |
| 1643 | An optional second argument bounds the search; it is a buffer position. | 1650 | An optional second argument bounds the search; it is a buffer position. |
| 1644 | The match found must not extend after that position. | 1651 | The match found must not end after that position. A value of nil |
| 1652 | means search to the end of the accessible portion of the buffer. | ||
| 1645 | Optional third argument, if t, means if fail just return nil (no error). | 1653 | Optional third argument, if t, means if fail just return nil (no error). |
| 1646 | If not nil and not t, move to limit of search and return nil. | 1654 | If not nil and not t, move to limit of search and return nil. |
| 1647 | Optional fourth argument is repeat count--search for successive occurrences. | 1655 | Optional fourth argument COUNT, if a positive number, means to search |
| 1656 | for COUNT successive occurrences. If COUNT is negative, search | ||
| 1657 | backward, instead of forward, for -COUNT occurrences. A value of | ||
| 1658 | nil means the same as 1. | ||
| 1659 | With COUNT positive, the match found is the COUNTth one (or first, | ||
| 1660 | if COUNT is 1 or nil) in the buffer located entirely after the | ||
| 1661 | origin of the search; correspondingly with COUNT negative. | ||
| 1648 | 1662 | ||
| 1649 | Relies on the function `word-search-regexp' to convert a sequence | 1663 | Relies on the function `word-search-regexp' to convert a sequence |
| 1650 | of words in STRING to a regexp used to search words without regard | 1664 | of words in STRING to a regexp used to search words without regard |
| @@ -1662,10 +1676,17 @@ Unlike `word-search-backward', the end of STRING need not match a word | |||
| 1662 | boundary, unless STRING ends in whitespace. | 1676 | boundary, unless STRING ends in whitespace. |
| 1663 | 1677 | ||
| 1664 | An optional second argument bounds the search; it is a buffer position. | 1678 | An optional second argument bounds the search; it is a buffer position. |
| 1665 | The match found must not extend before that position. | 1679 | The match found must not begin before that position. A value of nil |
| 1680 | means search to the beginning of the accessible portion of the buffer. | ||
| 1666 | Optional third argument, if t, means if fail just return nil (no error). | 1681 | Optional third argument, if t, means if fail just return nil (no error). |
| 1667 | If not nil and not t, move to limit of search and return nil. | 1682 | If not nil and not t, position at limit of search and return nil. |
| 1668 | Optional fourth argument is repeat count--search for successive occurrences. | 1683 | Optional fourth argument COUNT, if a positive number, means to search |
| 1684 | for COUNT successive occurrences. If COUNT is negative, search | ||
| 1685 | forward, instead of backward, for -COUNT occurrences. A value of | ||
| 1686 | nil means the same as 1. | ||
| 1687 | With COUNT positive, the match found is the COUNTth to last one (or | ||
| 1688 | last, if COUNT is 1 or nil) in the buffer located entirely before | ||
| 1689 | the origin of the search; correspondingly with COUNT negative. | ||
| 1669 | 1690 | ||
| 1670 | Relies on the function `word-search-regexp' to convert a sequence | 1691 | Relies on the function `word-search-regexp' to convert a sequence |
| 1671 | of words in STRING to a regexp used to search words without regard | 1692 | of words in STRING to a regexp used to search words without regard |
| @@ -1683,10 +1704,17 @@ Unlike `word-search-forward', the end of STRING need not match a word | |||
| 1683 | boundary, unless STRING ends in whitespace. | 1704 | boundary, unless STRING ends in whitespace. |
| 1684 | 1705 | ||
| 1685 | An optional second argument bounds the search; it is a buffer position. | 1706 | An optional second argument bounds the search; it is a buffer position. |
| 1686 | The match found must not extend after that position. | 1707 | The match found must not end after that position. A value of nil |
| 1708 | means search to the end of the accessible portion of the buffer. | ||
| 1687 | Optional third argument, if t, means if fail just return nil (no error). | 1709 | Optional third argument, if t, means if fail just return nil (no error). |
| 1688 | If not nil and not t, move to limit of search and return nil. | 1710 | If not nil and not t, move to limit of search and return nil. |
| 1689 | Optional fourth argument is repeat count--search for successive occurrences. | 1711 | Optional fourth argument COUNT, if a positive number, means to search |
| 1712 | for COUNT successive occurrences. If COUNT is negative, search | ||
| 1713 | backward, instead of forward, for -COUNT occurrences. A value of | ||
| 1714 | nil means the same as 1. | ||
| 1715 | With COUNT positive, the match found is the COUNTth one (or first, | ||
| 1716 | if COUNT is 1 or nil) in the buffer located entirely after the | ||
| 1717 | origin of the search; correspondingly with COUNT negative. | ||
| 1690 | 1718 | ||
| 1691 | Relies on the function `word-search-regexp' to convert a sequence | 1719 | Relies on the function `word-search-regexp' to convert a sequence |
| 1692 | of words in STRING to a regexp used to search words without regard | 1720 | of words in STRING to a regexp used to search words without regard |
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. |