entered into RCS
authorRichard M. Stallman <rms@gnu.org>
Sun, 7 Aug 1994 00:25:52 +0000 (00:25 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 7 Aug 1994 00:25:52 +0000 (00:25 +0000)
lispref/searching.texi
lispref/syntax.texi

index 98ce0f7..c6dfc72 100644 (file)
@@ -533,8 +533,8 @@ deciphered as follows:
 
 @table @code
 @item [.?!]
-The first part of the pattern consists of three characters, a period, a
-question mark and an exclamation mark, within square brackets.  The
+The first part of the pattern is a character set that matches any one of
+three characters: period, question mark, and exclamation mark.  The
 match must begin with one of these three characters.
 
 @item []\"')@}]*
@@ -545,11 +545,11 @@ a string.  The @samp{*} at the end indicates that the immediately
 preceding regular expression (a character set, in this case) may be
 repeated zero or more times.
 
-@item \\($\\|@ \\|\t\\|@ @ \\)
+@item \\($\\|@ $\\|\t\\|@ @ \\)
 The third part of the pattern matches the whitespace that follows the
 end of a sentence: the end of a line, or a tab, or two spaces.  The
 double backslashes mark the parentheses and vertical bars as regular
-expression syntax; the parentheses mark the group and the vertical bars
+expression syntax; the parentheses delimit a group and the vertical bars
 separate alternatives.  The dollar sign is used to match the end of a
 line.
 
@@ -624,14 +624,14 @@ This function searches backward in the current buffer for a string of
 text that is matched by the regular expression @var{regexp}, leaving
 point at the beginning of the first text found.
 
-This function is analogous to @code{re-search-forward}, but they are
-not simple mirror images.  @code{re-search-forward} finds the match
-whose beginning is as close as possible.  If @code{re-search-backward}
-were a perfect mirror image, it would find the match whose end is as
-close as possible.  However, in fact it finds the match whose beginning
-is as close as possible.  The reason is that matching a regular
-expression at a given spot always works from beginning to end, and is
-done at a specified beginning position.
+This function is analogous to @code{re-search-forward}, but they are not
+simple mirror images.  @code{re-search-forward} finds the match whose
+beginning is as close as possible to the starting point.  If
+@code{re-search-backward} were a perfect mirror image, it would find the
+match whose end is as close as possible.  However, in fact it finds the
+match whose beginning is as close as possible.  The reason is that
+matching a regular expression at a given spot always works from
+beginning to end, and starts at a specified beginning position.
 
 A true mirror-image of @code{re-search-forward} would require a special
 feature for matching regexps from end to beginning.  It's not worth the
@@ -804,8 +804,8 @@ number of occurrences to consider.  In this case, @code{perform-replace}
 returns after considering that many occurrences.
 
 Normally, the keymap @code{query-replace-map} defines the possible user
-responses.  The argument @var{map}, if non-@code{nil}, is a keymap to
-use instead of @code{query-replace-map}.
+responses for queries.  The argument @var{map}, if non-@code{nil}, is a
+keymap to use instead of @code{query-replace-map}.
 @end defun
 
 @defvar query-replace-map
@@ -837,10 +837,12 @@ Do take the action being considered---in other words, ``yes.''
 Do not take action for this question---in other words, ``no.''
 
 @item exit
-Answer this question ``no,'' and don't ask any more.
+Answer this question ``no,'' and give up on the entire series of
+questions, assuming that the answers will be ``no.''
 
 @item act-and-exit
-Answer this question ``yes,'' and don't ask any more.
+Answer this question ``yes,'' and give up on the entire series of
+questions, assuming that subsequent answers will be ``no.''
 
 @item act-and-show
 Answer this question ``yes,'' but show the results---don't advance yet
@@ -908,19 +910,18 @@ expression.
 This function returns the position of the start of text matched by the
 last regular expression searched for, or a subexpression of it.
 
-The argument @var{count}, a number, specifies a subexpression whose
-start position is the value.  If @var{count} is zero, then the value is
-the position of the text matched by the whole regexp.  If @var{count} is
-greater than zero, then the value is the position of the beginning of
-the text matched by the @var{count}th subexpression.
+If @var{count} is zero, then the value is the position of the start of
+the text matched by the whole regexp.  Otherwise, @var{count}, specifies
+a subexpression in the regular expresion.  The value of the function is
+the starting position of the match for that subexpression.
 
 Subexpressions of a regular expression are those expressions grouped
-inside of parentheses, @samp{\(@dots{}\)}.  The @var{count}th
+with escaped parentheses, @samp{\(@dots{}\)}.  The @var{count}th
 subexpression is found by counting occurrences of @samp{\(} from the
 beginning of the whole regular expression.  The first subexpression is
 numbered 1, the second 2, and so on.
 
-The value is @code{nil} for a parenthetical grouping inside of a
+The value is @code{nil} for a subexpression inside a
 @samp{\|} alternative that wasn't used in the match.
 @end defun
 
@@ -972,7 +973,7 @@ subexpression is at the 13th character (@samp{c}).
   (re-search-forward "The \\(cat \\)")
   (match-beginning 0)
   (match-beginning 1))
-    @result{} (t 9 13)
+    @result{} (9 9 13)
 @end group
 
 @group
@@ -1011,6 +1012,9 @@ If the original text contains just one word, and that word is a capital
 letter, @code{replace-match} considers this a capitalized first word
 rather than all upper case.
 
+If @code{case-replace} is @code{nil}, then case conversion is not done,
+regardless of the value of @var{fixed-case}.  @xref{Searching and Case}.
+
 If @var{literal} is non-@code{nil}, then @var{replacement} is inserted
 exactly as it is, the only alterations being case changes as needed.
 If it is @code{nil} (the default), then the character @samp{\} is treated
@@ -1024,9 +1028,9 @@ part of one of the following sequences:
 
 @item @samp{\@var{n}}
 @cindex @samp{\@var{n}} in replacement
-@samp{\@var{n}} stands for the text that matched the @var{n}th
-subexpression in the original regexp.  Subexpressions are those
-expressions grouped inside of @samp{\(@dots{}\)}.  @var{n} is a digit.
+@samp{\@var{n}}, where @var{n} is a digit, stands for the text that
+matched the @var{n}th subexpression in the original regexp.
+Subexpressions are those expressions grouped inside @samp{\(@dots{}\)}.
 
 @item @samp{\\}
 @cindex @samp{\} in replacement
@@ -1182,8 +1186,8 @@ particular character sets, are included: thus, @samp{[aB]} would match
 
   If you do not want this feature, set the variable
 @code{case-fold-search} to @code{nil}.  Then all letters must match
-exactly, including case.  This is a per-buffer-local variable; altering
-the variable affects only the current buffer.  (@xref{Intro to
+exactly, including case.  This is a buffer-local variable; altering the
+variable affects only the current buffer.  (@xref{Intro to
 Buffer-Local}.)  Alternatively, you may change the value of
 @code{default-case-fold-search}, which is the default value of
 @code{case-fold-search} for buffers that do not override it.
@@ -1195,9 +1199,13 @@ for an upper case letter only.  But this has nothing to do with the
 searching functions Lisp functions use.
 
 @defopt case-replace
-This variable determines whether @code{query-replace} should preserve
-case in replacements.  If the variable is @code{nil}, then
-@code{replace-match} should not try to convert case.
+This variable determines whether the replacement functions should
+preserve case.  If the variable is @code{nil}, that means to use the
+replacement text verbatim.  A non-@code{nil} value means to convert the
+case of the replacement text according to the text being replaced.
+
+The function @code{replace-match} is where this variable actually has
+its effect.  @xref{Replacing Match}.
 @end defopt
 
 @defopt case-fold-search
@@ -1222,21 +1230,22 @@ used for certain purposes in editing:
 
 @defvar page-delimiter
 This is the regexp describing line-beginnings that separate pages.  The
-default value is @code{"^\014"} (i.e., @code{"^^L"} or @code{"^\C-l"}).
+default value is @code{"^\014"} (i.e., @code{"^^L"} or @code{"^\C-l"});
+this matches a line that starts with a formfeed character.
 @end defvar
 
 @defvar paragraph-separate
 This is the regular expression for recognizing the beginning of a line
 that separates paragraphs.  (If you change this, you may have to
-change @code{paragraph-start} also.)  The default value is @code{"^[
-\t\f]*$"}, which is a line that consists entirely of spaces, tabs, and
-form feeds.
+change @code{paragraph-start} also.)  The default value is
+@w{@code{"^[@ \t\f]*$"}}, which matches a line that consists entirely of
+spaces, tabs, and form feeds.
 @end defvar
 
 @defvar paragraph-start
 This is the regular expression for recognizing the beginning of a line
 that starts @emph{or} separates paragraphs.  The default value is
-@code{"^[ \t\n\f]"}, which matches a line starting with a space, tab,
+@w{@code{"^[@ \t\n\f]"}}, which matches a line starting with a space, tab,
 newline, or form feed.
 @end defvar
 
@@ -1246,11 +1255,12 @@ paragraph boundaries also end sentences, regardless.)  The default value
 is:
 
 @example
-"[.?!][]\"')@}]*\\($\\|\t\\| \\)[ \t\n]*"
+"[.?!][]\"')@}]*\\($\\| $\\|\t\\| \\)[ \t\n]*"
 @end example
 
-This means a period, question mark or exclamation mark, followed by a
-closing brace, followed by tabs, spaces or new lines.
+This means a period, question mark or exclamation mark, followed
+optionally by a closing parenthetical character, followed by tabs,
+spaces or new lines.
 
 For a detailed explanation of this regular expression, see @ref{Regexp
 Example}.
index 9766df6..1e0e314 100644 (file)
@@ -56,7 +56,7 @@ mode, the character @samp{;} begins a comment, but in C mode, it
 terminates a statement.  To support these variations, Emacs makes the
 choice of syntax table local to each buffer.  Typically, each major
 mode has its own syntax table and installs that table in each buffer
-which uses that mode.  Changing this table alters the syntax in all
+that uses that mode.  Changing this table alters the syntax in all
 those buffers as well as in any buffers subsequently put in that mode.
 Occasionally several similar modes share one syntax table.
 @xref{Example Major Modes}, for an example of how to set up a syntax
@@ -92,14 +92,14 @@ puts each character into one class.  There is no necessary relationship
 between the class of a character in one syntax table and its class in
 any other table.
 
-  Each class is designated by a mnemonic character which serves as the
+  Each class is designated by a mnemonic character, which serves as the
 name of the class when you need to specify a class.  Usually the
-designator character is one which is frequently put in that class;
-however, its meaning as a designator is unvarying and independent of
-what syntax that character currently has.
+designator character is one that is frequently in that class; however,
+its meaning as a designator is unvarying and independent of what syntax
+that character currently has.
 
 @cindex syntax descriptor
-  A syntax descriptor is a Lisp string which specifies a syntax class, a
+  A syntax descriptor is a Lisp string that specifies a syntax class, a
 matching character (used only for the parenthesis classes) and flags.
 The first character is the designator for a syntax class.  The second
 character is the character to match; if it is unused, put a space there.
@@ -121,7 +121,7 @@ comment-starter, second character of a comment-ender).
 @node Syntax Class Table
 @subsection Table of Syntax Classes
 
