@c This is part of the Emacs manual.
@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001, 2002,
-@c 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+@c 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Search, Fixit, Display, Top
@chapter Searching and Replacement
@subsection Basics of Incremental Search
@table @kbd
-@item C-s
+@item C-s
Begin incremental search (@code{isearch-forward}).
@item C-r
Begin reverse incremental search (@code{isearch-backward}).
@node Isearch Scroll
@subsection Scrolling During Incremental Search
+@vindex isearch-allow-scroll
You can enable the use of vertical scrolling during incremental
search (without exiting the search) by setting the customizable
variable @code{isearch-allow-scroll} to a non-@code{nil} value. This
applies to using the vertical scroll-bar and to certain keyboard
-commands such as @kbd{@key{PRIOR}} (@code{scroll-down}),
-@kbd{@key{NEXT}} (@code{scroll-up}) and @kbd{C-l} (@code{recenter}).
-You must run these commands via their key sequences to stay in the
-search---typing @kbd{M-x} will terminate the search. You can give
-prefix arguments to these commands in the usual way.
+commands such as @key{prior} (@code{scroll-down}), @key{next}
+(@code{scroll-up}) and @kbd{C-l} (@code{recenter}). You must run
+these commands via their key sequences to stay in the search---typing
+@kbd{M-x} will terminate the search. You can give prefix arguments to
+these commands in the usual way.
This feature won't let you scroll the current match out of visibility,
however.
If incremental search is active, toggle word search mode
(@code{isearch-toggle-word}); otherwise, begin an incremental forward
word search (@code{isearch-forward-word}).
-@item C-s @key{RET} C-w
-Begin a non-incremental forward word search.
-@item C-r @key{RET} C-w
-Begin a non-incremental backward word search.
+@item M-s w @key{RET} @var{words} @key{RET}
+Search for @var{words}, using a forward nonincremental word search.
+@item M-s w C-r @key{RET} @var{words} @key{RET}
+Search backward for @var{words}, using a nonincremental word search.
@end table
+@kindex M-s w
+@findex isearch-forward-word
To begin a forward incremental word search, type @kbd{M-s w}. If
incremental search is not already active, this runs the command
@code{isearch-forward-word}. If incremental search is already active
@findex word-search-forward
@findex word-search-backward
- To begin a nonincremental word search, type @kbd{C-s @key{RET} C-w}
-for a forward search or @kbd{C-r @key{RET} C-w} for a forward search.
+ To begin a nonincremental word search, type @kbd{M-s w @key{RET}}
+for a forward search, or @kbd{M-s w C-r @key{RET}} for a backward search.
These run the commands @code{word-search-forward} and
@code{word-search-backward} respectively.
match for a regexp. The syntax of regular expressions is explained in
the following section.
+@table @kbd
+@item C-M-s
+Begin incremental regexp search (@code{isearch-forward-regexp}).
+@item C-M-r
+Begin reverse incremental regexp search (@code{isearch-backward-regexp}).
+@end table
+
@kindex C-M-s
@findex isearch-forward-regexp
@kindex C-M-r
search.
@vindex case-fold-search
-@vindex default-case-fold-search
If you set the variable @code{case-fold-search} to @code{nil}, then
all letters must match exactly, including case. This is a per-buffer
-variable; altering the variable affects only the current buffer, but
-there is a default value in @code{default-case-fold-search} that you
-can also set. @xref{Locals}. This variable applies to nonincremental
-searches also, including those performed by the replace commands
-(@pxref{Replace}) and the minibuffer history matching commands
-(@pxref{Minibuffer History}).
+variable; altering the variable normally affects only the current buffer,
+unless you change its default value. @xref{Locals}.
+This variable applies to nonincremental searches also, including those
+performed by the replace commands (@pxref{Replace}) and the minibuffer
+history matching commands (@pxref{Minibuffer History}).
Several related variables control case-sensitivity of searching and
matching for specific commands or activities. For instance,
@findex keep-lines
@table @kbd
-@item M-x occur @key{RET} @var{regexp} @key{RET}
-Display a list showing each line in the buffer that contains a match
-for @var{regexp}. To limit the search to part of the buffer, narrow
-to that part (@pxref{Narrowing}). A numeric argument @var{n}
-specifies that @var{n} lines of context are to be displayed before and
-after each matching line. Currently, @code{occur} can not correctly
-handle multiline matches.
+@item M-x multi-isearch-buffers
+Prompt for one or more buffer names, ending with @key{RET}; then,
+begin a multi-buffer incremental search in those buffers. (If the
+search fails in one buffer, the next @kbd{C-s} tries searching the
+next specified buffer, and so forth.) With a prefix argument, prompt
+for a regexp and begin a multi-buffer incremental search in buffers
+matching that regexp.
+
+@item M-x multi-isearch-buffers-regexp
+This command is just like @code{multi-isearch-buffers}, except it
+performs an incremental regexp search.
+
+@item M-x occur
+Prompt for a regexp, and display a list showing each line in the
+buffer that contains a match for it. To limit the search to part of
+the buffer, narrow to that part (@pxref{Narrowing}). A numeric
+argument @var{n} specifies that @var{n} lines of context are to be
+displayed before and after each matching line. Currently,
+@code{occur} can not correctly handle multiline matches.
@kindex RET @r{(Occur mode)}
@kindex o @r{(Occur mode)}
@kindex M-s o
@item M-s o
Run @code{occur} using the search string of the last incremental
-string search. You can also run @kbd{M-s o} which an incremental
+string search. You can also run @kbd{M-s o} when an incremental
search is active; this uses the current search string.
@item M-x list-matching-lines
Synonym for @kbd{M-x occur}.
-@item M-x multi-occur @key{RET} @var{buffers} @key{RET} @var{regexp} @key{RET}
-This function is just like @code{occur}, except it is able to search
-through multiple buffers. It asks you to specify the buffer names one by one.
-
-@item M-x multi-occur-in-matching-buffers @key{RET} @var{bufregexp} @key{RET} @var{regexp} @key{RET}
-This function is similar to @code{multi-occur}, except the buffers to
-search are specified by a regular expression that matches visited
-file names. With a prefix argument, it uses the regular expression to match
-buffer names instead.
-
-@item M-x how-many @key{RET} @var{regexp} @key{RET}
-Print the number of matches for @var{regexp} that exist in the buffer
-after point. If the region is active, this operates on the region
-instead.
-
-@item M-x flush-lines @key{RET} @var{regexp} @key{RET}
-This command deletes each line that contains a match for @var{regexp},
-operating on the text after point; it deletes the current line if it
-contains a match starting after point. If the region is active, it
-operates on the region instead; if a line partially contained in the
-region contains a match entirely contained in the region, it is
-deleted.
+@item M-x multi-occur
+This command is just like @code{occur}, except it is able to search
+through multiple buffers. It asks you to specify the buffer names one
+by one.
+
+@item M-x multi-occur-in-matching-buffers
+This command is similar to @code{multi-occur}, except the buffers to
+search are specified by a regular expression that matches visited file
+names. With a prefix argument, it uses the regular expression to
+match buffer names instead.
+
+@item M-x how-many
+Prompt for a regexp, and print the number of matches for it in the
+buffer after point. If the region is active, this operates on the
+region instead.
+
+@item M-x flush-lines
+Prompt for a regexp, and delete each line that contains a match for
+it, operating on the text after point. This command deletes the
+current line if it contains a match starting after point. If the
+region is active, it operates on the region instead; if a line
+partially contained in the region contains a match entirely contained
+in the region, it is deleted.
If a match is split across lines, @code{flush-lines} deletes all those
lines. It deletes the lines before starting to look for the next
match; hence, it ignores a match starting on the same line at which
another match ended.
-@item M-x keep-lines @key{RET} @var{regexp} @key{RET}
-This command deletes each line that @emph{does not} contain a match
-for @var{regexp}, operating on the text after point; if point is not
-at the beginning of a line, it always keeps the current line. If the
-region is active, the command operates on the region instead; it never
-deletes lines that are only partially contained in the region (a
-newline that ends a line counts as part of that line).
+@item M-x keep-lines
+Prompt for a regexp, and delete each line that @emph{does not} contain
+a match for it, operating on the text after point. If point is not at
+the beginning of a line, this command always keeps the current line.
+If the region is active, the command operates on the region instead;
+it never deletes lines that are only partially contained in the region
+(a newline that ends a line counts as part of that line).
If a match is split across lines, this command keeps all those lines.
@end table