*** empty log message ***
[bpt/emacs.git] / man / search.texi
index ef83260..1a8a637 100644 (file)
@@ -1,6 +1,6 @@
 @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 Free Software Foundation, Inc.
+@c   2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Search, Fixit, Display, Top
 @chapter Searching and Replacement
@@ -16,7 +16,14 @@ those of other editors.
   Besides the usual @code{replace-string} command that finds all
 occurrences of one string and replaces them with another, Emacs has a
 more flexible replacement command called @code{query-replace}, which
-asks interactively which occurrences to replace.
+asks interactively which occurrences to replace.  There are also
+commands to find and operate on all matches for a pattern.
+
+  You can also search multiple files under control of a tags
+table (@pxref{Tags Search}) or through the Dired @kbd{A} command
+(@pxref{Operating on Files}), or ask the @code{grep} program to do it
+(@pxref{Grep Searching}).
+
 
 @menu
 * Incremental Search::         Search happens as you type the string.
@@ -33,6 +40,8 @@ asks interactively which occurrences to replace.
 
 @node Incremental Search
 @section Incremental Search
+@cindex incremental search
+@cindex isearch
 
   An incremental search begins searching as soon as you type the first
 character of the search string.  As you type in the search string, Emacs
@@ -63,8 +72,6 @@ Incremental search backward (@code{isearch-backward}).
 
 @node Basic Isearch
 @subsection Basics of Incremental Search
-@cindex incremental search
-@cindex isearch
 
 @kindex C-s
 @findex isearch-forward
@@ -410,7 +417,7 @@ Search for @var{words}, ignoring details of punctuation.
 Search backward for @var{words}, ignoring details of punctuation.
 @end table
 
-  Word search is a special case of nonincremental search and is invoked
+  Word search as a special case of nonincremental search is invoked
 with @kbd{C-s @key{RET} C-w}.  This is followed by the search string,
 which must always be terminated with @key{RET}.  Being nonincremental,
 this search does not start until the argument is terminated.  It works
@@ -419,6 +426,13 @@ by constructing a regular expression and searching for that; see
 
   Use @kbd{C-r @key{RET} C-w} to do backward word search.
 
+  You can also invoke word search with @kbd{C-s M-e C-w} or @kbd{C-r
+M-e C-w} followed by the search string and terminated with @key{RET},
+@kbd{C-s} or @kbd{C-r}.  This puts word search into incremental mode
+where you can use all keys available for incremental search.  However,
+when you type more words in incremental word search, it will fail
+until you type complete words.
+
 @findex word-search-forward
 @findex word-search-backward
   Forward and backward word searches are implemented by the commands
@@ -474,6 +488,13 @@ search can make the cursor move back and start again.  For example, if
 you have searched for @samp{foo} and you add @samp{\|bar}, the cursor
 backs up in case the first @samp{bar} precedes the first @samp{foo}.
 
+  Forward and backward regexp search are not symmetrical, because
+regexp matching in Emacs always operates forward, starting with the
+beginning of the regexp.  Thus, forward regexp search scans forward,
+trying a forward match at each possible starting position.  Backward
+regexp search scans backward, trying a forward match at each possible
+starting position.  These search methods are not mirror images.
+
 @findex re-search-forward
 @findex re-search-backward
   Nonincremental search for a regexp is done by the functions
@@ -981,6 +1002,9 @@ C-@key{SPC}} to move back there.
   A numeric argument restricts replacement to matches that are surrounded
 by word boundaries.  The argument's value doesn't matter.
 
+  @xref{Replacement and Case}, for details about case-sensitivity in
+replace commands.
+
   What if you want to exchange @samp{x} and @samp{y}: replace every @samp{x} with a @samp{y} and vice versa?  You can do it this way:
 
 @example
@@ -1134,9 +1158,9 @@ This command finds occurrences of @samp{foo} one by one, displays each
 occurrence and asks you whether to replace it.  Aside from querying,
 @code{query-replace} works just like @code{replace-string}.  It
 preserves case, like @code{replace-string}, provided
-@code{case-replace} is non-@code{nil}, as it normally is.  A numeric
-argument means consider only occurrences that are bounded by
-word-delimiter characters.
+@code{case-replace} is non-@code{nil}, as it normally is
+(@pxref{Replacement and Case}).  A numeric argument means consider
+only occurrences that are bounded by word-delimiter characters.
 
 @kindex C-M-%
 @findex query-replace-regexp
@@ -1332,11 +1356,6 @@ 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
 
-  You can also search multiple files under control of a tags table
-(@pxref{Tags Search}) or through the Dired @kbd{A} command
-(@pxref{Operating on Files}), or ask the @code{grep} program to do it
-(@pxref{Grep Searching}).
-
 @ignore
    arch-tag: fd9d8e77-66af-491c-b212-d80999613e3e
 @end ignore