-  Here is a table syntax classes, the characters that stand for them,
+  Here is a table of syntax classes, the characters that stand for them,
 their meanings, and examples of their use.
 
 @deffn {Syntax class} @w{whitespace character}
@@ -135,7 +135,7 @@ newline and formfeed are almost always classified as whitespace.
 @deffn {Syntax class} @w{word constituent}
 @dfn{Word constituents} (designated with @samp{w}) are parts of normal
 English words and are typically used in variable and command names in
-programs.  All upper and lower case letters and the digits are typically
+programs.  All upper- and lower-case letters, and the digits, are typically
 word constituents.
 @end deffn
 
@@ -227,8 +227,8 @@ This class is not currently used in any standard Emacs modes.
 @dfn{Paired delimiter characters} (designated with @samp{$}) are like
 string quote characters except that the syntactic properties of the
 characters between the delimiters are not suppressed.  Only @TeX{} mode
-uses a paired identical delimiter presently---the @samp{$} that both
-enters and leaves math mode.
+uses a paired delimiter presently---the @samp{$} that both enters and
+leaves math mode.
 @end deffn
 
 @deffn {Syntax class} @w{expression prefix}
@@ -278,14 +278,14 @@ The flags for a character @var{c} are:
 
 @itemize @bullet
 @item
