aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2016-07-12 22:11:22 +0200
committerStephen Berman2016-07-12 22:11:22 +0200
commit069fc05bd5fabdd5971e2c5230a8586248fb7f38 (patch)
treed5481fa5874fa9c2a789e62cafefb72d4bef253d
parent0a0144a2e15a00b5c3272ad95e62d1d489b453c4 (diff)
downloademacs-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.texi67
-rw-r--r--lisp/isearch.el48
-rw-r--r--src/search.c85
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}.
44buffer is multibyte; they convert the search string to unibyte if the 44buffer is multibyte; they convert the search string to unibyte if the
45buffer is unibyte. @xref{Text Representations}. 45buffer 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
48This function searches forward from point for an exact match for 48This 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
50found, and returns the new value of point. If no match is found, the 50found, 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
95find a match. Invalid arguments cause errors regardless of 95find a match. Invalid arguments cause errors regardless of
96@var{noerror}. 96@var{noerror}.
97 97
98If @var{repeat} is a positive number @var{n}, it serves as a repeat 98If @var{count} is a positive number @var{n}, the search is done
99count: 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
100end of the previous time's match. If these successive searches 100previous match. If all these successive searches succeed, the
101succeed, the function succeeds, moving point and returning its new 101function call succeeds, moving point and returning its new value.
102value. Otherwise the search fails, with results depending on the 102Otherwise the function call fails, with results depending on the value
103value of @var{noerror}, as described above. If @var{repeat} is a 103of @var{noerror}, as described above. If @var{count} is a negative
104negative number -@var{n}, it serves as a repeat count of @var{n} for a 104number -@var{n}, the search is done @var{n} times in the opposite
105search 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
109This function searches backward from point for @var{string}. It is 109This function searches backward from point for @var{string}. It is
110like @code{search-forward}, except that it searches backwards rather 110like @code{search-forward}, except that it searches backwards rather
111than forwards. Backward searches leave point at the beginning of the 111than forwards. Backward searches leave point at the beginning of the
112match. 112match.
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
116This function searches forward from point for a word match for 116This 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
118match found, and returns the new value of point. 118match found, and returns the new value of point.
@@ -156,8 +156,10 @@ returns @code{nil} instead of signaling an error. If @var{noerror} is
156neither @code{nil} nor @code{t}, it moves point to @var{limit} (or the 156neither @code{nil} nor @code{t}, it moves point to @var{limit} (or the
157end of the accessible portion of the buffer) and returns @code{nil}. 157end of the accessible portion of the buffer) and returns @code{nil}.
158 158
159If @var{repeat} is non-@code{nil}, then the search is repeated that many 159If @var{count} is a positive number, it specifies how many successive
160times. Point is positioned at the end of the last match. 160occurrences to search for. Point is positioned at the end of the last
161match. If @var{count} is a negative number, the search is backward
162and point is positioned at the beginning of the last match.
161 163
162@findex word-search-regexp 164@findex word-search-regexp
163Internally, @code{word-search-forward} and related functions use the 165Internally, @code{word-search-forward} and related functions use the
@@ -165,7 +167,7 @@ function @code{word-search-regexp} to convert @var{string} to a
165regular expression that ignores punctuation. 167regular 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
169This command is identical to @code{word-search-forward}, except that 171This command is identical to @code{word-search-forward}, except that
170the beginning or the end of @var{string} need not match a word 172the beginning or the end of @var{string} need not match a word
171boundary, unless @var{string} begins or ends in whitespace. 173boundary, unless @var{string} begins or ends in whitespace.
@@ -173,14 +175,14 @@ For instance, searching for @samp{ball boy} matches @samp{ball boyee},
173but does not match @samp{balls boy}. 175but 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
177This function searches backward from point for a word match to 179This 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}
179except that it searches backward and normally leaves point at the 181except that it searches backward and normally leaves point at the
180beginning of the match. 182beginning 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
184This command is identical to @code{word-search-backward}, except that 186This command is identical to @code{word-search-backward}, except that
185the beginning or the end of @var{string} need not match a word 187the beginning or the end of @var{string} need not match a word
186boundary, unless @var{string} begins or ends in whitespace. 188boundary, unless @var{string} begins or ends in whitespace.
@@ -1005,7 +1007,7 @@ only the search functions useful in programs. The principal one is
1005the buffer is multibyte; they convert the regular expression to unibyte 1007the buffer is multibyte; they convert the regular expression to unibyte
1006if the buffer is unibyte. @xref{Text Representations}. 1008if 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
1009This function searches forward in the current buffer for a string of 1011This function searches forward in the current buffer for a string of
1010text that is matched by the regular expression @var{regexp}. The 1012text that is matched by the regular expression @var{regexp}. The
1011function skips over any amount of text that is not matched by 1013function skips over any amount of text that is not matched by
@@ -1014,14 +1016,12 @@ It returns the new value of point.
1014 1016
1015If @var{limit} is non-@code{nil}, it must be a position in the current 1017If @var{limit} is non-@code{nil}, it must be a position in the current
1016buffer. It specifies the upper bound to the search. No match 1018buffer. It specifies the upper bound to the search. No match
1017extending after that position is accepted. 1019extending after that position is accepted. If @var{limit} is omitted
1020or @code{nil}, it defaults to the end of the accessible portion of the
1021buffer.
1018 1022
1019If @var{repeat} is supplied, it must be a positive number; the search 1023What @code{re-search-forward} does when the search fails depends on
1020is repeated that many times; each repetition starts at the end of the 1024the value of @var{noerror}:
1021previous match. If all these successive searches succeed, the search
1022succeeds, moving point and returning its new value. Otherwise the
1023search fails. What @code{re-search-forward} does when the search
1024fails 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
1033buffer) and return @code{nil}. 1033buffer) and return @code{nil}.
1034@end table 1034@end table
1035 1035
1036The argument @var{noerror} only affects valid searches which fail to
1037find a match. Invalid arguments cause errors regardless of
1038@var{noerror}.
1039
1040If @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
1042previous match. If all these successive searches succeed, the
1043function call succeeds, moving point and returning its new value.
1044Otherwise the function call fails, with results depending on the value
1045of @var{noerror}, as described above. If @var{count} is a negative
1046number -@var{n}, the search is done @var{n} times in the opposite
1047(backward) direction.
1048
1036In the following example, point is initially before the @samp{T}. 1049In the following example, point is initially before the @samp{T}.
1037Evaluating the search call moves point to the end of that line (between 1050Evaluating the search call moves point to the end of that line (between
1038the @samp{t} of @samp{hat} and the newline). 1051the @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
1061This function searches backward in the current buffer for a string of 1074This function searches backward in the current buffer for a string of
1062text that is matched by the regular expression @var{regexp}, leaving 1075text that is matched by the regular expression @var{regexp}, leaving
1063point at the beginning of the first text found. 1076point at the beginning of the first text found.
@@ -1228,13 +1241,13 @@ non-greedy repetition operators (@pxref{Regexp Special, non-greedy}).
1228This is because POSIX backtracking conflicts with the semantics of 1241This is because POSIX backtracking conflicts with the semantics of
1229non-greedy repetition. 1242non-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
1232This is like @code{re-search-forward} except that it performs the full 1245This is like @code{re-search-forward} except that it performs the full
1233backtracking specified by the POSIX standard for regular expression 1246backtracking specified by the POSIX standard for regular expression
1234matching. 1247matching.
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
1238This is like @code{re-search-backward} except that it performs the full 1251This is like @code{re-search-backward} except that it performs the full
1239backtracking specified by the POSIX standard for regular expression 1252backtracking specified by the POSIX standard for regular expression
1240matching. 1253matching.
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.
1625Set point to the beginning of the occurrence found, and return point. 1625Set point to the beginning of the occurrence found, and return point.
1626An optional second argument bounds the search; it is a buffer position. 1626An optional second argument bounds the search; it is a buffer position.
1627The 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.
1628Optional third argument, if t, means if fail just return nil (no error). 1629Optional 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.
1630Optional fourth argument is repeat count--search for successive occurrences. 1631Optional 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.
1635With 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
1632Relies on the function `word-search-regexp' to convert a sequence 1639Relies on the function `word-search-regexp' to convert a sequence
1633of words in STRING to a regexp used to search words without regard 1640of 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.
1642Set point to the end of the occurrence found, and return point. 1649Set point to the end of the occurrence found, and return point.
1643An optional second argument bounds the search; it is a buffer position. 1650An optional second argument bounds the search; it is a buffer position.
1644The 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.
1645Optional third argument, if t, means if fail just return nil (no error). 1653Optional 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.
1647Optional fourth argument is repeat count--search for successive occurrences. 1655Optional 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.
1659With 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
1649Relies on the function `word-search-regexp' to convert a sequence 1663Relies on the function `word-search-regexp' to convert a sequence
1650of words in STRING to a regexp used to search words without regard 1664of 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
1662boundary, unless STRING ends in whitespace. 1676boundary, unless STRING ends in whitespace.
1663 1677
1664An optional second argument bounds the search; it is a buffer position. 1678An optional second argument bounds the search; it is a buffer position.
1665The 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.
1666Optional third argument, if t, means if fail just return nil (no error). 1681Optional 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.
1668Optional fourth argument is repeat count--search for successive occurrences. 1683Optional 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.
1687With 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
1670Relies on the function `word-search-regexp' to convert a sequence 1691Relies on the function `word-search-regexp' to convert a sequence
1671of words in STRING to a regexp used to search words without regard 1692of 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
1683boundary, unless STRING ends in whitespace. 1704boundary, unless STRING ends in whitespace.
1684 1705
1685An optional second argument bounds the search; it is a buffer position. 1706An optional second argument bounds the search; it is a buffer position.
1686The 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.
1687Optional third argument, if t, means if fail just return nil (no error). 1709Optional 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.
1689Optional fourth argument is repeat count--search for successive occurrences. 1711Optional 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.
1715With 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
1691Relies on the function `word-search-regexp' to convert a sequence 1719Relies on the function `word-search-regexp' to convert a sequence
1692of words in STRING to a regexp used to search words without regard 1720of 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.
2165Set point to the beginning of the occurrence found, and return point. 2165Set point to the beginning of the occurrence found, and return point.
2166An optional second argument bounds the search; it is a buffer position. 2166An optional second argument bounds the search; it is a buffer position.
2167The 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.
2168Optional third argument, if t, means if fail just return nil (no error). 2169Optional 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.
2170Optional fourth argument COUNT, if non-nil, means to search for COUNT 2171Optional 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.
2175With 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
2174Search case-sensitivity is determined by the value of the variable 2179Search 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.
2185Set point to the end of the occurrence found, and return point. 2190Set point to the end of the occurrence found, and return point.
2186An optional second argument bounds the search; it is a buffer position. 2191An optional second argument bounds the search; it is a buffer position.
2187The 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.
2189Optional third argument, if t, means if fail just return nil (no error). 2194Optional 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.
2191Optional fourth argument COUNT, if non-nil, means to search for COUNT 2196Optional 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.
2200With 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
2195Search case-sensitivity is determined by the value of the variable 2204Search 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'. */)
2204DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4, 2213DEFUN ("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.
2207Set point to the beginning of the match, and return point. 2216Set point to the beginning of the occurrence found, and return point.
2208The match found is the one starting last in the buffer
2209and yet ending before the origin of the search.
2210An optional second argument bounds the search; it is a buffer position. 2217An optional second argument bounds the search; it is a buffer position.
2211The 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.
2212Optional third argument, if t, means if fail just return nil (no error). 2220Optional 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.
2214Optional fourth argument is repeat count--search for successive occurrences. 2222Optional 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.
2226With 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
2216Search case-sensitivity is determined by the value of the variable 2230Search 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.
2229Set point to the end of the occurrence found, and return point. 2243Set point to the end of the occurrence found, and return point.
2230An optional second argument bounds the search; it is a buffer position. 2244An optional second argument bounds the search; it is a buffer position.
2231The 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.
2232Optional third argument, if t, means if fail just return nil (no error). 2247Optional 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.
2234Optional fourth argument is repeat count--search for successive occurrences. 2249Optional 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.
2253With 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
2236Search case-sensitivity is determined by the value of the variable 2257Search 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.
2249Find the longest match in accord with Posix regular expression rules. 2270Find the longest match in accord with Posix regular expression rules.
2250Set point to the beginning of the match, and return point. 2271Set point to the beginning of the occurrence found, and return point.
2251The match found is the one starting last in the buffer
2252and yet ending before the origin of the search.
2253An optional second argument bounds the search; it is a buffer position. 2272An optional second argument bounds the search; it is a buffer position.
2254The 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.
2255Optional third argument, if t, means if fail just return nil (no error). 2275Optional 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.
2257Optional fourth argument is repeat count--search for successive occurrences. 2277Optional 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.
2281With 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
2259Search case-sensitivity is determined by the value of the variable 2285Search 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,
2272Find the longest match in accord with Posix regular expression rules. 2298Find the longest match in accord with Posix regular expression rules.
2273Set point to the end of the occurrence found, and return point. 2299Set point to the end of the occurrence found, and return point.
2274An optional second argument bounds the search; it is a buffer position. 2300An optional second argument bounds the search; it is a buffer position.
2275The 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.
2276Optional third argument, if t, means if fail just return nil (no error). 2303Optional 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.
2278Optional fourth argument is repeat count--search for successive occurrences. 2305Optional 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.
2309With 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
2280Search case-sensitivity is determined by the value of the variable 2313Search case-sensitivity is determined by the value of the variable
2281`case-fold-search', which see. 2314`case-fold-search', which see.