with. If it is a string, that string is used. It can also be a list of
strings, to be used in cyclic order.
-If @var{replacements} is a cons cell, @code{(@var{function}
-. @var{data})}, this means to call @var{function} after each match to
+If @var{replacements} is a cons cell, @w{@code{(@var{function}
+. @var{data})}}, this means to call @var{function} after each match to
get the replacement text. This function is called with two arguments:
@var{data}, and the number of replacements already made.
user responses for queries. The argument @var{map}, if
non-@code{nil}, specifies a keymap to use instead of
@code{query-replace-map}.
+
+This function uses one of two functions to search for the next
+occurrence of @var{from-string}. These functions are specified by the
+values of two variables: @code{replace-re-search-function} and
+@code{replace-search-function}. The former is called when the
+argument @var{regexp-flag} is non-@code{nil}, the latter when it is
+@code{nil}.
@end defun
@defvar query-replace-map
Display some help, then ask again.
@end table
+@defvar replace-search-function
+This variable specifies a function that @code{perform-replace} calls
+to search for the next string to replace. Its default value is
+@code{search-forward}. Any other value should name a function of 3
+arguments: the first 3 arguments of @code{search-forward}
+(@pxref{String Search}).
+@end defvar
+
+@defvar replace-re-search-function
+This variable specifies a function that @code{perform-replace} calls
+to search for the next regexp to replace. Its default value is
+@code{re-search-forward}. Any other value should name a function of 3
+arguments: the first 3 arguments of @code{re-search-forward}
+(@pxref{Regexp Search}).
+@end defvar
+
@node Standard Regexps
@section Standard Regular Expressions Used in Editing
@cindex regexps used standardly in editing
*** New function `match-substitute-replacement' returns the result of
`replace-match' without actually using it in the buffer.
++++
*** The new variable `replace-search-function' determines the function
-to use for searching in query-replace and replace-string.
+to use for searching in query-replace and replace-string. The
+function it specifies is called by `perform-replace' when its 4th
+argument is nil.
++++
*** The new variable `replace-re-search-function' determines the
function to use for searching in `query-replace-regexp',
`replace-regexp', `query-replace-regexp-eval', and
-`map-query-replace-regexp'.
+`map-query-replace-regexp'. The function it specifies is called by
+`perform-replace' when its 4th argument is non-nil.
*** New keymap `search-map' bound to `M-s' provides global bindings
for search related commands.