-@samp{1} means @var{c} is the start of a two-character comment start
+@samp{1} means @var{c} is the start of a two-character comment-start
 sequence.
 
 @item
 @samp{2} means @var{c} is the second character of such a sequence.
 
 @item
-@samp{3} means @var{c} is the start of a two-character comment end
+@samp{3} means @var{c} is the start of a two-character comment-end
 sequence.
 
 @item
@@ -305,7 +305,7 @@ comment-end sequence of style ``b''.
 
 The two comment-start sequences must begin with the same character; only
 the second character may differ.  Mark the second character of the
-``b''-style comment start sequence with the @samp{b} flag.
+``b''-style comment-start sequence with the @samp{b} flag.
 
 A comment-end sequence (one or two characters) applies to the ``b''
 style if its first character has the @samp{b} flag set; otherwise, it
@@ -322,10 +322,25 @@ The appropriate comment syntax settings for C++ are as follows:
 @samp{>b}
 @end table
 
-Thus @samp{/*} is a comment-start sequence for ``a'' style, @samp{//}
-is a comment-start sequence for ``b'' style, @samp{*/} is a
-comment-end sequence for ``a'' style, and newline is a comment-end
-sequence for ``b'' style.
+This defines four comment-delimiting sequences:
+
+@table @asis
+@item @samp{/*}
+This is a comment-start sequence for ``a'' style because the
+second character, @samp{*}, does not have the @samp{b} flag.
+
+@item @samp{//}
+This is a comment-start sequence for ``b'' style because the second
+character, @samp{/}, does have the @samp{b} flag.
+
+@item @samp{*/}
+This is a comment-end sequence for ``a'' style because the first
+character, @samp{*}, does not have the @samp{b} flag
+
+@item newline
+This is a comment-end sequence for ``b'' style, because the newline
+character has the @samp{b} flag.
+@end table
 
 @item
 @c Emacs 19 feature
