Next: Match Data, Previous: POSIX Regexps, Up: Searching and Matching [Contents][Index]
This function is the guts of query-replace and related commands.
It searches for occurrences of from-string and replaces some or
all of them. If query-flag is nil, it replaces all
occurrences; otherwise, it asks the user what to do about each one.
If regexp-flag is non-nil, then from-string is
considered a regular expression; otherwise, it must match literally. If
delimited-flag is non-nil, then only replacements
surrounded by word boundaries are considered.
The argument 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 repeat-count is non-nil, it should be an integer. Then
it specifies how many times to use each of the strings in the
replacements list before advancing cyclicly to the next one.
Normally, the keymap query-replace-map defines the possible user
responses for queries. The argument map, if non-nil, is a
keymap to use instead of query-replace-map.
This variable holds a special keymap that defines the valid user
responses for query-replace and related functions, as well as
y-or-n-p and map-y-or-n-p. It is unusual in two ways:
Here are the meaningful “bindings” for query-replace-map.
Several of them are meaningful only for query-replace and
friends.
actDo take the action being considered—in other words, “yes.”
skipDo not take action for this question—in other words, “no.”
exitAnswer this question “no,” and give up on the entire series of questions, assuming that the answers will be “no.”
act-and-exitAnswer this question “yes,” and give up on the entire series of questions, assuming that subsequent answers will be “no.”
act-and-showAnswer this question “yes,” but show the results—don’t advance yet to the next question.
automaticAnswer this question and all subsequent questions in the series with “yes,” without further user interaction.
backupMove back to the previous place that a question was asked about.
editEnter a recursive edit to deal with this question—instead of any other action that would normally be taken.
delete-and-editDelete the text being considered, then enter a recursive edit to replace it.
recenterRedisplay and center the window, then ask the same question again.
quitPerform a quit right away. Only y-or-n-p and related functions
use this answer.
helpDisplay some help, then ask again.
Next: Match Data, Previous: POSIX Regexps, Up: Searching and Matching [Contents][Index]