aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2001-04-06 08:29:10 +0000
committerRichard M. Stallman2001-04-06 08:29:10 +0000
commitb20a1c885b9ea585bc30a25eab56f6639cb80768 (patch)
tree160afe1072281661cc02f5d69bfc0cfa6f74a4f3
parent0b9ad3522081d0d847fe4afd40dc7176d4cd669b (diff)
downloademacs-b20a1c885b9ea585bc30a25eab56f6639cb80768.tar.gz
emacs-b20a1c885b9ea585bc30a25eab56f6639cb80768.zip
Mention there are other search-terminating Meta chars.
Add xref for baud-rate. Explain why ^ in set must not be first. Clarify complemented set example. Clarify \s syntax characters and add xref. Update sentence-end example. Document M-c in isearch. Clarify query-replace preserving case.
-rw-r--r--man/search.texi79
1 files changed, 42 insertions, 37 deletions
diff --git a/man/search.texi b/man/search.texi
index 56b5f37710f..5ce8617f2ad 100644
--- a/man/search.texi
+++ b/man/search.texi
@@ -70,12 +70,13 @@ you want to erase. If you do not want to wait for this to happen, use
70 When you are satisfied with the place you have reached, you can type 70 When you are satisfied with the place you have reached, you can type
71@key{RET}, which stops searching, leaving the cursor where the search 71@key{RET}, which stops searching, leaving the cursor where the search
72brought it. Also, any command not specially meaningful in searches 72brought it. Also, any command not specially meaningful in searches
73stops the searching and is then executed. Thus, typing @kbd{C-a} would 73stops the searching and is then executed. Thus, typing @kbd{C-a}
74exit the search and then move to the beginning of the line. @key{RET} 74would exit the search and then move to the beginning of the line.
75is necessary only if the next command you want to type is a printing 75@key{RET} is necessary only if the next command you want to type is a
76character, @key{DEL}, @key{RET}, or another control character that is 76printing character, @key{DEL}, @key{RET}, or another character that is
77special within searches (@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s}, 77special within searches (@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s},
78@kbd{C-y}, @kbd{M-y}, @kbd{M-r}, or @kbd{M-s}). 78@kbd{C-y}, @kbd{M-y}, @kbd{M-r}, @kbd{M-s}, and some other
79meta-characters).
79 80
80 Sometimes you search for @samp{FOO} and find it, but not the one you 81 Sometimes you search for @samp{FOO} and find it, but not the one you
81expected to find. There was a second @samp{FOO} that you forgot 82expected to find. There was a second @samp{FOO} that you forgot
@@ -236,7 +237,7 @@ its new position of point.
236@vindex search-slow-speed 237@vindex search-slow-speed
237 The slow terminal style of display is used when the terminal baud rate is 238 The slow terminal style of display is used when the terminal baud rate is
238less than or equal to the value of the variable @code{search-slow-speed}, 239less than or equal to the value of the variable @code{search-slow-speed},
239initially 1200. 240initially 1200. See @code{baud-rate} in @ref{Display Custom}.
240 241
241@vindex search-slow-window-lines 242@vindex search-slow-window-lines
242 The number of lines to use in slow terminal search display is controlled 243 The number of lines to use in slow terminal search display is controlled
@@ -503,7 +504,7 @@ set, or put it after a range. Thus, @samp{[]-]} matches both @samp{]}
503and @samp{-}. 504and @samp{-}.
504 505
505To include @samp{^} in a set, put it anywhere but at the beginning of 506To include @samp{^} in a set, put it anywhere but at the beginning of
506the set. 507the set. (At the beginning, it complements the set---see below.)
507 508
508When you use a range in case-insensitive search, you should write both 509When you use a range in case-insensitive search, you should write both
509ends of the range in upper case, or both in lower case, or both should 510ends of the range in upper case, or both in lower case, or both should
@@ -513,7 +514,7 @@ is somewhat ill-defined, and it may change in future Emacs versions.
513@item [^ @dots{} ] 514@item [^ @dots{} ]
514@samp{[^} begins a @dfn{complemented character set}, which matches any 515@samp{[^} begins a @dfn{complemented character set}, which matches any
515character except the ones specified. Thus, @samp{[^a-z0-9A-Z]} matches 516character except the ones specified. Thus, @samp{[^a-z0-9A-Z]} matches
516all characters @emph{except} letters and digits. 517all characters @emph{except} ASCII letters and digits.
517 518
518@samp{^} is not special in a character set unless it is the first 519@samp{^} is not special in a character set unless it is the first
519character. The character following the @samp{^} is treated as if it 520character. The character following the @samp{^} is treated as if it
@@ -671,10 +672,9 @@ matches any character that is not a word-constituent.
671 672
672@item \s@var{c} 673@item \s@var{c}
673matches any character whose syntax is @var{c}. Here @var{c} is a 674matches any character whose syntax is @var{c}. Here @var{c} is a
674character that represents a syntax code: thus, @samp{w} for word 675character that designates a particular syntax class: thus, @samp{w}
675constituent, @samp{-} for whitespace, @samp{(} for open parenthesis, 676for word constituent, @samp{-} or @samp{ } for whitespace, @samp{.}
676etc. Represent a character of whitespace (which can be a newline) by 677for ordinary punctuation, etc. @xref{Syntax}.
677either @samp{-} or a space character.
678 678
679@item \S@var{c} 679@item \S@var{c}
680matches any character whose syntax is not @var{c}. 680matches any character whose syntax is not @var{c}.
@@ -696,25 +696,26 @@ matches any character that does @emph{not} belong to category
696 The constructs that pertain to words and syntax are controlled by the 696 The constructs that pertain to words and syntax are controlled by the
697setting of the syntax table (@pxref{Syntax}). 697setting of the syntax table (@pxref{Syntax}).
698 698
699 Here is a complicated regexp, used by Emacs to recognize the end of a 699 Here is a complicated regexp, stored in @code{sentence-end} and used
700sentence together with any whitespace that follows. It is given in Lisp 700by Emacs to recognize the end of a sentence together with any
701syntax to enable you to distinguish the spaces from the tab characters. In 701whitespace that follows. We show it Lisp syntax to distinguish the
702Lisp syntax, the string constant begins and ends with a double-quote. 702spaces from the tab characters. In Lisp syntax, the string constant
703@samp{\"} stands for a double-quote as part of the regexp, @samp{\\} for a 703begins and ends with a double-quote. @samp{\"} stands for a
704backslash as part of the regexp, @samp{\t} for a tab and @samp{\n} for a 704double-quote as part of the regexp, @samp{\\} for a backslash as part
705newline. 705of the regexp, @samp{\t} for a tab, and @samp{\n} for a newline.
706 706
707@example 707@example
708"[.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*" 708"[.?!][]\"')]*\\($\\| $\\|\t\\| \\)[ \t\n]*"
709@end example 709@end example
710 710
711@noindent 711@noindent
712This contains four parts in succession: a character set matching period, 712This contains four parts in succession: a character set matching
713@samp{?}, or @samp{!}; a character set matching close-brackets, quotes, 713period, @samp{?}, or @samp{!}; a character set matching
714or parentheses, repeated any number of times; an alternative in 714close-brackets, quotes, or parentheses, repeated zero or more times; a
715backslash-parentheses that matches end-of-line, a tab, or two spaces; 715set of alternatives within backslash-parentheses that matches either
716and a character set matching whitespace characters, repeated any number 716end-of-line, a space at the end of a line, a tab, or two spaces; and a
717of times. 717character set matching whitespace characters, repeated any number of
718times.
718 719
719 To enter the same regexp interactively, you would type @key{TAB} to 720 To enter the same regexp interactively, you would type @key{TAB} to
720enter a tab, and @kbd{C-j} to enter a newline. You would also type 721enter a tab, and @kbd{C-j} to enter a newline. You would also type
@@ -744,7 +745,6 @@ for matching parens.)
744@node Search Case, Replace, Regexps, Search 745@node Search Case, Replace, Regexps, Search
745@section Searching and Case 746@section Searching and Case
746 747
747@vindex case-fold-search
748 Incremental searches in Emacs normally ignore the case of the text 748 Incremental searches in Emacs normally ignore the case of the text
749they are searching through, if you specify the text in lower case. 749they are searching through, if you specify the text in lower case.
750Thus, if you specify searching for @samp{foo}, then @samp{Foo} and 750Thus, if you specify searching for @samp{foo}, then @samp{Foo} and
@@ -758,6 +758,12 @@ the search case-sensitive. Thus, searching for @samp{Foo} does not find
758well as to string search. The effect ceases if you delete the 758well as to string search. The effect ceases if you delete the
759upper-case letter from the search string. 759upper-case letter from the search string.
760 760
761 Typing @kbd{M-c} within an incremental search toggles the case
762sensitivity of that search. The effect does not extend beyond the
763current incremental search to the next one, but it does override the
764effect of including an upper-case letter in the current search.
765
766@vindex case-fold-search
761 If you set the variable @code{case-fold-search} to @code{nil}, then 767 If you set the variable @code{case-fold-search} to @code{nil}, then
762all letters must match exactly, including case. This is a per-buffer 768all letters must match exactly, including case. This is a per-buffer
763variable; altering the variable affects only the current buffer, but 769variable; altering the variable affects only the current buffer, but
@@ -906,20 +912,19 @@ Replace some matches for @var{regexp} with @var{newstring}.
906@samp{bar}, not all of them, then you cannot use an ordinary 912@samp{bar}, not all of them, then you cannot use an ordinary
907@code{replace-string}. Instead, use @kbd{M-%} (@code{query-replace}). 913@code{replace-string}. Instead, use @kbd{M-%} (@code{query-replace}).
908This command finds occurrences of @samp{foo} one by one, displays each 914This command finds occurrences of @samp{foo} one by one, displays each
909occurrence and asks you whether to replace it. A numeric argument to 915occurrence and asks you whether to replace it. Aside from querying,
910@code{query-replace} tells it to consider only occurrences that are 916@code{query-replace} works just like @code{replace-string}. It
911bounded by word-delimiter characters. This preserves case, just like 917preserves case, like @code{replace-string}, provided
912@code{replace-string}, provided @code{case-replace} is non-@code{nil}, 918@code{case-replace} is non-@code{nil}, as it normally is. A numeric
913as it normally is. 919argument means consider only occurrences that are bounded by
920word-delimiter characters.
914 921
915@kindex C-M-% 922@kindex C-M-%
916@findex query-replace-regexp 923@findex query-replace-regexp
917 Aside from querying, @code{query-replace} works just like 924 @kbd{C-M-%} performs regexp search and replace (@code{query-replace-regexp}).
918@code{replace-string}, and @code{query-replace-regexp} works just like
919@code{replace-regexp}. This command is run by @kbd{C-M-%}.
920 925
921 The things you can type when you are shown an occurrence of @var{string} 926 The characters you can type when you are shown a match for the string
922or a match for @var{regexp} are: 927or regexp are:
923 928
924@ignore @c Not worth it. 929@ignore @c Not worth it.
925@kindex SPC @r{(query-replace)} 930@kindex SPC @r{(query-replace)}