From 80120f13ef629d16601efcc9afdad274ff63339a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 18 Oct 2008 14:07:36 +0000 Subject: [PATCH] (Search and Replace): Document `replace-search-function' and `replace-re-search-function'. --- doc/lispref/ChangeLog | 3 +++ doc/lispref/searching.texi | 27 +++++++++++++++++++++++++-- etc/NEWS | 9 +++++++-- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 7e1ba05893b..9dd3a77636a 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,5 +1,8 @@ 2008-10-18 Eli Zaretskii + * searching.texi (Search and Replace): Document + `replace-search-function' and `replace-re-search-function'. + * minibuf.texi (Text from Minibuffer): Document `read-regexp'. (Completion Commands, Reading File Names): Rename `minibuffer-local-must-match-filename-map' to diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 9b54aa18b08..6bca6c79f27 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1625,8 +1625,8 @@ The argument @var{replacements} specifies what to replace occurrences 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. @@ -1642,6 +1642,13 @@ Normally, the keymap @code{query-replace-map} defines the possible 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 @@ -1712,6 +1719,22 @@ use this answer. 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 diff --git a/etc/NEWS b/etc/NEWS index 48e430f902b..de994736a2c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1272,13 +1272,18 @@ completion-all-completions-with-base-size. *** 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. -- 2.39.5