aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-10-19 00:21:52 -0400
committerChong Yidong2011-10-19 00:21:52 -0400
commit5abc31ef1857bf04852e4a0f4c599cd7460f4faa (patch)
tree6092681c422d9446c3b95c0af32587ddc77c4552
parent939db9ac789cadf11693fd7362aa6da65930be5b (diff)
downloademacs-5abc31ef1857bf04852e4a0f4c599cd7460f4faa.tar.gz
emacs-5abc31ef1857bf04852e4a0f4c599cd7460f4faa.zip
Update Search chapter in Emacs manual.
* doc/emacs/search.texi (Repeat Isearch, Error in Isearch): Add kindex entries. (Isearch Yank): Document isearch-yank-pop. (Isearch Scroll): Refer to C-l instead of unbound `recenter'. (Other Repeating Search): Document Occur Edit mode.
-rw-r--r--admin/FOR-RELEASE2
-rw-r--r--doc/emacs/ChangeLog8
-rw-r--r--doc/emacs/search.texi184
-rw-r--r--etc/NEWS3
4 files changed, 109 insertions, 88 deletions
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE
index df559785c2b..7b1b7df7704 100644
--- a/admin/FOR-RELEASE
+++ b/admin/FOR-RELEASE
@@ -191,7 +191,7 @@ programs.texi
191regs.texi cyd 191regs.texi cyd
192rmail.texi 192rmail.texi
193screen.texi cyd 193screen.texi cyd
194search.texi 194search.texi cyd
195sending.texi 195sending.texi
196text.texi 196text.texi
197trouble.texi 197trouble.texi
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 6e93e7a259e..63afcd228ad 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,11 @@
12011-10-19 Chong Yidong <cyd@gnu.org>
2
3 * search.texi (Repeat Isearch, Error in Isearch): Add kindex
4 entries.
5 (Isearch Yank): Document isearch-yank-pop.
6 (Isearch Scroll): Refer to C-l instead of unbound `recenter'.
7 (Other Repeating Search): Document Occur Edit mode.
8
12011-10-18 Chong Yidong <cyd@gnu.org> 92011-10-18 Chong Yidong <cyd@gnu.org>
2 10
3 * display.texi (Fringes): Move overflow-newline-into-fringe here, 11 * display.texi (Fringes): Move overflow-newline-into-fringe here,
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index 7290de1caab..8e77de0bbb4 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -166,23 +166,27 @@ going past the original starting point of the search, it changes to
166you have already seen. 166you have already seen.
167 167
168@cindex search ring 168@cindex search ring
169@kindex M-n @r{(Incremental search)}
170@kindex M-p @r{(Incremental search)}
169 To reuse earlier search strings, use the @dfn{search ring}. The 171 To reuse earlier search strings, use the @dfn{search ring}. The
170commands @kbd{M-p} and @kbd{M-n} move through the ring to pick a 172commands @kbd{M-p} and @kbd{M-n} move through the ring to pick a
171search string to reuse. These commands leave the selected search ring 173search string to reuse. These commands leave the selected search ring
172element in the minibuffer, where you can edit it. To edit the current 174element in the minibuffer, where you can edit it.
173search string in the minibuffer without replacing it with items from 175
174the search ring, type @kbd{M-e}. Type @kbd{C-s} or @kbd{C-r} to 176@kindex M-e @r{(Incremental search)}
175terminate editing the string and search for it. 177 To edit the current search string in the minibuffer without
178replacing it with items from the search ring, type @kbd{M-e}. Type
179@kbd{C-s} or @kbd{C-r} to finish editing the string and search for it.
176 180
177@node Error in Isearch 181@node Error in Isearch
178@subsection Errors in Incremental Search 182@subsection Errors in Incremental Search
179 183
180 If your string is not found at all, the echo area says @samp{Failing 184 If your string is not found at all, the echo area says @samp{Failing
181I-Search}. The cursor is after the place where Emacs found as much of 185I-Search}, and the cursor moves past the place where Emacs found as
182your string as it could. Thus, if you search for @samp{FOOT}, and 186much of your string as it could. Thus, if you search for @samp{FOOT},
183there is no @samp{FOOT}, you might see the cursor after the @samp{FOO} 187and there is no @samp{FOOT}, you might see the cursor after the
184in @samp{FOOL}. In the echo area, the part of the search string that 188@samp{FOO} in @samp{FOOL}. In the echo area, the part of the search
185failed to match is highlighted using the customizable face 189string that failed to match is highlighted using the face
186@code{isearch-fail}. 190@code{isearch-fail}.
187 191
188 At this point, there are several things you can do. If your string 192 At this point, there are several things you can do. If your string
@@ -195,6 +199,7 @@ search string the characters that could not be found (the @samp{T} in
195entirely, returning point to where it was when the search started. 199entirely, returning point to where it was when the search started.
196 200
197@cindex quitting (in search) 201@cindex quitting (in search)
202@kindex C-g @r{(Incremental search)}
198 The quit command, @kbd{C-g}, does special things during searches; 203 The quit command, @kbd{C-g}, does special things during searches;
199just what it does depends on the status of the search. If the search 204just what it does depends on the status of the search. If the search
200has found what you specified and is waiting for input, @kbd{C-g} 205has found what you specified and is waiting for input, @kbd{C-g}
@@ -270,62 +275,70 @@ keybindings. These keybindings are part of the keymap
270@node Isearch Yank 275@node Isearch Yank
271@subsection Isearch Yanking 276@subsection Isearch Yanking
272 277
278@kindex C-y @r{(Incremental search)}
279@kindex M-y @r{(Incremental search)}
280@findex isearch-yank-kill
281@findex isearch-yank-pop
273 Within incremental search, @kbd{C-y} (@code{isearch-yank-kill}) 282 Within incremental search, @kbd{C-y} (@code{isearch-yank-kill})
274copies text from the kill ring into the search string. It uses the 283appends the current kill to the search string. @kbd{M-y}
275same text that @kbd{C-y}, outside of incremental search, would 284(@code{isearch-yank-pop}), if called after @kbd{C-y}, replaces that
276normally yank into the buffer. @kbd{Mouse-2} in the echo area does 285appended text with an earlier kill, similar to the usual @kbd{M-y}
277the same. @xref{Yanking}. 286(@code{yank-pop}) command (@pxref{Yanking}). @kbd{Mouse-2} appends
278 287the current X selection (@pxref{Primary Selection}).
279 @kbd{C-w} (@code{isearch-yank-word-or-char}) grabs the next 288
280character or word at point, and adds it to the search string. This is 289@kindex C-w @r{(Incremental search)}
281convenient for searching for another occurrence of the text at point. 290@findex isearch-yank-word-or-char
282(The decision, whether to copy a character or a word, is heuristic.) 291 @kbd{C-w} (@code{isearch-yank-word-or-char}) appends the next
283 292character or word at point to the search string. This is an easy way
284 Similarly, @kbd{M-s C-e} (@code{isearch-yank-line}) grabs the rest 293to search for another occurrence of the text at point. (The decision
285of the current line, and adds it to the search string. If point is 294of whether to copy a character or a word is heuristic.)
286already at the end of a line, it grabs the entire next line. 295
296@kindex M-s C-e @r{(Incremental search)}
297@findex isearch-yank-line
298 Similarly, @kbd{M-s C-e} (@code{isearch-yank-line}) appends the rest
299of the current line to the search string. If point is already at the
300end of a line, it appends the next line.
287 301
288 If the search is currently case-insensitive, both @kbd{C-w} and 302 If the search is currently case-insensitive, both @kbd{C-w} and
289@kbd{M-s C-e} convert the text they copy to lower case, so that the 303@kbd{M-s C-e} convert the text they copy to lower case, so that the
290search remains case-insensitive. 304search remains case-insensitive.
291 305
292 @kbd{C-M-w} and @kbd{C-M-y} modify the search string by only one 306@kindex C-M-w @r{(Incremental search)}
293character at a time: @kbd{C-M-w} deletes the last character from the 307@kindex C-M-y @r{(Incremental search)}
294search string and @kbd{C-M-y} copies the character after point to the 308@findex isearch-del-char
295end of the search string. An alternative method to add the character 309@findex isearch-yank-char
296after point into the search string is to enter the minibuffer by 310 @kbd{C-M-w} (@code{isearch-del-char}) deletes the last character
297@kbd{M-e} and to type @kbd{C-f} at the end of the search string in the 311from the search string, and @kbd{C-M-y} (@code{isearch-yank-char})
298minibuffer. 312appends the character after point to the the search string. An
313alternative method to add the character after point is to enter the
314minibuffer with @kbd{M-e} (@pxref{Repeat Isearch}) and type @kbd{C-f}
315at the end of the search string in the minibuffer.
299 316
300@node Isearch Scroll 317@node Isearch Scroll
301@subsection Scrolling During Incremental Search 318@subsection Scrolling During Incremental Search
302 319
303@vindex isearch-allow-scroll 320@vindex isearch-allow-scroll
304 You can enable the use of vertical scrolling during incremental 321 Normally, scrolling commands exit incremental search. If you change
305search (without exiting the search) by setting the customizable 322the variable @code{isearch-allow-scroll} to a non-@code{nil} value,
306variable @code{isearch-allow-scroll} to a non-@code{nil} value. This 323that enables the use of the scroll-bar, as well as keyboard scrolling
307applies to using the vertical scroll-bar and to certain keyboard 324commands like @kbd{C-v}, @kbd{M-v}, and @kbd{C-l} (@pxref{Scrolling}).
308commands such as @code{scroll-down-command}, @code{scroll-up-command} 325This applies only to calling these commands via their bound key
309and @code{recenter} (@pxref{Scrolling}). You must run these commands 326sequences---typing @kbd{M-x} will still exit the search. You can give
310via their key sequences to stay in the search---typing @kbd{M-x} will 327prefix arguments to these commands in the usual way. This feature
311terminate the search. You can give prefix arguments to these commands 328won't let you scroll the current match out of visibility, however.
312in the usual way. 329
313 330 The @code{isearch-allow-scroll} feature also affects some other
314 This feature won't let you scroll the current match out of visibility, 331commands, such as @kbd{C-x 2} (@code{split-window-vertically}) and
315however. 332@kbd{C-x ^} (@code{enlarge-window}), which don't exactly scroll but do
316 333affect where the text appears on the screen. It applies to any
317 The feature also affects some other commands, such as @kbd{C-x 2} 334command whose name has a non-@code{nil} @code{isearch-scroll}
318(@code{split-window-vertically}) and @kbd{C-x ^} 335property. So you can control which commands are affected by changing
319(@code{enlarge-window}) which don't exactly scroll but do affect where 336these properties.
320the text appears on the screen. In general, it applies to any command
321whose name has a non-@code{nil} @code{isearch-scroll} property. So you
322can control which commands are affected by changing these properties.
323 337
324 For example, to make @kbd{C-h l} usable within an incremental search 338 For example, to make @kbd{C-h l} usable within an incremental search
325in all future Emacs sessions, use @kbd{C-h c} to find what command it 339in all future Emacs sessions, use @kbd{C-h c} to find what command it
326runs. (You type @kbd{C-h c C-h l}; it says @code{view-lossage}.) 340runs (@pxref{Key Help}), which is @code{view-lossage}. Then you can
327Then you can put the following line in your @file{.emacs} file 341put the following line in your init file (@pxref{Init File}):
328(@pxref{Init File}):
329 342
330@example 343@example
331(put 'view-lossage 'isearch-scroll t) 344(put 'view-lossage 'isearch-scroll t)
@@ -380,18 +393,14 @@ This enters the minibuffer to read the search string; terminate the
380string with @key{RET}, and then the search takes place. If the string 393string with @key{RET}, and then the search takes place. If the string
381is not found, the search command signals an error. 394is not found, the search command signals an error.
382 395
383 When you type @kbd{C-s @key{RET}}, the @kbd{C-s} invokes incremental
384search as usual. That command is specially programmed to invoke
385nonincremental search, @code{search-forward}, if the string you
386specify is empty. (Such an empty argument would otherwise be
387useless.) @kbd{C-r @key{RET}} does likewise, for a reverse
388incremental search.
389
390@findex search-forward 396@findex search-forward
391@findex search-backward 397@findex search-backward
392 Forward and backward nonincremental searches are implemented by the 398 When you type @kbd{C-s @key{RET}}, the @kbd{C-s} invokes incremental
393commands @code{search-forward} and @code{search-backward}. These 399search as usual. That command is specially programmed to invoke the
394commands may be bound to other keys in the usual manner. 400command for nonincremental search, @code{search-forward}, if the
401string you specify is empty. (Such an empty argument would otherwise
402be useless.) @kbd{C-r @key{RET}} does likewise, invoking the command
403@code{search-backward}.
395 404
396@node Word Search 405@node Word Search
397@section Word Search 406@section Word Search
@@ -451,7 +460,7 @@ apply to the lazy highlight, which always matches whole words.
451that denotes a class of alternative strings to match. GNU Emacs 460that denotes a class of alternative strings to match. GNU Emacs
452provides both incremental and nonincremental ways to search for a 461provides both incremental and nonincremental ways to search for a
453match for a regexp. The syntax of regular expressions is explained in 462match for a regexp. The syntax of regular expressions is explained in
454the following section. 463the next section.
455 464
456@table @kbd 465@table @kbd
457@item C-M-s 466@item C-M-s
@@ -506,7 +515,7 @@ starting position. These search methods are not mirror images.
506 515
507@findex re-search-forward 516@findex re-search-forward
508@findex re-search-backward 517@findex re-search-backward
509 Nonincremental search for a regexp is done by the functions 518 Nonincremental search for a regexp is done with the commands
510@code{re-search-forward} and @code{re-search-backward}. You can 519@code{re-search-forward} and @code{re-search-backward}. You can
511invoke these with @kbd{M-x}, or by way of incremental regexp search 520invoke these with @kbd{M-x}, or by way of incremental regexp search
512with @kbd{C-M-s @key{RET}} and @kbd{C-M-r @key{RET}}. 521with @kbd{C-M-s @key{RET}} and @kbd{C-M-r @key{RET}}.
@@ -916,9 +925,9 @@ close-brackets, quotes, or parentheses, repeated zero or more times.
916 Searches in Emacs normally ignore the case of the text they are 925 Searches in Emacs normally ignore the case of the text they are
917searching through, if you specify the text in lower case. Thus, if 926searching through, if you specify the text in lower case. Thus, if
918you specify searching for @samp{foo}, then @samp{Foo} and @samp{foo} 927you specify searching for @samp{foo}, then @samp{Foo} and @samp{foo}
919are also considered a match. Regexps, and in particular character 928also match. Regexps, and in particular character sets, behave
920sets, are included: @samp{[ab]} would match @samp{a} or @samp{A} or 929likewise: @samp{[ab]} matches @samp{a} or @samp{A} or @samp{b} or
921@samp{b} or @samp{B}.@refill 930@samp{B}.@refill
922 931
923 An upper-case letter anywhere in the incremental search string makes 932 An upper-case letter anywhere in the incremental search string makes
924the search case-sensitive. Thus, searching for @samp{Foo} does not find 933the search case-sensitive. Thus, searching for @samp{Foo} does not find
@@ -960,8 +969,8 @@ command, there is @kbd{M-%} (@code{query-replace}), which presents
960each occurrence of the pattern and asks you whether to replace it. 969each occurrence of the pattern and asks you whether to replace it.
961 970
962 The replace commands normally operate on the text from point to the 971 The replace commands normally operate on the text from point to the
963end of the buffer. When the mark is active, they operate on the 972end of the buffer. When the region is active, they operate on it
964region instead (@pxref{Mark}). The basic replace commands replace one 973instead (@pxref{Mark}). The basic replace commands replace one
965@dfn{search string} (or regexp) with one @dfn{replacement string}. It 974@dfn{search string} (or regexp) with one @dfn{replacement string}. It
966is possible to perform several replacements in parallel, using the 975is possible to perform several replacements in parallel, using the
967command @code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}). 976command @code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}).
@@ -998,7 +1007,7 @@ activating the mark; use @kbd{C-u C-@key{SPC}} to move back there.
998@xref{Mark Ring}. 1007@xref{Mark Ring}.
999 1008
1000 A prefix argument restricts replacement to matches that are 1009 A prefix argument restricts replacement to matches that are
1001surrounded by word boundaries. The argument's value doesn't matter. 1010surrounded by word boundaries.
1002 1011
1003 @xref{Replacement and Case}, for details about case-sensitivity in 1012 @xref{Replacement and Case}, for details about case-sensitivity in
1004replace commands. 1013replace commands.
@@ -1128,10 +1137,8 @@ replacement is done without case conversion.
1128 1137
1129@table @kbd 1138@table @kbd
1130@item M-% @var{string} @key{RET} @var{newstring} @key{RET} 1139@item M-% @var{string} @key{RET} @var{newstring} @key{RET}
1131@itemx M-x query-replace @key{RET} @var{string} @key{RET} @var{newstring} @key{RET}
1132Replace some occurrences of @var{string} with @var{newstring}. 1140Replace some occurrences of @var{string} with @var{newstring}.
1133@item C-M-% @var{regexp} @key{RET} @var{newstring} @key{RET} 1141@item C-M-% @var{regexp} @key{RET} @var{newstring} @key{RET}
1134@itemx M-x query-replace-regexp @key{RET} @var{regexp} @key{RET} @var{newstring} @key{RET}
1135Replace some matches for @var{regexp} with @var{newstring}. 1142Replace some matches for @var{regexp} with @var{newstring}.
1136@end table 1143@end table
1137 1144
@@ -1144,7 +1151,7 @@ occurrence and asks you whether to replace it. Aside from querying,
1144@code{query-replace} works just like @code{replace-string} 1151@code{query-replace} works just like @code{replace-string}
1145(@pxref{Unconditional Replace}). In particular, it preserves case 1152(@pxref{Unconditional Replace}). In particular, it preserves case
1146provided @code{case-replace} is non-@code{nil}, as it normally is 1153provided @code{case-replace} is non-@code{nil}, as it normally is
1147(@pxref{Replacement and Case}). A numeric argument means consider 1154(@pxref{Replacement and Case}). A numeric argument means to consider
1148only occurrences that are bounded by word-delimiter characters. 1155only occurrences that are bounded by word-delimiter characters.
1149 1156
1150@kindex C-M-% 1157@kindex C-M-%
@@ -1157,7 +1164,7 @@ like @code{query-replace}.
1157 These commands highlight the current match using the face 1164 These commands highlight the current match using the face
1158@code{query-replace}. They highlight other matches using 1165@code{query-replace}. They highlight other matches using
1159@code{lazy-highlight} just like incremental search (@pxref{Incremental 1166@code{lazy-highlight} just like incremental search (@pxref{Incremental
1160Search}). By default, @code{query-replace-regexp} will show 1167Search}). By default, @code{query-replace-regexp} will show the
1161substituted replacement string for the current match in the 1168substituted replacement string for the current match in the
1162minibuffer. If you want to keep special sequences @samp{\&} and 1169minibuffer. If you want to keep special sequences @samp{\&} and
1163@samp{\@var{n}} unexpanded, customize 1170@samp{\@var{n}} unexpanded, customize
@@ -1290,6 +1297,8 @@ matching that regexp.
1290This command is just like @code{multi-isearch-buffers}, except it 1297This command is just like @code{multi-isearch-buffers}, except it
1291performs an incremental regexp search. 1298performs an incremental regexp search.
1292 1299
1300@cindex Occur mode
1301@cindex mode, Occur
1293@item M-x occur 1302@item M-x occur
1294Prompt for a regexp, and display a list showing each line in the 1303Prompt for a regexp, and display a list showing each line in the
1295buffer that contains a match for it. To limit the search to part of 1304buffer that contains a match for it. To limit the search to part of
@@ -1300,16 +1309,22 @@ displayed before and after each matching line.
1300@kindex RET @r{(Occur mode)} 1309@kindex RET @r{(Occur mode)}
1301@kindex o @r{(Occur mode)} 1310@kindex o @r{(Occur mode)}
1302@kindex C-o @r{(Occur mode)} 1311@kindex C-o @r{(Occur mode)}
1303The buffer @samp{*Occur*} containing the output serves as a menu for 1312In the @samp{*Occur*} buffer, you can click on each entry, or move
1304finding the occurrences in their original context. Click 1313point there and type @key{RET}, to visit the corresponding position in
1305@kbd{Mouse-2} on an occurrence listed in @samp{*Occur*}, or position 1314the buffer that was searched. @kbd{o} and @kbd{C-o} display the match
1306point there and type @key{RET}; this switches to the buffer that was 1315in another window; @kbd{C-o} does not select it. Alternatively, you
1307searched and moves point to the original of the chosen occurrence. 1316can use the @kbd{C-x `} (@code{next-error}) command to visit the
1308@kbd{o} and @kbd{C-o} display the match in another window; @kbd{C-o} 1317occurrences one by one (@pxref{Compilation Mode}).
1309does not select it. 1318
1310 1319@cindex Occur Edit mode
1311After using @kbd{M-x occur}, you can use @code{next-error} to visit 1320@cindex mode, Occur Edit
1312the occurrences found, one by one. @ref{Compilation Mode}. 1321Typing @kbd{e} in the @samp{*Occur*} buffer switches to Occur Edit
1322mode, in which edits made to the entries are also applied to the text
1323in the originating buffer. Type @kbd{C-c C-c} to return to Occur
1324mode.
1325
1326The command @kbd{M-x list-matching-lines} is a synonym for @kbd{M-x
1327occur}.
1313 1328
1314@kindex M-s o 1329@kindex M-s o
1315@item M-s o 1330@item M-s o
@@ -1317,9 +1332,6 @@ Run @code{occur} using the search string of the last incremental
1317string search. You can also run @kbd{M-s o} when an incremental 1332string search. You can also run @kbd{M-s o} when an incremental
1318search is active; this uses the current search string. 1333search is active; this uses the current search string.
1319 1334
1320@item M-x list-matching-lines
1321Synonym for @kbd{M-x occur}.
1322
1323@item M-x multi-occur 1335@item M-x multi-occur
1324This command is just like @code{occur}, except it is able to search 1336This command is just like @code{occur}, except it is able to search
1325through multiple buffers. It asks you to specify the buffer names one 1337through multiple buffers. It asks you to specify the buffer names one
diff --git a/etc/NEWS b/etc/NEWS
index edb7f2c171d..b987e8548cf 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -448,7 +448,7 @@ pops up *Messages*" feature, which can now easily be changed.
448+++ 448+++
449*** C-y in Isearch is now bound to isearch-yank-kill, instead of 449*** C-y in Isearch is now bound to isearch-yank-kill, instead of
450isearch-yank-line. 450isearch-yank-line.
451--- 451+++
452*** M-y in Isearch is now bound to isearch-yank-pop, instead of 452*** M-y in Isearch is now bound to isearch-yank-pop, instead of
453isearch-yank-kill. 453isearch-yank-kill.
454+++ 454+++
@@ -883,6 +883,7 @@ They are superseded by shift-select-mode enabled by default in 23.1.
883 883
884* New Modes and Packages in Emacs 24.1 884* New Modes and Packages in Emacs 24.1
885 885
886+++
886** Occur Edit mode applies edits made in *Occur* buffers to the 887** Occur Edit mode applies edits made in *Occur* buffers to the
887original buffers. It is bound to "e" in Occur mode. 888original buffers. It is bound to "e" in Occur mode.
888 889