@@ -347,7 +362,7 @@ altering syntax tables.
 
 @defun make-syntax-table
 This function creates a new syntax table.  Character codes 0 through
-31, and 128 through 255, are set up to inherit from the standard syntax
+31 and 128 through 255 are set up to inherit from the standard syntax
 table.  The other character codes are set up by copying what the
 standard syntax table says about them.
 
@@ -405,7 +420,7 @@ signaled if @var{char} is not a character.
 ;;   @r{the first character of a start-comment sequence,}
 ;;   @r{and the second character of an end-comment sequence.}
 ;;   @r{This is used in C mode.}
-(modify-syntax-entry ?/ ".13")
+(modify-syntax-entry ?/ ". 14")
      @result{} nil
 @end group
 @end example
@@ -421,8 +436,8 @@ An error is signaled if @var{char} is not a character.
 The following examples apply to C mode.  The first example shows that
 the syntax class of space is whitespace (represented by a space).  The
 second example shows that the syntax of @samp{/} is punctuation.  This
-does not show the fact that it is also part of comment start and end
-sequence.  The third example shows that open parenthesis is in the class
+does not show the fact that it is also part of comment-start and -end
+sequences.  The third example shows that open parenthesis is in the class
 of open parentheses.  This does not show the fact that it has a matching
 character, @samp{)}.
 
