]> code.delx.au - gnu-emacs/blobdiff - doc/emacs/search.texi
* tramp.texi (Frequently Asked Questions): Explain, how to disable
[gnu-emacs] / doc / emacs / search.texi
index 1a8a6372ba226c3e113b59e2f840521710f129ac..979d6670f576f6bfc767cfba3a349fbf787f898f 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 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 Free Software Foundation, Inc.
+@c   2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Search, Fixit, Display, Top
 @chapter Searching and Replacement
 @c See file emacs.texi for copying conditions.
 @node Search, Fixit, Display, Top
 @chapter Searching and Replacement
@@ -105,11 +105,11 @@ special within searches (@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s},
 @kbd{C-y}, @kbd{M-y}, @kbd{M-r}, @kbd{M-c}, @kbd{M-e}, and some other
 meta-characters).
 
 @kbd{C-y}, @kbd{M-y}, @kbd{M-r}, @kbd{M-c}, @kbd{M-e}, and some other
 meta-characters).
 
-  When you exit the incremental search, it sets the mark where point
-@emph{was} before the search.  That is convenient for moving back
-there.  In Transient Mark mode, incremental search sets the mark
-without activating it, and does so only if the mark is not already
-active.
+  When you exit the incremental search, it adds the original value of
+point to the mark ring, without activating the mark.  You can thus use
+@kbd{C-@key{SPC}} to return to where you were before beginning the
+search.  @xref{Mark Ring}.  It only does this if the mark was not
+already active.
 
 @node Repeat Isearch
 @subsection Repeating Incremental Search
 
 @node Repeat Isearch
 @subsection Repeating Incremental Search
@@ -961,12 +961,11 @@ there is @kbd{M-%} (@code{query-replace}), which presents each occurrence
 of the pattern and asks you whether to replace it.
 
   The replace commands normally operate on the text from point to the
 of the pattern and asks you whether to replace it.
 
   The replace commands normally operate on the text from point to the
-end of the buffer; however, in Transient Mark mode (@pxref{Transient
-Mark}), when the mark is active, they operate on the region.  The
-basic replace commands replace one string (or regexp) with one
-replacement string.  It is possible to perform several replacements in
-parallel using the command @code{expand-region-abbrevs}
-(@pxref{Expanding Abbrevs}).
+end of the buffer.  When the mark is active, they operate on the
+region instead (@pxref{Mark}).  The basic replace commands replace one
+string (or regexp) with one replacement string.  It is possible to
+perform several replacements in parallel using the command
+@code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}).
 
 @menu
 * Unconditional Replace::      Replacing all matches for a string.
 
 @menu
 * Unconditional Replace::      Replacing all matches for a string.
@@ -991,13 +990,14 @@ point, so if you want to cover the whole buffer you must go to the
 beginning first.  All occurrences up to the end of the buffer are
 replaced; to limit replacement to part of the buffer, narrow to that
 part of the buffer before doing the replacement (@pxref{Narrowing}).
 beginning first.  All occurrences up to the end of the buffer are
 replaced; to limit replacement to part of the buffer, narrow to that
 part of the buffer before doing the replacement (@pxref{Narrowing}).
-In Transient Mark mode, when the region is active, replacement is
-limited to the region (@pxref{Transient Mark}).
+When the region is active, replacement is limited to the region
+(@pxref{Mark}).
 
   When @code{replace-string} exits, it leaves point at the last
 
   When @code{replace-string} exits, it leaves point at the last
-occurrence replaced.  It sets the mark to the prior position of point
-(where the @code{replace-string} command was issued); use @kbd{C-u
-C-@key{SPC}} to move back there.
+occurrence replaced.  It adds the prior position of point (where the
+@code{replace-string} command was issued) to the mark ring, without
+activating the mark; use @kbd{C-u C-@key{SPC}} to move back there.
+@xref{Mark Ring}.
 
   A numeric argument restricts replacement to matches that are surrounded
 by word boundaries.  The argument's value doesn't matter.
 
   A numeric argument restricts replacement to matches that are surrounded
 by word boundaries.  The argument's value doesn't matter.
@@ -1152,13 +1152,12 @@ Replace some matches for @var{regexp} with @var{newstring}.
 @kindex M-%
 @findex query-replace
   If you want to change only some of the occurrences of @samp{foo} to
 @kindex M-%
 @findex query-replace
   If you want to change only some of the occurrences of @samp{foo} to
-@samp{bar}, not all of them, then you cannot use an ordinary
-@code{replace-string}.  Instead, use @kbd{M-%} (@code{query-replace}).
+@samp{bar}, not all of them, use @kbd{M-%} (@code{query-replace}).
 This command finds occurrences of @samp{foo} one by one, displays each
 occurrence and asks you whether to replace it.  Aside from querying,
 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
+@code{query-replace} works just like @code{replace-string}
+(@pxref{Unconditional Replace}).  In particular, it preserves case
+provided @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.
 
 (@pxref{Replacement and Case}).  A numeric argument means consider
 only occurrences that are bounded by word-delimiter characters.
 
@@ -1172,7 +1171,11 @@ like @code{query-replace}.
   These commands highlight the current match using the face
 @code{query-replace}.  They highlight other matches using
 @code{lazy-highlight} just like incremental search (@pxref{Incremental
   These commands highlight the current match using the face
 @code{query-replace}.  They highlight other matches using
 @code{lazy-highlight} just like incremental search (@pxref{Incremental
-Search}).
+Search}).  By default, @code{query-replace-regexp} will show
+substituted replacement string for the current match in the
+minibuffer.  If you want to keep special sequences @samp{\&} and
+@samp{\@var{n}} unexpanded, customize
+@code{query-replace-show-replacement} variable.
 
   The characters you can type when you are shown a match for the string
 or regexp are:
 
   The characters you can type when you are shown a match for the string
 or regexp are:
@@ -1278,8 +1281,7 @@ replacing regexp matches in file names.
 expression.  They all ignore case in matching, if the pattern contains
 no upper-case letters and @code{case-fold-search} is non-@code{nil}.
 Aside from @code{occur} and its variants, all operate on the text from
 expression.  They all ignore case in matching, if the pattern contains
 no upper-case letters and @code{case-fold-search} is non-@code{nil}.
 Aside from @code{occur} and its variants, all operate on the text from
-point to the end of the buffer, or on the active region in Transient
-Mark mode.
+point to the end of the buffer, or on the region if it is active.
 
 @findex list-matching-lines
 @findex occur
 
 @findex list-matching-lines
 @findex occur
@@ -1329,16 +1331,16 @@ 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
 
 @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.  In Transient Mark mode, if the region is active, the
-command operates on the region instead.
+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},
 
 @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.  In Transient Mark mode,
-if the region is active, the command operates on the region instead;
-it deletes a line partially contained in the region if it contains a
-match entirely contained in the region.
+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.
 
 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
 
 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
@@ -1346,12 +1348,12 @@ 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}
 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.  In Transient
-Mark mode, 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).
+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).
 
 If a match is split across lines, this command keeps all those lines.
 @end table
 
 If a match is split across lines, this command keeps all those lines.
 @end table