aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/buffers.texi6
-rw-r--r--doc/lispref/searching.texi67
-rw-r--r--doc/lispref/strings.texi5
3 files changed, 49 insertions, 29 deletions
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 1f7f263fb21..740d7cfd8a1 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -1211,6 +1211,12 @@ swapped as well: the positions of point and mark, all the markers, the
1211overlays, the text properties, the undo list, the value of the 1211overlays, the text properties, the undo list, the value of the
1212@code{enable-multibyte-characters} flag (@pxref{Text Representations, 1212@code{enable-multibyte-characters} flag (@pxref{Text Representations,
1213enable-multibyte-characters}), etc. 1213enable-multibyte-characters}), etc.
1214
1215@strong{Warning:} If this function is called from within a
1216@code{save-excursion} form, the current buffer will be set to
1217@var{buffer} upon leaving the form, since the marker used by
1218@code{save-excursion} to save the position and buffer will be swapped
1219as well.
1214@end defun 1220@end defun
1215 1221
1216 If you use @code{buffer-swap-text} on a file-visiting buffer, you 1222 If you use @code{buffer-swap-text} on a file-visiting buffer, you
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 644716a95c7..a04e6938cef 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/doc/lispref/strings.texi b/doc/lispref/strings.texi
index 4e4c239291e..0b9529460f3 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -503,8 +503,9 @@ the codeset part of the locale cannot be @code{"UTF-8"} on MS-Windows.
503If your system does not support a locale environment, this function 503If your system does not support a locale environment, this function
504behaves like @code{string-equal}. 504behaves like @code{string-equal}.
505 505
506Do @emph{not} use this function to compare file names for equality, only 506Do @emph{not} use this function to compare file names for equality, as
507for sorting them. 507filesystems generally don't honor linguistic equivalence of strings
508that collation implements.
508@end defun 509@end defun
509 510
510@defun string-prefix-p string1 string2 &optional ignore-case 511@defun string-prefix-p string1 string2 &optional ignore-case