@@ -464,7 +479,7 @@ version 18 or earlier.
 @defun skip-syntax-forward syntaxes &optional limit
 This function moves point forward across characters having syntax classes
 mentioned in @var{syntaxes}.  It stops when it encounters the end of
-the buffer, or position @var{lim} (if specified), or a character it is
+the buffer, or position @var{limit} (if specified), or a character it is
 not supposed to skip.
 @ignore @c may want to change this.
 The return value is the distance traveled, which is a nonnegative
@@ -475,7 +490,7 @@ integer.
 @defun skip-syntax-backward syntaxes &optional limit
 This function moves point backward across characters whose syntax
 classes are mentioned in @var{syntaxes}.  It stops when it encounters
-the beginning of the buffer, or position @var{lim} (if specified), or a
+the beginning of the buffer, or position @var{limit} (if specified), or a
 character it is not supposed to skip.
 @ignore @c may want to change this.
 The return value indicates the distance traveled.  It is an integer that
@@ -501,10 +516,10 @@ higher-level functions for moving over balanced expressions.
 
 @defun parse-partial-sexp start limit &optional target-depth stop-before state stop-comment
 This function parses a sexp in the current buffer starting at
-@var{start}, not scanning past @var{limit}.  It stops at @var{limit} or
-when certain criteria described below are met, and sets to the location
-where parsing stops.  It returns a value describing the status of the
-parse at the point where it stops.
+@var{start}, not scanning past @var{limit}.  It stops at position
+@var{limit} or when certain criteria described below are met, and sets
+point to the location where parsing stops.  It returns a value
+describing the status of the parse at the point where it stops.
 
 If @var{state} is @code{nil}, @var{start} is assumed to be at the top
 level of parenthesis structure, such as the beginning of a function
@@ -537,8 +552,8 @@ The depth in parentheses, counting from 0.
 
 @item 
 @cindex innermost containing parentheses
-The character position of the start of the innermost containing
-parenthetical grouping; @code{nil} if none.
+The character position of the start of the innermost parenthetical
+grouping containing the stopping point; @code{nil} if none.
 
 @item 
 @cindex previous complete subexpression
@@ -552,7 +567,7 @@ character that will terminate the string.
 
 @item 
 @cindex inside comment
-@code{t} if inside a comment.
+@code{t} if inside a comment (of either style).
 
 @item 
 @cindex quote character
@@ -581,14 +596,15 @@ If @var{depth} is nonzero, parenthesis depth counting begins from that
 value.  The only candidates for stopping are places where the depth in
 parentheses becomes zero; @code{scan-lists} counts @var{count} such
 places and then stops.  Thus, a positive value for @var{depth} means go
-out levels of parenthesis.
+out @var{depth} levels of parenthesis.
 
 Scanning ignores comments if @code{parse-sexp-ignore-comments} is
 non-@code{nil}.
 
-If scan reaches the beginning or end of the buffer (or its accessible
-portion), and the depth is not zero, an error is signaled.  If the depth
-is zero but the count is not used up, @code{nil} is returned.
+If the scan reaches the beginning or end of the buffer (or its
+accessible portion), and the depth is not zero, an error is signaled.
+If the depth is zero but the count is not used up, @code{nil} is
+returned.
 @end defun
 
 @defun scan-sexps from count
@@ -598,7 +614,7 @@ This function scans forward @var{count} sexps from character position
 Scanning ignores comments if @code{parse-sexp-ignore-comments} is
 non-@code{nil}.
 
-If scan reaches the beginning or end of (the accessible part of) the
+If the scan reaches the beginning or end of (the accessible part of) the
 buffer in the middle of a parenthetical grouping, an error is signaled.
 If it reaches the beginning or end between groupings but before count is
 used up, @code{nil} is returned.
@@ -628,7 +644,7 @@ It also stops after satisfying @var{count}.
 
 To move forward over all comments and whitespace following point, use
 @code{(forward-comment (buffer-size))}.  @code{(buffer-size)} is a good
-argument to use, because the number of comments to in the buffer cannot
+argument to use, because the number of comments in the buffer cannot
 exceed that many.
 
 @node Standard Syntax Tables