aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-11-25 21:09:29 +0200
committerEli Zaretskii2015-11-25 21:09:29 +0200
commit8f2a5a8aa487036006b7590c896cde30157ca7e0 (patch)
tree488c77404b4d7a40e8a9083745d81a6bd5775800
parent849c1f0180bdadfe695ba0dc2abaf8d060c20328 (diff)
downloademacs-8f2a5a8aa487036006b7590c896cde30157ca7e0.tar.gz
emacs-8f2a5a8aa487036006b7590c896cde30157ca7e0.zip
Improve and update documentation of search commands
* doc/emacs/search.texi (Lax Search): Renamed from "Search Case"; all references changed. Move the description of lax-whitespace here. Add description of the new character folding features and additional customizable options. (Isearch Yank): Move before "Error in Search". (Basic Isearch): Improve wording. Add index entries. Add short description of how to abandon search, making this subsection a complete introduction to search basics. (Repeat Isearch): Add index entries. Describe additional customizable options. Describe mouse clicks. (Isearch Yank): Add index entries. Describe mouse-2 click in echo area. Describe more customizable options. (Error in Isearch): Add index entries. (Special Isearch): Move actual description of some isearch commands to other sections, leaving here just the summary of the commands. Add command that toggles character folding. Describe commands, like "C-h C-h", that were previously omitted for some reason. (Not Exiting Isearch): Describe search-exit-option. Add index entries. (Word Search): Describe eww-search-word and eww-search-prefix. (Symbol Search): Add index entries. (Regexp Search): Describe regexp-search-ring-max. (Replacement and Lax Matches): Renamed from "Replacement and Case"; all references changed. Describe lax-whitespace matching in replace commands and related options. Describe character folding in replace commands and related options. (Query Replace): Describe query-replace-from-to-separator and the new history features. Add index entries for highlighted text. Describe query-replace-skip-read-only. Describe more keys accepted by query-replace. (Other Repeating Search): More index entries for Occur. Describe list-matching-lines-default-context-lines. (Search Customizations): New section, documents customizable options that were not documented until now. * doc/emacs/glossary.texi (Glossary): Add "Case Folding" and "Character Folding". * etc/NEWS: Move search- and replace-related entries to a single parent section. * lisp/replace.el (query-replace-show-replacement): Doc fix. * lisp/isearch.el (search-nonincremental-instead) (isearch-hide-immediately): Doc fixes.
-rw-r--r--doc/emacs/abbrevs.texi4
-rw-r--r--doc/emacs/emacs.texi11
-rw-r--r--doc/emacs/glossary.texi11
-rw-r--r--doc/emacs/maintaining.texi2
-rw-r--r--doc/emacs/mini.texi4
-rw-r--r--doc/emacs/search.texi738
-rw-r--r--etc/NEWS53
-rw-r--r--lisp/isearch.el12
-rw-r--r--lisp/replace.el3
9 files changed, 595 insertions, 243 deletions
diff --git a/doc/emacs/abbrevs.texi b/doc/emacs/abbrevs.texi
index 23d7e28f4e3..695ffa8d1cd 100644
--- a/doc/emacs/abbrevs.texi
+++ b/doc/emacs/abbrevs.texi
@@ -407,7 +407,7 @@ you are expanding.
407in this search; if it is @code{nil}, the word and the expansion must 407in this search; if it is @code{nil}, the word and the expansion must
408match in case. If the value is @code{case-fold-search} (the default), 408match in case. If the value is @code{case-fold-search} (the default),
409then the variable @code{case-fold-search} controls whether to ignore 409then the variable @code{case-fold-search} controls whether to ignore
410case while searching for expansions (@pxref{Search Case}). 410case while searching for expansions (@pxref{Lax Search}).
411 411
412@vindex dabbrev-case-replace 412@vindex dabbrev-case-replace
413 Normally, dynamic abbrev expansion preserves the case pattern 413 Normally, dynamic abbrev expansion preserves the case pattern
@@ -421,7 +421,7 @@ the dynamic abbrev's case pattern is preserved in most cases; if it is
421@code{nil}, the expansion is always copied verbatim. If the value is 421@code{nil}, the expansion is always copied verbatim. If the value is
422@code{case-replace} (the default), then the variable 422@code{case-replace} (the default), then the variable
423@code{case-replace} controls whether to copy the expansion verbatim 423@code{case-replace} controls whether to copy the expansion verbatim
424(@pxref{Replacement and Case}). 424(@pxref{Replacement and Lax Matches}).
425 425
426 However, if the expansion contains a complex mixed case pattern, and 426 However, if the expansion contains a complex mixed case pattern, and
427the dynamic abbrev matches this pattern as far as it goes, then the 427the dynamic abbrev matches this pattern as far as it goes, then the
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 27bb77d5cac..2877be9c6b7 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -392,18 +392,20 @@ Searching and Replacement
392* Regexps:: Syntax of regular expressions. 392* Regexps:: Syntax of regular expressions.
393* Regexp Backslash:: Regular expression constructs starting with `\'. 393* Regexp Backslash:: Regular expression constructs starting with `\'.
394* Regexp Example:: A complex regular expression explained. 394* Regexp Example:: A complex regular expression explained.
395* Search Case:: To ignore case while searching, or not. 395* Lax Search:: Search ignores some distinctions between
396 similar characters, like letter-case.
396* Replace:: Search, and replace some or all matches. 397* Replace:: Search, and replace some or all matches.
397* Other Repeating Search:: Operating on all matches for some regexp. 398* Other Repeating Search:: Operating on all matches for some regexp.
399* Search Customizations:: Various search customizations.
398 400
399Incremental Search 401Incremental Search
400 402
401* Basic Isearch:: Basic incremental search commands. 403* Basic Isearch:: Basic incremental search commands.
402* Repeat Isearch:: Searching for the same string again. 404* Repeat Isearch:: Searching for the same string again.
403* Error in Isearch:: When your string is not found.
404* Special Isearch:: Special input in incremental search.
405* Isearch Yank:: Commands that grab text into the search string 405* Isearch Yank:: Commands that grab text into the search string
406 or else edit the search string. 406 or else edit the search string.
407* Error in Isearch:: When your string is not found.
408* Special Isearch:: Special input in incremental search.
407* Not Exiting Isearch:: Prefix argument and scrolling commands. 409* Not Exiting Isearch:: Prefix argument and scrolling commands.
408* Isearch Minibuffer:: Incremental search of the minibuffer history. 410* Isearch Minibuffer:: Incremental search of the minibuffer history.
409 411
@@ -411,7 +413,8 @@ Replacement Commands
411 413
412* Unconditional Replace:: Replacing all matches for a string. 414* Unconditional Replace:: Replacing all matches for a string.
413* Regexp Replace:: Replacing all matches for a regexp. 415* Regexp Replace:: Replacing all matches for a regexp.
414* Replacement and Case:: How replacements preserve case of letters. 416* Replacement and Lax Matches::
417 Lax searching for text to replace.
415* Query Replace:: How to use querying. 418* Query Replace:: How to use querying.
416 419
417Commands for Fixing Typos 420Commands for Fixing Typos
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi
index e66cd79e740..cc81101d67a 100644
--- a/doc/emacs/glossary.texi
+++ b/doc/emacs/glossary.texi
@@ -175,11 +175,22 @@ corresponding Control character. @xref{User Input,C-M-}.
175Case conversion means changing text from upper case to lower case or 175Case conversion means changing text from upper case to lower case or
176vice versa. @xref{Case}. 176vice versa. @xref{Case}.
177 177
178@item Case Folding
179Case folding means ignoring the differences between case variants of
180the same letter: upper-case, lower-case, and title-case. Emacs
181performs case folding by default in text search. @xref{Lax Search}.
182
178@item Character 183@item Character
179Characters form the contents of an Emacs buffer. Also, key sequences 184Characters form the contents of an Emacs buffer. Also, key sequences
180(q.v.@:) are usually made up of characters (though they may include 185(q.v.@:) are usually made up of characters (though they may include
181other input events as well). @xref{User Input}. 186other input events as well). @xref{User Input}.
182 187
188@item Character Folding
189Character folding means ignoring differences between similarly looking
190characters, such as between @code{a}, and @code{@:a} and @code{@'a}.
191Emacs performs character folding by default in text search. @xref{Lax
192Search}.
193
183@item Character Set 194@item Character Set
184Emacs supports a number of character sets, each of which represents a 195Emacs supports a number of character sets, each of which represents a
185particular alphabet or script. @xref{International}. 196particular alphabet or script. @xref{International}.
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index a571ea7ed67..f1a59f84351 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -2285,7 +2285,7 @@ input. @xref{Query Replace}, for more information on query replace.
2285 You can control the case-sensitivity of tags search commands by 2285 You can control the case-sensitivity of tags search commands by
2286customizing the value of the variable @code{tags-case-fold-search}. The 2286customizing the value of the variable @code{tags-case-fold-search}. The
2287default is to use the same setting as the value of 2287default is to use the same setting as the value of
2288@code{case-fold-search} (@pxref{Search Case}). 2288@code{case-fold-search} (@pxref{Lax Search}).
2289 2289
2290 It is possible to get through all the files in the tags table with a 2290 It is possible to get through all the files in the tags table with a
2291single invocation of @kbd{M-x tags-query-replace}. But often it is 2291single invocation of @kbd{M-x tags-query-replace}. But often it is
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 2493fdadf37..ed339a967a4 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -642,8 +642,8 @@ expressions. A numeric prefix argument @var{n} means to fetch the
642@var{n}th matching entry. These commands are unusual, in that they 642@var{n}th matching entry. These commands are unusual, in that they
643use the minibuffer to read the regular expression argument, even 643use the minibuffer to read the regular expression argument, even
644though they are invoked from the minibuffer. An upper-case letter in 644though they are invoked from the minibuffer. An upper-case letter in
645the regular expression makes the search case-sensitive (@pxref{Search 645the regular expression makes the search case-sensitive (@pxref{Lax
646Case}). 646Search}).
647 647
648 You can also search through the history using an incremental search. 648 You can also search through the history using an incremental search.
649@xref{Isearch Minibuffer}. 649@xref{Isearch Minibuffer}.
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index ae275d1ca67..9da9226d3bf 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -26,9 +26,11 @@ thing, but search for patterns instead of fixed strings.
26* Regexps:: Syntax of regular expressions. 26* Regexps:: Syntax of regular expressions.
27* Regexp Backslash:: Regular expression constructs starting with `\'. 27* Regexp Backslash:: Regular expression constructs starting with `\'.
28* Regexp Example:: A complex regular expression explained. 28* Regexp Example:: A complex regular expression explained.
29* Search Case:: To ignore case while searching, or not. 29* Lax Search:: Search ignores some distinctions between
30 similar characters, like letter-case.
30* Replace:: Search, and replace some or all matches. 31* Replace:: Search, and replace some or all matches.
31* Other Repeating Search:: Operating on all matches for some regexp. 32* Other Repeating Search:: Operating on all matches for some regexp.
33* Search Customizations:: Various search customizations.
32@end menu 34@end menu
33 35
34@node Incremental Search 36@node Incremental Search
@@ -54,10 +56,10 @@ Incremental search backward (@code{isearch-backward}).
54@menu 56@menu
55* Basic Isearch:: Basic incremental search commands. 57* Basic Isearch:: Basic incremental search commands.
56* Repeat Isearch:: Searching for the same string again. 58* Repeat Isearch:: Searching for the same string again.
57* Error in Isearch:: When your string is not found.
58* Special Isearch:: Special input in incremental search.
59* Isearch Yank:: Commands that grab text into the search string 59* Isearch Yank:: Commands that grab text into the search string
60 or else edit the search string. 60 or else edit the search string.
61* Error in Isearch:: When your string is not found.
62* Special Isearch:: Special input in incremental search.
61* Not Exiting Isearch:: Prefix argument and scrolling commands. 63* Not Exiting Isearch:: Prefix argument and scrolling commands.
62* Isearch Minibuffer:: Incremental search of the minibuffer history. 64* Isearch Minibuffer:: Incremental search of the minibuffer history.
63@end menu 65@end menu
@@ -89,31 +91,46 @@ cursor moves to just after the first @samp{FOO}.
89@cindex isearch face 91@cindex isearch face
90 At each step, Emacs highlights the @dfn{current match}---the buffer 92 At each step, Emacs highlights the @dfn{current match}---the buffer
91text that matches the search string---using the @code{isearch} face 93text that matches the search string---using the @code{isearch} face
92(@pxref{Faces}). The current search string is also displayed in the 94(@pxref{Faces}). @xref{Search Customizations}, for various options
93echo area. 95that customize this highlighting. The current search string is also
96displayed in the echo area.
94 97
95 If you make a mistake typing the search string, type @key{DEL}. 98 If you make a mistake typing the search string, type @key{DEL}.
96Each @key{DEL} cancels the last character of the search string. 99Each @key{DEL} cancels the last character of the search string.
100@xref{Error in Isearch}, for more about dealing with unsuccessful
101search.
97 102
103@cindex exit incremental search
104@cindex incremental search, exiting
98 When you are satisfied with the place you have reached, type 105 When you are satisfied with the place you have reached, type
99@key{RET}. This stops searching, leaving the cursor where the search 106@key{RET}. This stops searching, leaving the cursor where the search
100brought it. Also, any command not specially meaningful in searches 107brought it. Also, any command not specially meaningful in searches
101stops the searching and is then executed. Thus, typing @kbd{C-a} 108stops the searching and is then executed. Thus, typing @kbd{C-a}
102exits the search and then moves to the beginning of the line. 109exits the search and then moves to the beginning of the line; typing
103@key{RET} is necessary only if the next command you want to type is a 110one of the arrow keys exits the search and performs the respective
104printing character, @key{DEL}, @key{RET}, or another character that is 111movement command; etc. @key{RET} is necessary only if the next
105special within searches (@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s}, 112command you want to type is a printing character, @key{DEL},
106@kbd{C-y}, @kbd{M-y}, @kbd{M-r}, @kbd{M-c}, @kbd{M-e}, and some others 113@key{RET}, or another character that is special within searches
107described below). 114(@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s}, @kbd{C-y}, @kbd{M-y},
115@kbd{M-r}, @kbd{M-c}, @kbd{M-e}, and some others described below).
116You can fine-tune the commands that exit the search; see @ref{Not
117Exiting Isearch}.
108 118
109 As a special exception, entering @key{RET} when the search string is 119 As a special exception, entering @key{RET} when the search string is
110empty launches nonincremental search (@pxref{Nonincremental Search}). 120empty launches nonincremental search (@pxref{Nonincremental Search}).
121(This can be customized; see @ref{Search Customizations}.)
122
123 To abandon the search and return to the place where you started,
124type @kbd{@key{ESC} @key{ESC} @key{ESC}} (@code{isearch-cancel}) or
125@kbd{C-g C-g} (@code{isearch-abort}).
111 126
112 When you exit the incremental search, it adds the original value of 127 When you exit the incremental search, it adds the original value of
113point to the mark ring, without activating the mark; you can thus use 128point to the mark ring, without activating the mark; you can thus use
114@kbd{C-u C-@key{SPC}} to return to where you were before beginning the 129@kbd{C-u C-@key{SPC}} or @kbd{C-x C-x} to return to where you were
115search. @xref{Mark Ring}. It only does this if the mark was not 130before beginning the search. @xref{Mark Ring}. (Emacs only does this
116already active. 131if the mark was not already active; if the mark was active when you
132started the search, both @kbd{C-u C-@key{SPC}} and @kbd{C-x C-x} will
133go to the mark.)
117 134
118@kindex C-r 135@kindex C-r
119@findex isearch-backward 136@findex isearch-backward
@@ -134,7 +151,6 @@ characters with @key{DEL}. Similarly, each @kbd{C-r} in a backward
134incremental search repeats the backward search. 151incremental search repeats the backward search.
135 152
136@cindex lazy search highlighting 153@cindex lazy search highlighting
137@vindex isearch-lazy-highlight
138 If you pause for a little while during incremental search, Emacs 154 If you pause for a little while during incremental search, Emacs
139highlights all the other possible matches for the search string that 155highlights all the other possible matches for the search string that
140are present on the screen. This helps you anticipate where you can 156are present on the screen. This helps you anticipate where you can
@@ -142,21 +158,26 @@ get to by typing @kbd{C-s} or @kbd{C-r} to repeat the search. The
142other matches are highlighted differently from the current match, 158other matches are highlighted differently from the current match,
143using the customizable face @code{lazy-highlight} (@pxref{Faces}). If 159using the customizable face @code{lazy-highlight} (@pxref{Faces}). If
144you don't like this feature, you can disable it by setting 160you don't like this feature, you can disable it by setting
145@code{isearch-lazy-highlight} to @code{nil}. 161@code{isearch-lazy-highlight} to @code{nil}. For other customizations
162related to highlighting matches, see @ref{Search Customizations}.
146 163
147 After exiting a search, you can search for the same string again by 164 After exiting a search, you can search for the same string again by
148typing just @kbd{C-s C-s}. The first @kbd{C-s} is the key that 165typing just @kbd{C-s C-s}. The first @kbd{C-s} is the key that
149invokes incremental search, and the second @kbd{C-s} means to search 166invokes incremental search, and the second @kbd{C-s} means to search
150again. Similarly, @kbd{C-r C-r} searches backward for the last 167again for the last search string. Similarly, @kbd{C-r C-r} searches
151search string. In determining the last search string, it doesn't 168backward for the last search string. In determining the last search
152matter whether the string was searched for with @kbd{C-s} or 169string, it doesn't matter whether that string was searched for with
153@kbd{C-r}. 170@kbd{C-s} or @kbd{C-r}.
154 171
155 If you are searching forward but you realize you were looking for 172 If you are searching forward but you realize you were looking for
156something before the starting point, type @kbd{C-r} to switch to a 173something before the starting point, type @kbd{C-r} to switch to a
157backward search, leaving the search string unchanged. Similarly, 174backward search, leaving the search string unchanged. Similarly,
158@kbd{C-s} in a backward search switches to a forward search. 175@kbd{C-s} in a backward search switches to a forward search.
159 176
177@cindex search, wrapping around
178@cindex search, overwrapped
179@cindex wrapped search
180@cindex overwrapped search
160 If a search is failing and you ask to repeat it by typing another 181 If a search is failing and you ask to repeat it by typing another
161@kbd{C-s}, it starts again from the beginning of the buffer. 182@kbd{C-s}, it starts again from the beginning of the buffer.
162Repeating a failing reverse search with @kbd{C-r} starts again from 183Repeating a failing reverse search with @kbd{C-r} starts again from
@@ -169,19 +190,86 @@ you have already seen.
169@cindex search ring 190@cindex search ring
170@kindex M-n @r{(Incremental search)} 191@kindex M-n @r{(Incremental search)}
171@kindex M-p @r{(Incremental search)} 192@kindex M-p @r{(Incremental search)}
193@vindex search-ring-max
172 To reuse earlier search strings, use the @dfn{search ring}. The 194 To reuse earlier search strings, use the @dfn{search ring}. The
173commands @kbd{M-p} and @kbd{M-n} move through the ring to pick a 195commands @kbd{M-p} and @kbd{M-n} move through the ring to pick a
174search string to reuse. These commands leave the selected search ring 196search string to reuse. These commands leave the selected search ring
175element in the minibuffer, where you can edit it. 197element in the minibuffer, where you can edit it. Type
176 198@kbd{C-s}/@kbd{C-r} or @key{RET} to accept the string and start
199searching for it. The number of most recently used search strings
200saved in the search ring is specified by the variable
201@code{search-ring-max}, 16 by default.
202
203@cindex incremental search, edit search string
204@cindex interactively edit search string
177@kindex M-e @r{(Incremental search)} 205@kindex M-e @r{(Incremental search)}
206@kindex Mouse-1 @r{in the minibuffer (Incremental Search)}
178 To edit the current search string in the minibuffer without 207 To edit the current search string in the minibuffer without
179replacing it with items from the search ring, type @kbd{M-e}. Type @key{RET}, 208replacing it with items from the search ring, type @kbd{M-e} or click
180@kbd{C-s} or @kbd{C-r} to finish editing the string and search for it. 209@kbd{Mouse-1} in the minibuffer. Type @key{RET}, @kbd{C-s} or
210@kbd{C-r} to finish editing the string and search for it. Type
211@kbd{C-f} or @kbd{@key{RIGHT}} to add to the search string characters
212following point from the buffer from which you started the search.
213
214@node Isearch Yank
215@subsection Isearch Yanking
216
217 In many cases, you will want to use text at or near point as your
218search string. The commands described in this subsection let you do
219that conveniently.
220
221@kindex C-w @r{(Incremental search)}
222@findex isearch-yank-word-or-char
223 @kbd{C-w} (@code{isearch-yank-word-or-char}) appends the next
224character or word at point to the search string. This is an easy way
225to search for another occurrence of the text at point. (The decision
226of whether to copy a character or a word is heuristic.)
227
228@kindex M-s C-e @r{(Incremental search)}
229@findex isearch-yank-line
230 Similarly, @kbd{M-s C-e} (@code{isearch-yank-line}) appends the rest
231of the current line to the search string. If point is already at the
232end of a line, it appends the next line. With a prefix argument
233@var{n}, it appends the next @var{n} lines.
234
235@kindex C-y @r{(Incremental search)}
236@kindex M-y @r{(Incremental search)}
237@kindex Mouse-2 @r{in the minibuffer (Incremental search)}
238@findex isearch-yank-kill
239@findex isearch-yank-pop
240@findex isearch-yank-x-selection
241 Within incremental search, @kbd{C-y} (@code{isearch-yank-kill})
242appends the current kill to the search string. @kbd{M-y}
243(@code{isearch-yank-pop}), if called after @kbd{C-y}, replaces that
244appended text with an earlier kill, similar to the usual @kbd{M-y}
245(@code{yank-pop}) command (@pxref{Yanking}). Clicking @kbd{Mouse-2}
246in the echo area appends the current X selection (@pxref{Primary
247Selection}) to the search string (@code{isearch-yank-x-selection}).
248
249@kindex C-M-w @r{(Incremental search)}
250@kindex C-M-y @r{(Incremental search)}
251@findex isearch-del-char
252@findex isearch-yank-char
253 @kbd{C-M-w} (@code{isearch-del-char}) deletes the last character
254from the search string, and @kbd{C-M-y} (@code{isearch-yank-char})
255appends the character after point to the search string. An
256alternative method to add the character after point is to enter the
257minibuffer with @kbd{M-e} (@pxref{Repeat Isearch}) and type @kbd{C-f}
258or @kbd{@key{RIGHT}} at the end of the search string in the
259minibuffer. Each @kbd{C-f} or @kbd{@key{RIGHT}} you type adds another
260character following point to the search string.
261
262 Normally, when the search is case-insensitive, text yanked into the
263search string is converted to lower case, so that the search remains
264case-insensitive (@pxref{Lax Search, case folding}). However, if the
265value of the variable @code{search-upper-case} (@pxref{Lax Search,
266search-upper-case}) is other than @code{not-yanks}, that disables this
267down-casing.
181 268
182@node Error in Isearch 269@node Error in Isearch
183@subsection Errors in Incremental Search 270@subsection Errors in Incremental Search
184 271
272@cindex isearch-fail face
185 If your string is not found at all, the echo area says @samp{Failing 273 If your string is not found at all, the echo area says @samp{Failing
186I-Search}, and the cursor moves past the place where Emacs found as 274I-Search}, and the cursor moves past the place where Emacs found as
187much of your string as it could. Thus, if you search for @samp{FOOT}, 275much of your string as it could. Thus, if you search for @samp{FOOT},
@@ -192,12 +280,13 @@ string that failed to match is highlighted using the face
192 280
193 At this point, there are several things you can do. If your string 281 At this point, there are several things you can do. If your string
194was mistyped, you can use @key{DEL} to erase some of it and correct 282was mistyped, you can use @key{DEL} to erase some of it and correct
195it. If you like the place you have found, you can type @key{RET} to 283it, or you can type @kbd{M-e} and edit it. If you like the place you
196remain there. Or you can type @kbd{C-g}, which removes from the 284have found, you can type @key{RET} to remain there. Or you can type
197search string the characters that could not be found (the @samp{T} in 285@kbd{C-g}, which removes from the search string the characters that
198@samp{FOOT}), leaving those that were found (the @samp{FOO} in 286could not be found (the @samp{T} in @samp{FOOT}), leaving those that
199@samp{FOOT}). A second @kbd{C-g} at that point cancels the search 287were found (the @samp{FOO} in @samp{FOOT}). A second @kbd{C-g} at
200entirely, returning point to where it was when the search started. 288that point cancels the search entirely, returning point to where it
289was when the search started.
201 290
202@cindex quitting (in search) 291@cindex quitting (in search)
203@kindex C-g @r{(Incremental search)} 292@kindex C-g @r{(Incremental search)}
@@ -216,34 +305,21 @@ search.
216@node Special Isearch 305@node Special Isearch
217@subsection Special Input for Incremental Search 306@subsection Special Input for Incremental Search
218 307
219 Some of the characters you type during incremental search have 308 In addition to characters described in the previous subsections,
220special effects. 309some of the other characters you type during incremental search have
310special effects. They are described here.
221 311
222@cindex lax space matching 312 To toggle lax space matching (@pxref{Lax Search, lax space
223@kindex M-s SPC @r{(Incremental search)} 313matching}), type @kbd{M-s @key{SPC}}.
224@kindex SPC @r{(Incremental search)} 314
225@findex isearch-toggle-lax-whitespace 315 To toggle case sensitivity of the search, type @kbd{M-c} or
226@vindex search-whitespace-regexp 316@kbd{M-s c}. @xref{Lax Search, case folding}. If the search string
227 By default, incremental search performs @dfn{lax space matching}: 317includes upper-case letters, the search is case-sensitive by default.
228each space, or sequence of spaces, matches any sequence of one or more 318
229spaces in the text. Hence, @samp{foo bar} matches @samp{foo bar}, 319 To toggle whether or not the search will consider similar and
230@samp{foo@w{ }bar}, @samp{foo@w{ }bar}, and so on (but not 320equivalent characters as a match, type @kbd{M-s '}. @xref{Lax Search,
231@samp{foobar}). More precisely, Emacs matches each sequence of space 321character folding}. If the search string includes accented
232characters in the search string to a regular expression specified by 322characters, that disables character folding during that search.
233the variable @code{search-whitespace-regexp}. For example, to make
234spaces match sequences of newlines as well as spaces, set it to
235@samp{"[[:space:]\n]+"}.
236
237 To toggle lax space matching, type @kbd{M-s @key{SPC}}
238(@code{isearch-toggle-lax-whitespace}). To disable this feature
239entirely, change @code{search-whitespace-regexp} to @code{nil}; then
240each space in the search string matches exactly one space.
241
242 If the search string you entered contains only lower-case letters,
243the search is case-insensitive; as long as an upper-case letter exists
244in the search string, the search becomes case-sensitive. If you
245delete the upper-case character from the search string, it ceases to
246have this effect. @xref{Search Case}.
247 323
248@cindex invisible text, searching for 324@cindex invisible text, searching for
249@kindex M-s i @r{(Incremental search)} 325@kindex M-s i @r{(Incremental search)}
@@ -251,7 +327,17 @@ have this effect. @xref{Search Case}.
251 To toggle whether or not invisible text is searched, type 327 To toggle whether or not invisible text is searched, type
252@kbd{M-s i} (@code{isearch-toggle-invisible}). @xref{Outline Search}. 328@kbd{M-s i} (@code{isearch-toggle-invisible}). @xref{Outline Search}.
253 329
254 To search for a newline character, type @kbd{C-j}. 330@kindex M-r @r{(Incremental Search)}
331@kindex M-s r @r{(Incremental Search)}
332@findex isearch-toggle-regexp
333 To toggle between non-regexp and regexp incremental search, type
334@kbd{M-r} or @kbd{M-s r} (@code{isearch-toggle-regexp}).
335@xref{Regexp Search}.
336
337 To toggle symbol mode, type @kbd{M-s _}. @xref{Symbol Search}.
338
339 To search for a newline character, type @kbd{C-j} as part of the
340search string.
255 341
256 To search for non-@acronym{ASCII} characters, use one of the 342 To search for non-@acronym{ASCII} characters, use one of the
257following methods: 343following methods:
@@ -265,17 +351,21 @@ example, @kbd{C-q C-s} during incremental search adds the
265@samp{control-S} character to the search string. 351@samp{control-S} character to the search string.
266 352
267@item 353@item
268Type @kbd{C-x 8 @key{RET}}, followed by a Unicode name or code-point. 354Type @kbd{C-x 8 @key{RET}}, followed by a Unicode name or code-point
269This adds the specified character into the search string, similar to 355in hex. This adds the specified character into the search string,
270the usual @code{insert-char} command (@pxref{Inserting Text}). 356similar to the usual @code{insert-char} command (@pxref{Inserting
357Text}).
271 358
272@item 359@item
360@kindex C-^ @r{(Incremental Search)}
361@findex isearch-toggle-input-method
362@findex isearch-toggle-specified-input-method
273Use an input method (@pxref{Input Methods}). If an input method is 363Use an input method (@pxref{Input Methods}). If an input method is
274enabled in the current buffer when you start the search, you can use 364enabled in the current buffer when you start the search, the same
275it in the search string also. While typing the search string, you can 365method will be active in the minibuffer when you type the search
276toggle the input method with @kbd{C-\} 366string. While typing the search string, you can toggle the input
277(@code{isearch-toggle-input-method}). You can also turn on a 367method with @kbd{C-\} (@code{isearch-toggle-input-method}). You can
278non-default input method with @kbd{C-^} 368also turn on a non-default input method with @kbd{C-^}
279(@code{isearch-toggle-specified-input-method}), which prompts for the 369(@code{isearch-toggle-specified-input-method}), which prompts for the
280name of the input method. When an input method is active during 370name of the input method. When an input method is active during
281incremental search, the search prompt includes the input method 371incremental search, the search prompt includes the input method
@@ -286,13 +376,17 @@ I-search [@var{im}]:
286@end example 376@end example
287 377
288@noindent 378@noindent
289@findex isearch-toggle-input-method
290@findex isearch-toggle-specified-input-method
291where @var{im} is the mnemonic of the active input method. Any input 379where @var{im} is the mnemonic of the active input method. Any input
292method you enable during incremental search remains enabled in the 380method you enable during incremental search remains enabled in the
293current buffer afterwards. 381current buffer afterwards.
294@end itemize 382@end itemize
295 383
384@kindex M-s o @r{(Incremental Search)}
385@findex isearch-occur
386 Typing @kbd{M-s o} in incremental search invokes
387@code{isearch-occur}, which runs @code{occur} with the current search
388string. @xref{Other Repeating Search, occur}.
389
296@kindex M-% @r{(Incremental search)} 390@kindex M-% @r{(Incremental search)}
297 Typing @kbd{M-%} in incremental search invokes @code{query-replace} 391 Typing @kbd{M-%} in incremental search invokes @code{query-replace}
298or @code{query-replace-regexp} (depending on search mode) with the 392or @code{query-replace-regexp} (depending on search mode) with the
@@ -302,83 +396,72 @@ prefix argument means to replace backward. @xref{Query Replace}.
302@kindex M-TAB @r{(Incremental search)} 396@kindex M-TAB @r{(Incremental search)}
303 Typing @kbd{M-@key{TAB}} in incremental search invokes 397 Typing @kbd{M-@key{TAB}} in incremental search invokes
304@code{isearch-complete}, which attempts to complete the search string 398@code{isearch-complete}, which attempts to complete the search string
305using the search ring as a list of completion alternatives. 399using the search ring (the previous search strings you used) as a list
306@xref{Completion}. In many operating systems, the @kbd{M-@key{TAB}} 400of completion alternatives. @xref{Completion}. In many operating
307key sequence is captured by the window manager; you then need to 401systems, the @kbd{M-@key{TAB}} key sequence is captured by the window
308rebind @code{isearch-complete} to another key sequence if you want to 402manager; you then need to rebind @code{isearch-complete} to another
309use it (@pxref{Rebinding}). 403key sequence if you want to use it (@pxref{Rebinding}).
310 404
405@kindex M-s h r @r{(Incremental Search)}
406@findex isearch-highlight-regexp
407 You can exit the search while leaving the matches for the last
408search string highlighted on display. To this end, type @kbd{M-s h r}
409(@code{isearch-highlight-regexp}), which will run
410@code{highlight-regexp} (@pxref{Highlight Interactively}) passing
411it the regexp derived from the last search string and prompting you
412for the face to use for highlighting. To remove the highlighting,
413type @kbd{M-s h u} (@code{unhighlight-regexp}).
414
415@cindex incremental search, help on special keys
416@kindex C-h C-h @r{(Incremental Search)}
417@findex isearch-help-map
311@vindex isearch-mode-map 418@vindex isearch-mode-map
312 When incremental search is active, you can type @kbd{C-h C-h} to 419 When incremental search is active, you can type @kbd{C-h C-h}
313access interactive help options, including a list of special key 420(@code{isearch-help-map}) to access interactive help options,
314bindings. These key bindings are part of the keymap 421including a list of special key bindings. These key bindings are part
315@code{isearch-mode-map} (@pxref{Keymaps}). 422of the keymap @code{isearch-mode-map} (@pxref{Keymaps}).
316
317@node Isearch Yank
318@subsection Isearch Yanking
319
320@kindex C-y @r{(Incremental search)}
321@kindex M-y @r{(Incremental search)}
322@findex isearch-yank-kill
323@findex isearch-yank-pop
324 Within incremental search, @kbd{C-y} (@code{isearch-yank-kill})
325appends the current kill to the search string. @kbd{M-y}
326(@code{isearch-yank-pop}), if called after @kbd{C-y}, replaces that
327appended text with an earlier kill, similar to the usual @kbd{M-y}
328(@code{yank-pop}) command (@pxref{Yanking}). @kbd{Mouse-2} appends
329the current X selection (@pxref{Primary Selection}).
330
331@kindex C-w @r{(Incremental search)}
332@findex isearch-yank-word-or-char
333 @kbd{C-w} (@code{isearch-yank-word-or-char}) appends the next
334character or word at point to the search string. This is an easy way
335to search for another occurrence of the text at point. (The decision
336of whether to copy a character or a word is heuristic.)
337
338@kindex M-s C-e @r{(Incremental search)}
339@findex isearch-yank-line
340 Similarly, @kbd{M-s C-e} (@code{isearch-yank-line}) appends the rest
341of the current line to the search string. If point is already at the
342end of a line, it appends the next line. With a prefix argument
343@var{n}, it appends the next @var{n} lines.
344
345 If the search is currently case-insensitive, both @kbd{C-w} and
346@kbd{M-s C-e} convert the text they copy to lower case, so that the
347search remains case-insensitive.
348
349@kindex C-M-w @r{(Incremental search)}
350@kindex C-M-y @r{(Incremental search)}
351@findex isearch-del-char
352@findex isearch-yank-char
353 @kbd{C-M-w} (@code{isearch-del-char}) deletes the last character
354from the search string, and @kbd{C-M-y} (@code{isearch-yank-char})
355appends the character after point to the search string. An
356alternative method to add the character after point is to enter the
357minibuffer with @kbd{M-e} (@pxref{Repeat Isearch}) and type @kbd{C-f}
358at the end of the search string in the minibuffer.
359 423
360@node Not Exiting Isearch 424@node Not Exiting Isearch
361@subsection Not Exiting Incremental Search 425@subsection Not Exiting Incremental Search
362 426
363This subsection describes two categories of commands which you can 427This subsection describes how to control whether typing a command not
364type without exiting the current incremental search, even though they 428specifically meaningful is searches exits the search before executing
365are not themselves part of incremental search. 429the command. It also describes two categories of commands which you
430can type without exiting the current incremental search, even though
431they are not themselves part of incremental search.
432
433@vindex search-exit-option
434 Normally, typing a command that is not bound by the incremental
435search exits the search before executing the command. Thus, the
436command operates on the buffer from which you invoked the search.
437However, if you customize the variable @code{search-exit-option} to a
438@code{nil} value, the characters which you type that are not
439interpreted by the incremental search are simply appended to the
440search string. This is so you could include in the search string
441control characters, such as @kbd{C-a}, that would normally exit the
442search and invoke the command bound to them on the buffer.
366 443
367@table @asis 444@table @asis
368@item Prefix Arguments 445@item Prefix Arguments
446@cindex prefix argument commands, during incremental search
369@vindex isearch-allow-prefix 447@vindex isearch-allow-prefix
370 In incremental search, when you enter a prefix argument 448 In incremental search, when you type a command that specifies a
371(@pxref{Arguments}), by default it will apply either to the next 449prefix argument (@pxref{Arguments}), by default it will apply either
372action in the search or to the command that exits the search. 450to the next action in the search or to the command that exits the
451search. In other words, entering a prefix argument will not by itself
452terminate the search.
373 453
374 In previous versions of Emacs, entering a prefix argument always 454 In previous versions of Emacs, entering a prefix argument always
375terminated the search. You can revert to this behavior by setting the 455terminated the search. You can revert to this behavior by setting the
376variable @code{isearch-allow-prefix} to @code{nil}. 456variable @code{isearch-allow-prefix} to @code{nil}.
377 457
378 When @code{isearch-allow-scroll} is non-@code{nil} (see below), 458 When @code{isearch-allow-scroll} is non-@code{nil} (see below),
379prefix arguments always have the default behavior described above. 459prefix arguments always have the default behavior described above,
460i.e., they don't terminate the search, even if
461@code{isearch-allow-prefix} is @code{nil}.
380 462
381@item Scrolling Commands 463@item Scrolling Commands
464@cindex scrolling commands, during incremental search
382@vindex isearch-allow-scroll 465@vindex isearch-allow-scroll
383 Normally, scrolling commands exit incremental search. If you change 466 Normally, scrolling commands exit incremental search. If you change
384the variable @code{isearch-allow-scroll} to a non-@code{nil} value, 467the variable @code{isearch-allow-scroll} to a non-@code{nil} value,
@@ -390,12 +473,14 @@ prefix arguments to these commands in the usual way. This feature
390won't let you scroll the current match out of visibility, however. 473won't let you scroll the current match out of visibility, however.
391 474
392 The @code{isearch-allow-scroll} feature also affects some other 475 The @code{isearch-allow-scroll} feature also affects some other
393commands, such as @kbd{C-x 2} (@code{split-window-below}) and @kbd{C-x 476commands, such as @kbd{C-x 2} (@code{split-window-below}) and
394^} (@code{enlarge-window}), which don't exactly scroll but do affect 477@kbd{C-x ^} (@code{enlarge-window}), which don't exactly scroll but do
395where the text appears on the screen. It applies to any command whose 478affect where the text appears on the screen. It applies to any
396name has a non-@code{nil} @code{isearch-scroll} property. So you can 479command whose name has a non-@code{nil} @code{isearch-scroll}
397control which commands are affected by changing these properties. 480property. So you can control which commands are affected by changing
398 481these properties.
482
483@cindex prevent commands from exiting incremental search
399 For example, to make @kbd{C-h l} usable within an incremental search 484 For example, to make @kbd{C-h l} usable within an incremental search
400in all future Emacs sessions, use @kbd{C-h c} to find what command it 485in all future Emacs sessions, use @kbd{C-h c} to find what command it
401runs (@pxref{Key Help}), which is @code{view-lossage}. Then you can 486runs (@pxref{Key Help}), which is @code{view-lossage}. Then you can
@@ -409,7 +494,8 @@ put the following line in your init file (@pxref{Init File}):
409This feature can be applied to any command that doesn't permanently 494This feature can be applied to any command that doesn't permanently
410change point, the buffer contents, the match data, the current buffer, 495change point, the buffer contents, the match data, the current buffer,
411or the selected window and frame. The command must not itself attempt 496or the selected window and frame. The command must not itself attempt
412an incremental search. 497an incremental search. This feature is disabled if
498@code{isearch-allow-scroll} is @code{nil} (which it is by default).
413@end table 499@end table
414 500
415@node Isearch Minibuffer 501@node Isearch Minibuffer
@@ -475,11 +561,13 @@ search matches any sequence of those two words separated by one or
475more spaces, newlines, or other punctuation characters. This is 561more spaces, newlines, or other punctuation characters. This is
476particularly useful for searching text documents, because you don't 562particularly useful for searching text documents, because you don't
477have to worry whether the words you are looking for are separated by 563have to worry whether the words you are looking for are separated by
478newlines or spaces. 564newlines or spaces. Note that major modes for programming languages
565or other specialized modes can modify the definition of a word to suit
566their syntactic needs.
479 567
480@table @kbd 568@table @kbd
481@item M-s w 569@item M-s w
482If incremental search is active, toggle word search mode 570 If incremental search is active, toggle word search mode
483(@code{isearch-toggle-word}); otherwise, begin an incremental forward 571(@code{isearch-toggle-word}); otherwise, begin an incremental forward
484word search (@code{isearch-forward-word}). 572word search (@code{isearch-forward-word}).
485@item M-s w @key{RET} @var{words} @key{RET} 573@item M-s w @key{RET} @var{words} @key{RET}
@@ -514,6 +602,14 @@ so that the matching can proceed incrementally as you type. This
514additional laxity does not apply to the lazy highlight 602additional laxity does not apply to the lazy highlight
515(@pxref{Incremental Search}), which always matches whole words. 603(@pxref{Incremental Search}), which always matches whole words.
516 604
605@kindex M-s M-w
606@findex eww-search-word
607@vindex eww-search-prefix
608 Search the Web for the text in region. This command performs an
609Internet search for the words in region using the search engine whose
610@acronym{URL} is specified by the variable @code{eww-search-prefix}.
611@xref{Basics, EWW, , eww, The Emacs Web Wowser Manual}.
612
517@node Symbol Search 613@node Symbol Search
518@section Symbol Search 614@section Symbol Search
519@cindex symbol search 615@cindex symbol search
@@ -529,6 +625,7 @@ searching source code.
529 625
530@table @kbd 626@table @kbd
531@item M-s _ 627@item M-s _
628@findex isearch-toggle-symbol
532If incremental search is active, toggle symbol search mode 629If incremental search is active, toggle symbol search mode
533(@code{isearch-toggle-symbol}); otherwise, begin an incremental 630(@code{isearch-toggle-symbol}); otherwise, begin an incremental
534forward symbol search (@code{isearch-forward-symbol}). 631forward symbol search (@code{isearch-forward-symbol}).
@@ -595,13 +692,16 @@ for. To search backward for a regexp, use @kbd{C-M-r}
595(@code{isearch-backward-regexp}), @kbd{C-r} with a prefix argument, 692(@code{isearch-backward-regexp}), @kbd{C-r} with a prefix argument,
596or @kbd{M-r} within a backward incremental search. 693or @kbd{M-r} within a backward incremental search.
597 694
695@vindex regexp-search-ring-max
598 All of the special key sequences in an ordinary incremental search 696 All of the special key sequences in an ordinary incremental search
599do similar things in an incremental regexp search. For instance, 697(@pxref{Special Isearch}) do similar things in an incremental regexp
600typing @kbd{C-s} immediately after starting the search retrieves the 698search. For instance, typing @kbd{C-s} immediately after starting the
601last incremental search regexp used and searches forward for it. 699search retrieves the last incremental search regexp used and searches
602Incremental regexp and non-regexp searches have independent defaults. 700forward for it. Incremental regexp and non-regexp searches have
603They also have separate search rings, which you can access with 701independent defaults. They also have separate search rings, which you
604@kbd{M-p} and @kbd{M-n}. 702can access with @kbd{M-p} and @kbd{M-n}. The maximum number of search
703regexps saved in the search ring is determined by the value of
704@code{regexp-search-ring-max}, 16 by default.
605 705
606 Unlike ordinary incremental search, incremental regexp search 706 Unlike ordinary incremental search, incremental regexp search
607do not use lax space matching by default. To toggle this feature 707do not use lax space matching by default. To toggle this feature
@@ -1030,21 +1130,67 @@ This contains two parts in succession: a character set matching
1030period, @samp{?}, or @samp{!}, and a character set matching 1130period, @samp{?}, or @samp{!}, and a character set matching
1031close-brackets, quotes, or parentheses, repeated zero or more times. 1131close-brackets, quotes, or parentheses, repeated zero or more times.
1032 1132
1033@node Search Case 1133@node Lax Search
1034@section Searching and Case 1134@section Lax Matching During Searching
1135
1136@cindex lax search
1137@cindex character equivalence in search
1138 Normally, you'd want search commands to disregard certain minor
1139differences between the search string you types and the text being
1140searched. For example, sequences of whitespace characters of
1141different length are normally perceived as equivalent; letter-case
1142differences usually don't matter; etc. This is known as
1143@dfn{character equivalence}.
1144
1145 This section describes the Emacs lax search features, and how to
1146tailor them to your needs.
1035 1147
1148@cindex lax space matching in search
1149@kindex M-s SPC @r{(Incremental search)}
1150@kindex SPC @r{(Incremental search)}
1151@findex isearch-toggle-lax-whitespace
1152@vindex search-whitespace-regexp
1153 By default, search commands perform @dfn{lax space matching}:
1154each space, or sequence of spaces, matches any sequence of one or more
1155whitespace characters in the text. (Incremental regexp search has a
1156separate default; see @ref{Regexp Search}.) Hence, @samp{foo bar}
1157matches @samp{foo bar}, @samp{foo@w{ }bar}, @samp{foo@w{ }bar}, and so
1158on (but not @samp{foobar}). More precisely, Emacs matches each
1159sequence of space characters in the search string to a regular
1160expression specified by the variable @code{search-whitespace-regexp}.
1161For example, to make spaces match sequences of newlines as well as
1162spaces, set it to @samp{"[[:space:]\n]+"}. The default value of this
1163variable depends on the buffer's major mode; most major modes classify
1164spaces, tabs, and formfeed characters as whitespace.
1165
1166 If you want whitespace characters to match exactly, you can turn lax
1167space matching by typing @kbd{M-s @key{SPC}}
1168(@code{isearch-toggle-lax-whitespace}) within an incremental search.
1169Another @kbd{M-s @key{SPC}} turns lax space matching back on. To
1170disable this feature entirely, change @code{search-whitespace-regexp}
1171to @code{nil}; then each space in the search string matches exactly
1172one space.
1173
1174@cindex case folding in search
1175@cindex case-sensitivity and search
1036 Searches in Emacs normally ignore the case of the text they are 1176 Searches in Emacs normally ignore the case of the text they are
1037searching through, if you specify the text in lower case. Thus, if 1177searching through, if you specify the search string in lower case.
1038you specify searching for @samp{foo}, then @samp{Foo} and @samp{foo} 1178Thus, if you specify searching for @samp{foo}, then @samp{Foo} and
1039also match. Regexps, and in particular character sets, behave 1179@samp{foo} also match. Regexps, and in particular character sets,
1040likewise: @samp{[ab]} matches @samp{a} or @samp{A} or @samp{b} or 1180behave likewise: @samp{[ab]} matches @samp{a} or @samp{A} or @samp{b}
1041@samp{B}. 1181or @samp{B}. This feature is known as @dfn{case folding}, and it is
1042 1182supported in both incremental and non-incremental search modes.
1043 An upper-case letter anywhere in the incremental search string makes 1183
1044the search case-sensitive. Thus, searching for @samp{Foo} does not find 1184@vindex search-upper-case
1045@samp{foo} or @samp{FOO}. This applies to regular expression search as 1185 An upper-case letter anywhere in the search string makes the search
1046well as to string search. The effect ceases if you delete the 1186case-sensitive. Thus, searching for @samp{Foo} does not find
1047upper-case letter from the search string. 1187@samp{foo} or @samp{FOO}. This applies to regular expression search
1188as well as to string search. The effect ceases if you delete the
1189upper-case letter from the search string. The variable
1190@code{search-upper-case} controls this: if it is non-@code{nil} (the
1191default), an upper-case character in the search string make the search
1192case-sensitive; setting it to @code{nil} disables this effect of
1193upper-case characters.
1048 1194
1049@vindex case-fold-search 1195@vindex case-fold-search
1050 If you set the variable @code{case-fold-search} to @code{nil}, then 1196 If you set the variable @code{case-fold-search} to @code{nil}, then
@@ -1055,12 +1201,14 @@ This variable applies to nonincremental searches also, including those
1055performed by the replace commands (@pxref{Replace}) and the minibuffer 1201performed by the replace commands (@pxref{Replace}) and the minibuffer
1056history matching commands (@pxref{Minibuffer History}). 1202history matching commands (@pxref{Minibuffer History}).
1057 1203
1058@c isearch-toggle-case-fold 1204@kindex M-c @r{(Incremental search)}
1059 Typing @kbd{M-c} within an incremental search toggles the case 1205@kindex M-s c @r{(Incremental search)}
1060sensitivity of that search. The effect does not extend beyond the 1206@findex isearch-toggle-case-fold
1061current incremental search to the next one, but it does override the 1207 Typing @kbd{M-c} or @kbd{M-s c} (@code{isearch-toggle-case-fold})
1062effect of adding or removing an upper-case letter in the current 1208within an incremental search toggles the case sensitivity of that
1063search. 1209search. The effect does not extend beyond the current incremental
1210search to the next one, but it does override the effect of adding or
1211removing an upper-case letter in the current search.
1064 1212
1065 Several related variables control case-sensitivity of searching and 1213 Several related variables control case-sensitivity of searching and
1066matching for specific commands or activities. For instance, 1214matching for specific commands or activities. For instance,
@@ -1068,6 +1216,46 @@ matching for specific commands or activities. For instance,
1068@code{find-tag}. To find these variables, do @kbd{M-x 1216@code{find-tag}. To find these variables, do @kbd{M-x
1069apropos-variable @key{RET} case-fold-search @key{RET}}. 1217apropos-variable @key{RET} case-fold-search @key{RET}}.
1070 1218
1219@cindex character folding in search
1220@cindex equivalent character sequences
1221 Case folding disregards case distinctions between characters, making
1222upper-case characters match lower-case variants, and vice versa. A
1223generalization of case folding is @dfn{character folding}, which
1224disregards wider classes of distinctions between similar characters.
1225For instance, under character folding the letter @code{a} will match
1226all of its accented cousins like @code{@"a} and @code{@'a}, i.e., the
1227match disregards the diacriticals that distinguish between these
1228variants. In addition, @code{a} will match other characters that
1229resemble it, or have it as part of their graphical representation,
1230such as @sc{u+249c parenthesized latin small letter a} and @sc{u+2100
1231account of} (which looks like a small @code{a} over @code{c}).
1232Similarly, the @acronym{ASCII} double-quote character @code{"} will
1233match all the other variants of double quotes defined by the Unicode
1234standard.
1235@ignore @c FIXME: This doesn't work. Should it?
1236Finally, character folding can make a sequence of one or
1237more characters match another sequence of a different length: for
1238example, the sequence of two characters @code{ae} matches the ligature
1239@code{@ae{}}.
1240@end ignore
1241Character sequences that match under character folding are called
1242@dfn{equivalent}.
1243
1244@kindex M-s ' @r{(Incremental Search)}
1245@findex isearch-toggle-character-fold
1246 Searches in Emacs normally perform character folding, thus matching
1247equivalent character sequences. You can disable this behavior by
1248customizing the variable @code{search-default-regexp-mode} to the
1249@code{nil} value. @xref{Search Customizations}. Within an
1250incremental search, typing @kbd{M-s '}
1251(@code{isearch-toggle-character-fold}) toggles character folding, but
1252only for that search.
1253
1254 Like with case folding, typing an explicit variant of a character,
1255such as @code{@"a}, as part of the search string disables character
1256folding for that search. If you delete such a character from the
1257search string, this effect ceases.
1258
1071@node Replace 1259@node Replace
1072@section Replacement Commands 1260@section Replacement Commands
1073@cindex replacement 1261@cindex replacement
@@ -1078,7 +1266,8 @@ apropos-variable @key{RET} case-fold-search @key{RET}}.
1078 Emacs provides several commands for performing search-and-replace 1266 Emacs provides several commands for performing search-and-replace
1079operations. In addition to the simple @kbd{M-x replace-string} 1267operations. In addition to the simple @kbd{M-x replace-string}
1080command, there is @kbd{M-%} (@code{query-replace}), which presents 1268command, there is @kbd{M-%} (@code{query-replace}), which presents
1081each occurrence of the pattern and asks you whether to replace it. 1269each occurrence of the search pattern and asks you whether to replace
1270it.
1082 1271
1083 The replace commands normally operate on the text from point to the 1272 The replace commands normally operate on the text from point to the
1084end of the buffer. When the region is active, they operate on it 1273end of the buffer. When the region is active, they operate on it
@@ -1087,17 +1276,11 @@ instead (@pxref{Mark}). The basic replace commands replace one
1087is possible to perform several replacements in parallel, using the 1276is possible to perform several replacements in parallel, using the
1088command @code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}). 1277command @code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}).
1089 1278
1090@vindex replace-lax-whitespace
1091 Unlike incremental search, the replacement commands do not use lax
1092space matching (@pxref{Special Isearch}) by default. To enable lax
1093space matching for replacement, change the variable
1094@code{replace-lax-whitespace} to @code{t}. (This only affects how
1095Emacs finds the text to replace, not the replacement text.)
1096
1097@menu 1279@menu
1098* Unconditional Replace:: Replacing all matches for a string. 1280* Unconditional Replace:: Replacing all matches for a string.
1099* Regexp Replace:: Replacing all matches for a regexp. 1281* Regexp Replace:: Replacing all matches for a regexp.
1100* Replacement and Case:: How replacements preserve case of letters. 1282* Replacement and Lax Matches::
1283 Lax searching for text to replace.
1101* Query Replace:: How to use querying. 1284* Query Replace:: How to use querying.
1102@end menu 1285@end menu
1103 1286
@@ -1128,8 +1311,8 @@ activating the mark; use @kbd{C-u C-@key{SPC}} to move back there.
1128 A prefix argument restricts replacement to matches that are 1311 A prefix argument restricts replacement to matches that are
1129surrounded by word boundaries. 1312surrounded by word boundaries.
1130 1313
1131 @xref{Replacement and Case}, for details about case-sensitivity in 1314 @xref{Replacement and Lax Matches}, for details about
1132replace commands. 1315case-sensitivity in replace commands.
1133 1316
1134@node Regexp Replace 1317@node Regexp Replace
1135@subsection Regexp Replacement 1318@subsection Regexp Replacement
@@ -1137,7 +1320,7 @@ replace commands.
1137 1320
1138 The @kbd{M-x replace-string} command replaces exact matches for a 1321 The @kbd{M-x replace-string} command replaces exact matches for a
1139single string. The similar command @kbd{M-x replace-regexp} replaces 1322single string. The similar command @kbd{M-x replace-regexp} replaces
1140any match for a specified pattern. 1323any match for a specified regular expression pattern (@pxref{Regexps}).
1141 1324
1142@table @kbd 1325@table @kbd
1143@item M-x replace-regexp @key{RET} @var{regexp} @key{RET} @var{newstring} @key{RET} 1326@item M-x replace-regexp @key{RET} @var{regexp} @key{RET} @var{newstring} @key{RET}
@@ -1218,9 +1401,28 @@ M-x replace-regexp @key{RET} ^.\@{0,72\@}$ @key{RET}
1218\,(format "%-72sABC%05d" \& \#) @key{RET} 1401\,(format "%-72sABC%05d" \& \#) @key{RET}
1219@end example 1402@end example
1220 1403
1221@node Replacement and Case 1404@node Replacement and Lax Matches
1222@subsection Replace Commands and Case 1405@subsection Replace Commands and Lax Matches
1406
1407 This subsection describes the behavior of replace commands with
1408respect to lax matches (@pxref{Lax Search}) and how to customize it.
1409In general, replace commands mostly default to stricter matching than
1410their search counterparts.
1223 1411
1412@cindex lax space matching in replace commands
1413@vindex replace-lax-whitespace
1414 Unlike incremental search, the replacement commands do not use lax
1415space matching (@pxref{Lax Search, lax space matching}) by default.
1416To enable lax space matching for replacement, change the variable
1417@code{replace-lax-whitespace} to non-@code{nil}. (This only affects
1418how Emacs finds the text to replace, not the replacement text.)
1419
1420@vindex replace-regexp-lax-whitespace
1421 A companion variable @code{replace-regexp-lax-whitespace} controls
1422whether @code{query-replace-regexp} uses lax whitespace matching when
1423searching for patterns.
1424
1425@cindex case folding in replace commands
1224 If the first argument of a replace command is all lower case, the 1426 If the first argument of a replace command is all lower case, the
1225command ignores case while searching for occurrences to 1427command ignores case while searching for occurrences to
1226replace---provided @code{case-fold-search} is non-@code{nil}. If 1428replace---provided @code{case-fold-search} is non-@code{nil}. If
@@ -1250,6 +1452,14 @@ exactly as given, with no case conversion. Likewise, if either
1250@code{case-replace} or @code{case-fold-search} is set to @code{nil}, 1452@code{case-replace} or @code{case-fold-search} is set to @code{nil},
1251replacement is done without case conversion. 1453replacement is done without case conversion.
1252 1454
1455@cindex character folding in replace commands
1456 The replacement commands by default do not use character folding
1457(@pxref{Lax Search, character folding}) when looking for the text to
1458replace. To enable character folding for matching, set the variable
1459@code{replace-character-fold} to a non-@code{nil} value. (This
1460setting does not affect the replacement text, only how Emacs finds the
1461text to replace.)
1462
1253@node Query Replace 1463@node Query Replace
1254@subsection Query Replace 1464@subsection Query Replace
1255@cindex query replace 1465@cindex query replace
@@ -1270,9 +1480,9 @@ occurrence and asks you whether to replace it. Aside from querying,
1270@code{query-replace} works just like @code{replace-string} 1480@code{query-replace} works just like @code{replace-string}
1271(@pxref{Unconditional Replace}). In particular, it preserves case 1481(@pxref{Unconditional Replace}). In particular, it preserves case
1272provided @code{case-replace} is non-@code{nil}, as it normally is 1482provided @code{case-replace} is non-@code{nil}, as it normally is
1273(@pxref{Replacement and Case}). A numeric argument means to consider 1483(@pxref{Replacement and Lax Matches}). A numeric argument means to
1274only occurrences that are bounded by word-delimiter characters. A 1484consider only occurrences that are bounded by word-delimiter
1275negative prefix argument replaces backward. 1485characters. A negative prefix argument replaces backward.
1276 1486
1277@kindex C-M-% 1487@kindex C-M-%
1278@findex query-replace-regexp 1488@findex query-replace-regexp
@@ -1280,18 +1490,38 @@ negative prefix argument replaces backward.
1280It works like @code{replace-regexp} except that it queries 1490It works like @code{replace-regexp} except that it queries
1281like @code{query-replace}. 1491like @code{query-replace}.
1282 1492
1493@vindex query-replace-from-to-separator
1494 You can reuse earlier replacements with these commands. When
1495@code{query-replace} or @code{query-replace-regexp} prompts for the
1496search string, use @kbd{M-p} and @kbd{M-n} to show previous
1497replacements in the form @samp{@var{from} -> @var{to}}, where
1498@var{from} is the search pattern, @var{to} is its replacement, and the
1499separator between them is determined by the value of the variable
1500@code{query-replace-from-to-separator}. Type @key{RET} to select the
1501desired replacement.
1502
1283@cindex faces for highlighting query replace 1503@cindex faces for highlighting query replace
1284@cindex query-replace face 1504@cindex query-replace face
1285@cindex lazy-highlight face 1505@cindex lazy-highlight face, in replace
1506@vindex query-replace-highlight
1507@vindex query-replace-lazy-highlight
1508@vindex query-replace-show-replacement
1286 These commands highlight the current match using the face 1509 These commands highlight the current match using the face
1287@code{query-replace}. They highlight other matches using 1510@code{query-replace}. You can disable this highlight by setting the
1288@code{lazy-highlight} just like incremental search (@pxref{Incremental 1511variable @code{query-replace-highlight} to @code{nil}. They highlight
1289Search}). By default, @code{query-replace-regexp} will show the 1512other matches using @code{lazy-highlight} just like incremental search
1290substituted replacement string for the current match in the 1513(@pxref{Incremental Search}); this can be disabled by setting
1291minibuffer. If you want to keep special sequences @samp{\&} and 1514@code{query-replace-lazy-highlight} to @code{nil}. By default,
1292@samp{\@var{n}} unexpanded, customize 1515@code{query-replace-regexp} will show the substituted replacement
1516string for the current match in the minibuffer. If you want to keep
1517special sequences @samp{\&} and @samp{\@var{n}} unexpanded, customize
1293@code{query-replace-show-replacement} variable. 1518@code{query-replace-show-replacement} variable.
1294 1519
1520@vindex query-replace-skip-read-only
1521 The variable @code{query-replace-skip-read-only}, if set
1522non-@code{nil}, will cause replacement commands to ignore matches in
1523read-only text. The default is not to ignore them.
1524
1295 The characters you can type when you are shown a match for the string 1525 The characters you can type when you are shown a match for the string
1296or regexp are: 1526or regexp are:
1297 1527
@@ -1311,9 +1541,13 @@ or regexp are:
1311@c WideCommands 1541@c WideCommands
1312@table @kbd 1542@table @kbd
1313@item @key{SPC} 1543@item @key{SPC}
1544@itemx y
1314to replace the occurrence with @var{newstring}. 1545to replace the occurrence with @var{newstring}.
1315 1546
1316@item @key{DEL} 1547@item @key{DEL}
1548@itemx @key{Delete}
1549@itemx @key{BACKSPACE}
1550@itemx n
1317to skip to the next occurrence without replacing this one. 1551to skip to the next occurrence without replacing this one.
1318 1552
1319@item , @r{(Comma)} 1553@item , @r{(Comma)}
@@ -1329,6 +1563,7 @@ must use @kbd{C-x @key{ESC} @key{ESC} @key{RET}} to restart
1329(@pxref{Repetition}). 1563(@pxref{Repetition}).
1330 1564
1331@item @key{RET} 1565@item @key{RET}
1566@itemx q
1332to exit without doing any more replacements. 1567to exit without doing any more replacements.
1333 1568
1334@item .@: @r{(Period)} 1569@item .@: @r{(Period)}
@@ -1338,19 +1573,6 @@ occurrences.
1338@item ! 1573@item !
1339to replace all remaining occurrences without asking again. 1574to replace all remaining occurrences without asking again.
1340 1575
1341@item Y @r{(Upper-case)}
1342to replace all remaining occurrences in all remaining buffers in
1343multi-buffer replacements (like the Dired @key{Q} command that performs
1344query replace on selected files). It answers this question and all
1345subsequent questions in the series with ``yes'', without further
1346user interaction.
1347
1348@item N @r{(Upper-case)}
1349to skip to the next buffer in multi-buffer replacements without
1350replacing remaining occurrences in the current buffer. It answers
1351this question ``no'', gives up on the questions for the current buffer,
1352and continues to the next buffer in the sequence.
1353
1354@item ^ 1576@item ^
1355to go back to the position of the previous occurrence (or what used to 1577to go back to the position of the previous occurrence (or what used to
1356be an occurrence), in case you changed it by mistake or want to 1578be an occurrence), in case you changed it by mistake or want to
@@ -1378,19 +1600,30 @@ replacement string for any further occurrences.
1378to redisplay the screen. Then you must type another character to 1600to redisplay the screen. Then you must type another character to
1379specify what to do with this occurrence. 1601specify what to do with this occurrence.
1380 1602
1603@item Y @r{(Upper-case)}
1604to replace all remaining occurrences in all remaining buffers in
1605multi-buffer replacements (like the Dired @key{Q} command that performs
1606query replace on selected files). It answers this question and all
1607subsequent questions in the series with ``yes'', without further
1608user interaction.
1609
1610@item N @r{(Upper-case)}
1611to skip to the next buffer in multi-buffer replacements without
1612replacing remaining occurrences in the current buffer. It answers
1613this question ``no'', gives up on the questions for the current buffer,
1614and continues to the next buffer in the sequence.
1615
1381@item C-h 1616@item C-h
1617@itemx ?
1618@itemx @key{F1}
1382to display a message summarizing these options. Then you must type 1619to display a message summarizing these options. Then you must type
1383another character to specify what to do with this occurrence. 1620another character to specify what to do with this occurrence.
1384@end table 1621@end table
1385 1622
1386 Some other characters are aliases for the ones listed above: @kbd{y},
1387@kbd{n} and @kbd{q} are equivalent to @key{SPC}, @key{DEL} and
1388@key{RET}.
1389
1390 Aside from this, any other character exits the @code{query-replace}, 1623 Aside from this, any other character exits the @code{query-replace},
1391and is then reread as part of a key sequence. Thus, if you type 1624and is then reread as part of a key sequence. Thus, if you type
1392@kbd{C-k}, it exits the @code{query-replace} and then kills to end of 1625@kbd{C-k}, it exits the @code{query-replace} and then kills to end of
1393line. 1626line. In particular, @kbd{C-g} simply exits the @code{query-replace}.
1394 1627
1395 To restart a @code{query-replace} once it is exited, use @kbd{C-x 1628 To restart a @code{query-replace} once it is exited, use @kbd{C-x
1396@key{ESC} @key{ESC}}, which repeats the @code{query-replace} because it 1629@key{ESC} @key{ESC}}, which repeats the @code{query-replace} because it
@@ -1454,12 +1687,17 @@ a multi-file incremental search is activated automatically.
1454 1687
1455@cindex Occur mode 1688@cindex Occur mode
1456@cindex mode, Occur 1689@cindex mode, Occur
1690@cindex match (face name)
1691@vindex list-matching-lines-default-context-lines
1457@item M-x occur 1692@item M-x occur
1458Prompt for a regexp, and display a list showing each line in the 1693Prompt for a regexp, and display a list showing each line in the
1459buffer that contains a match for it. To limit the search to part of 1694buffer that contains a match for it. The text that matched is
1460the buffer, narrow to that part (@pxref{Narrowing}). A numeric 1695highlighted using the @code{match} face. To limit the search to part
1696of the buffer, narrow to that part (@pxref{Narrowing}). A numeric
1461argument @var{n} specifies that @var{n} lines of context are to be 1697argument @var{n} specifies that @var{n} lines of context are to be
1462displayed before and after each matching line. 1698displayed before and after each matching line. The default number of
1699context lines is specified by the variable
1700@code{list-matching-lines-default-context-lines}.
1463 1701
1464@kindex RET @r{(Occur mode)} 1702@kindex RET @r{(Occur mode)}
1465@kindex o @r{(Occur mode)} 1703@kindex o @r{(Occur mode)}
@@ -1526,3 +1764,89 @@ it never deletes lines that are only partially contained in the region
1526 1764
1527If a match is split across lines, this command keeps all those lines. 1765If a match is split across lines, this command keeps all those lines.
1528@end table 1766@end table
1767
1768@node Search Customizations
1769@section Tailoring Search to Your Needs
1770@cindex search customizations
1771
1772 This section describes miscellaneous search-related customizations
1773not described elsewhere.
1774
1775@cindex default search mode
1776@cindex search mode, default
1777 The default search mode for the incremental search is specified by
1778the variable @code{search-default-regexp-mode}. It can be @code{nil},
1779@code{t}, or a function. If it is @code{nil}, the default mode is to
1780do literal searches without character folding, but with case folding
1781and lax-whitespace matches as determined by @code{case-fold-search}
1782and @code{search-whitespace-regexp}, respectively (@pxref{Lax
1783Search}). If the value is @code{t}, incremental search defaults to
1784regexp searches. The default value specifies a function that causes
1785the default search mode to perform character folding in addition to
1786case folding and lax-whitespace matching.
1787
1788@vindex search-highlight
1789 The current match of an on-going incremental search is highlighted
1790using the @code{isearch} face. This highlighting can be disabled by
1791setting the variable @code{search-highlight} to a @code{nil} value.
1792
1793@cindex lazy highlighting customizations
1794@vindex isearch-lazy-highlight
1795@cindex lazy-highlight face
1796 The other matches for the search string that are visible on display
1797are highlighted using the @code{lazy-highlight} face. Setting the
1798variable @code{isearch-lazy-highlight} to a @code{nil} value disables
1799this highlighting. Here are some other variables that customize the
1800lazy highlighting:
1801
1802@table @code
1803@item lazy-highlight-initial-delay
1804Time in seconds to wait before highlighting visible matches.
1805
1806@item lazy-highlight-interval
1807Time in seconds between highlighting successive matches.
1808
1809@item lazy-highlight-max-at-a-time
1810The maximum number of matches to highlight before checking for input.
1811A large number can take some time to highlight, so if you want to
1812continue searching and type @kbd{C-s} or @kbd{C-r} during that time,
1813Emacs will not respond until it finishes highlighting all those
1814matches. Thus, smaller values make Emacs more responsive.
1815@end table
1816
1817@vindex search-nonincremental-instead
1818 Normally, entering @key{RET} within incremental search when the
1819search string is empty launches a nonincremental search. (Actually,
1820it lets you edit the search string, and the next @key{RET} does the
1821search.) However, if you customize the variable
1822@code{search-nonincremental-instead} to a @code{nil} value, typing
1823@key{RET} will always exit the incremental search, even if the search
1824string is empty.
1825
1826@vindex isearch-hide-immediately
1827 By default, incremental search and query-replace commands match
1828invisible text, but hide any such matches as soon as the current match
1829moves off the invisible text. If you customize the variable
1830@code{isearch-hide-immediately} to a @code{nil} value, any invisible
1831text where matches were found stays on display until the search or the
1832replace command exits.
1833
1834@cindex search display on slow terminals
1835@vindex search-slow-speed
1836@vindex search-slow-window-lines
1837 Searching incrementally on slow terminals, such as displays
1838connected to remote machines over slow connection, could be annoying
1839due to the need to redraw large portions of the display as the search
1840proceeds. Emacs provides a special display mode for slow terminals,
1841whereby search pops up a separate small window and displays the text
1842surrounding the match in that window. Small windows display faster,
1843so the annoying effect of slow speed is alleviated. The variable
1844@code{search-slow-speed} determines the baud rate threshold below
1845which Emacs will use this display mode. The variable
1846@code{search-slow-window-lines} controls the number of lines in the
1847window Emacs pops up for displaying the search results; the default is
18481 line. Normally, this window will pop up at the bottom of the window
1849that displays the buffer where you start searching, bit if the value
1850of @code{search-slow-window-lines} is negative, that means to put the
1851window at the top and give it the number of lines that is the absolute
1852value of that value.
diff --git a/etc/NEWS b/etc/NEWS
index 1a381ecfbdd..daa5003fb81 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -135,25 +135,6 @@ frames.
135Works for functions, variables, faces, etc. It is bound to `C-h o' by 135Works for functions, variables, faces, etc. It is bound to `C-h o' by
136default. 136default.
137 137
138** New user option `search-default-regexp-mode'
139specifies the default mode for I-search.
140
141** `isearch' and `query-replace' now perform character folding in matches.
142This is analogous to case folding, but instead of disregarding case
143variants, it disregards wider classes of distinctions between similar
144characters. (Case folding is a special case of character folding.)
145This means many characters in the search string will match entire
146groups of characters instead of just themselves.
147
148For instance, the " will match all variants of double quotes (like “
149and ”), and the letter a will match all of its accented cousins, even
150those composed of multiple characters, as well as many other symbols
151like ℀, ℁, ⒜, and ⓐ.
152
153** New function `character-fold-to-regexp' can be used
154by searching commands to produce a regexp matching anything that
155character-folds into STRING.
156
157** New command `checkdoc-package-keywords' checks if the 138** New command `checkdoc-package-keywords' checks if the
158current package keywords are recognized. Set the new option 139current package keywords are recognized. Set the new option
159`checkdoc-package-keywords-flag' to non-nil to make 140`checkdoc-package-keywords-flag' to non-nil to make
@@ -175,10 +156,6 @@ the `network-security-level' variable.
175 156
176** C-h l now also lists the commands that were run. 157** C-h l now also lists the commands that were run.
177 158
178---
179** The new M-s M-w key binding uses eww to search the web for the
180text in the region.
181
182** M-x suggests shorthands and ignores obsolete commands for completion. 159** M-x suggests shorthands and ignores obsolete commands for completion.
183** x-select-enable-clipboard is renamed select-enable-clipboard. 160** x-select-enable-clipboard is renamed select-enable-clipboard.
184x-select-enable-primary and renamed select-enable-primary. 161x-select-enable-primary and renamed select-enable-primary.
@@ -532,6 +509,36 @@ element. The new commands bound to <up> and <down> in the minibuffer:
532 509
533** Search and Replace 510** Search and Replace
534 511
512+++
513*** New user option `search-default-regexp-mode'
514specifies the default mode for I-search.
515
516+++
517*** `isearch' and `query-replace' can now perform character folding in matches.
518Isearch does that by default, while `query-replace' will do that if
519the new variable `replace-character-fold' is customized to a non-nil
520value. This is analogous to case folding, but instead of disregarding
521case variants, it disregards wider classes of distinctions between
522similar characters. (Case folding is a special case of character
523folding.) This means many characters in the search string will match
524entire groups of characters instead of just themselves.
525
526For instance, the " will match all variants of double quotes (like “
527and ”), and the letter a will match all of its accented cousins, even
528those composed of multiple characters, as well as many other symbols
529like ℀, ℁, ⒜, and ⓐ.
530
531+++
532*** New function `character-fold-to-regexp' can be used
533by searching commands to produce a regexp matching anything that
534character-folds into STRING.
535
536+++
537*** The new M-s M-w key binding uses eww to search the web for the
538text in the region. The search engine to use for this is specified by
539the customizable variable `eww-search-prefix'.
540
541+++
535*** Query-replace history is enhanced. 542*** Query-replace history is enhanced.
536When query-replace reads the FROM string from the minibuffer, typing 543When query-replace reads the FROM string from the minibuffer, typing
537`M-p' will now show previous replacements as "FROM SEP TO", where FROM 544`M-p' will now show previous replacements as "FROM SEP TO", where FROM
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 080eb578aa7..0a6b925d03e 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -96,8 +96,12 @@ in Isearch mode is always downcased."
96 96
97(defcustom search-nonincremental-instead t 97(defcustom search-nonincremental-instead t
98 "If non-nil, do a nonincremental search instead of exiting immediately. 98 "If non-nil, do a nonincremental search instead of exiting immediately.
99Actually, `isearch-edit-string' is called to let you enter the search 99This affects the behavior of `isearch-exit' and any key bound to that
100string, and RET terminates editing and does a nonincremental search." 100command: if this variable is nil, `isearch-exit' always exits the search;
101if the value is non-nil, and the search string is empty, `isearch-exit'
102starts a nonincremental search instead. (Actually, `isearch-edit-string'
103is called to let you enter the search string, and RET terminates editing
104and does a nonincremental search.)"
101 :type 'boolean) 105 :type 'boolean)
102 106
103(defcustom search-whitespace-regexp (purecopy "\\s-+") 107(defcustom search-whitespace-regexp (purecopy "\\s-+")
@@ -142,9 +146,11 @@ whenever point is in one of them."
142(defcustom isearch-hide-immediately t 146(defcustom isearch-hide-immediately t
143 "If non-nil, re-hide an invisible match right away. 147 "If non-nil, re-hide an invisible match right away.
144This variable makes a difference when `search-invisible' is set to `open'. 148This variable makes a difference when `search-invisible' is set to `open'.
149If non-nil, invisible matches are re-hidden as soon as the match moves
150off the invisible text surrounding the match.
145If nil then do not re-hide opened invisible text when the match moves. 151If nil then do not re-hide opened invisible text when the match moves.
146Whatever the value, all opened invisible text is hidden again after exiting 152Whatever the value, all opened invisible text is hidden again after exiting
147the search." 153the search, with the exception of the last successful match, if any."
148 :type 'boolean) 154 :type 'boolean)
149 155
150(defcustom isearch-resume-in-command-history nil 156(defcustom isearch-resume-in-command-history nil
diff --git a/lisp/replace.el b/lisp/replace.el
index 7727562cf31..a671a98b7a0 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -111,7 +111,8 @@ strings or patterns."
111 :version "22.1") 111 :version "22.1")
112 112
113(defcustom query-replace-show-replacement t 113(defcustom query-replace-show-replacement t
114 "Non-nil means to show what actual replacement text will be." 114 "Non-nil means show substituted replacement text in the minibuffer.
115This variable affects only `query-replace-regexp'."
115 :type 'boolean 116 :type 'boolean
116 :group 'matching 117 :group 'matching
117 :version "23.1") 118 :version "23.1")