]> code.delx.au - gnu-emacs/blobdiff - doc/emacs/search.texi
* lisp/char-fold.el: Rename from character-fold.el.
[gnu-emacs] / doc / emacs / search.texi
index bcf1beaa3557bfc4c1aa8c34f8c988a1dbac2f85..d841934c8559b0fe131586d6fd54d9eb8350abfc 100644 (file)
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2015 Free Software
+@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2016 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Search
@@ -12,8 +12,8 @@ a string.  Emacs also has commands to replace occurrences of a string
 with a different string.  There are also commands that do the same
 thing, but search for patterns instead of fixed strings.
 
-  You can also search multiple files under the control of a tags table
-(@pxref{Tags Search}) or through the Dired @kbd{A} command
+  You can also search multiple files under the control of @code{xref}
+(@pxref{Identifier Search}) or through the Dired @kbd{A} command
 (@pxref{Operating on Files}), or ask the @code{grep} program to do it
 (@pxref{Grep Searching}).
 
@@ -26,7 +26,7 @@ thing, but search for patterns instead of fixed strings.
 * Regexps::                   Syntax of regular expressions.
 * Regexp Backslash::          Regular expression constructs starting with `\'.
 * Regexp Example::            A complex regular expression explained.
-* Lax Search::                Search ignores some distinctions between
+* Lax Search::                Search ignores some distinctions among
                                 similar characters, like letter-case.
 * Replace::                   Search, and replace some or all matches.
 * Other Repeating Search::    Operating on all matches for some regexp.
@@ -203,10 +203,10 @@ saved in the search ring is specified by the variable
 @cindex incremental search, edit search string
 @cindex interactively edit search string
 @kindex M-e @r{(Incremental search)}
-@kindex Mouse-1 @r{in the minibuffer (Incremental Search)}
+@kindex mouse-1 @r{in the minibuffer (Incremental Search)}
   To edit the current search string in the minibuffer without
 replacing it with items from the search ring, type @kbd{M-e} or click
-@kbd{Mouse-1} in the minibuffer.  Type @key{RET}, @kbd{C-s} or
+@kbd{mouse-1} in the minibuffer.  Type @key{RET}, @kbd{C-s} or
 @kbd{C-r} to finish editing the string and search for it.  Type
 @kbd{C-f} or @kbd{@key{RIGHT}} to add to the search string characters
 following point from the buffer from which you started the search.
@@ -234,7 +234,7 @@ end of a line, it appends the next line.  With a prefix argument
 
 @kindex C-y @r{(Incremental search)}
 @kindex M-y @r{(Incremental search)}
-@kindex Mouse-2 @r{in the minibuffer (Incremental search)}
+@kindex mouse-2 @r{in the minibuffer (Incremental search)}
 @findex isearch-yank-kill
 @findex isearch-yank-pop
 @findex isearch-yank-x-selection
@@ -242,7 +242,7 @@ end of a line, it appends the next line.  With a prefix argument
 appends the current kill to the search string.  @kbd{M-y}
 (@code{isearch-yank-pop}), if called after @kbd{C-y}, replaces that
 appended text with an earlier kill, similar to the usual @kbd{M-y}
-(@code{yank-pop}) command (@pxref{Yanking}).  Clicking @kbd{Mouse-2}
+(@code{yank-pop}) command (@pxref{Yanking}).  Clicking @kbd{mouse-2}
 in the echo area appends the current X selection (@pxref{Primary
 Selection}) to the search string (@code{isearch-yank-x-selection}).
 
@@ -548,6 +548,9 @@ command for nonincremental search, if the string you specify is empty.
 @key{RET}} does likewise, invoking the nonincremental
 backward-searching command.
 
+  Nonincremental search can also be invoked form the menu bar's
+@samp{Edit->Search} menu.
+
 @findex search-forward
 @findex search-backward
   You can also use two simpler commands, @kbd{M-x search-forward} and
@@ -607,6 +610,10 @@ so that the matching can proceed incrementally as you type.  This
 additional laxity does not apply to the lazy highlight
 (@pxref{Incremental Search}), which always matches whole words.
 
+  The word search commands don't perform character folding, and
+toggling lax whitespace matching (@pxref{Lax Search, lax space
+matching}) has no effect on them.
+
 @kindex M-s M-w
 @findex eww-search-word
 @vindex eww-search-prefix
@@ -663,6 +670,10 @@ search.  In nonincremental symbol searches, the beginning and end of
 the search string are required to match the beginning and end of a
 symbol, respectively.
 
+  The symbol search commands don't perform character folding, and
+toggling lax whitespace matching (@pxref{Lax Search, lax space
+matching}) has no effect on them.
+
 @node Regexp Search
 @section Regular Expression Search
 @cindex regexp search
@@ -709,13 +720,19 @@ regexps saved in the search ring is determined by the value of
 @code{regexp-search-ring-max}, 16 by default.
 
   Unlike ordinary incremental search, incremental regexp search
-do not use lax space matching by default.  To toggle this feature
+does not use lax space matching by default.  To toggle this feature
 use @kbd{M-s @key{SPC}} (@code{isearch-toggle-lax-whitespace}).
 Then any @key{SPC} typed in incremental regexp search will match
 any sequence of one or more whitespace characters.  The variable
 @code{search-whitespace-regexp} specifies the regexp for the lax
 space matching.  @xref{Special Isearch}.
 
+  Also unlike ordinary incremental search, incremental regexp search
+cannot use character folding (@pxref{Lax Search}).  (If you toggle
+character folding during incremental regexp search with @kbd{M-s '},
+the search becomes a non-regexp search and the search pattern you
+typed is interpreted as a literal string.)
+
   In some cases, adding characters to the regexp in an incremental
 regexp search can make the cursor move back and start again.  For
 example, if you have searched for @samp{foo} and you add @samp{\|bar},
@@ -1144,7 +1161,7 @@ close-brackets, quotes, or parentheses, repeated zero or more times.
 @cindex lax search
 @cindex character equivalence in search
   Normally, you'd want search commands to disregard certain minor
-differences between the search string you types and the text being
+differences between the search string you type and the text being
 searched.  For example, sequences of whitespace characters of
 different length are usually perceived as equivalent; letter-case
 differences usually don't matter; etc.  This is known as
@@ -1226,13 +1243,13 @@ apropos-variable @key{RET} case-fold-search @key{RET}}.
 
 @cindex character folding in search
 @cindex equivalent character sequences
-  Case folding disregards case distinctions between characters, making
+  Case folding disregards case distinctions among characters, making
 upper-case characters match lower-case variants, and vice versa.  A
 generalization of case folding is @dfn{character folding}, which
-disregards wider classes of distinctions between similar characters.
+disregards wider classes of distinctions among similar characters.
 For instance, under character folding the letter @code{a} matches all
 of its accented cousins like @code{@"a} and @code{@'a}, i.e., the
-match disregards the diacriticals that distinguish between these
+match disregards the diacritics that distinguish these
 variants.  In addition, @code{a} matches other characters that
 resemble it, or have it as part of their graphical representation,
 such as @sc{u+249c parenthesized latin small letter a} and @sc{u+2100
@@ -1247,15 +1264,16 @@ but match under character folding are known as @dfn{equivalent
 character sequences}.
 
 @kindex M-s ' @r{(Incremental Search)}
-@findex isearch-toggle-character-fold
-  Search commands in Emacs by default perform character folding, thus
-matching equivalent character sequences.  You can disable this
-behavior by customizing the variable @code{search-default-regexp-mode}
-to @code{nil}.  @xref{Search Customizations}.  Within an incremental
-search, typing @kbd{M-s '} (@code{isearch-toggle-character-fold})
-toggles character folding, but only for that search.  (Replace
-commands have a different default, controlled by a separate option;
-see @ref{Replacement and Lax Matches}.)
+@findex isearch-toggle-char-fold
+  Generally, search commands in Emacs do not by default perform
+character folding in order to match equivalent character sequences.
+You can enable this behavior by customizing the variable
+@code{search-default-mode} to @code{char-fold-to-regexp}.
+@xref{Search Customizations}.  Within an incremental search, typing
+@kbd{M-s '} (@code{isearch-toggle-char-fold}) toggles character
+folding, but only for that search.  (Replace commands have a different
+default, controlled by a separate option; see @ref{Replacement and Lax
+Matches}.)
 
   Like with case folding, typing an explicit variant of a character,
 such as @code{@"a}, as part of the search string disables character
@@ -1463,7 +1481,7 @@ replacement is done without case conversion.
 (@pxref{Lax Search, character folding}) when looking for the text to
 replace.  To enable character folding for matching in
 @code{query-replace} and @code{replace-string}, set the variable
-@code{replace-character-fold} to a non-@code{nil} value.  (This
+@code{replace-char-fold} to a non-@code{nil} value.  (This
 setting does not affect the replacement text, only how Emacs finds the
 text to replace.  It also doesn't affect @code{replace-regexp}.)
 
@@ -1782,15 +1800,14 @@ not described elsewhere.
 @cindex default search mode
 @cindex search mode, default
   The default search mode for the incremental search is specified by
-the variable @code{search-default-regexp-mode}.  It can be @code{nil},
+the variable @code{search-default-mode}.  It can be @code{nil},
 @code{t}, or a function.  If it is @code{nil}, the default mode is to
 do literal searches without character folding, but with case folding
 and lax-whitespace matches as determined by @code{case-fold-search}
 and @code{search-whitespace-regexp}, respectively (@pxref{Lax
 Search}).  If the value is @code{t}, incremental search defaults to
-regexp searches.  The default value specifies a function that causes
-the default search mode to perform character folding in addition to
-case folding and lax-whitespace matching.
+regexp searches.  The default value specifies a function that only
+performs case folding and lax-whitespace matching.
 
 @vindex search-highlight
   The current match of an on-going incremental search is highlighted