Commit 4fb9a543 authored by Glenn Morris's avatar Glenn Morris

Small doc and elisp manual fixes related to searching

* doc/lispref/searching.texi (String Search): Add xref to Emacs manual.
Copyedits.  Mention the function word-search-regexp.
(Searching and Case): Add xref to Emacs manual.  Copyedits.

* src/search.c (Fword_search_backward_lax, Fword_search_forward_lax):
Doc fixes.
parent b4fa35fa
2012-03-27 Glenn Morris <rgm@gnu.org> 2012-03-27 Glenn Morris <rgm@gnu.org>
* searching.texi (String Search): Add xref to Emacs manual.
Copyedits. Mention the function word-search-regexp.
(Searching and Case): Add xref to Emacs manual. Copyedits.
* processes.texi (Network Servers): Standardize apostrophe usage. * processes.texi (Network Servers): Standardize apostrophe usage.
* os.texi (System Environment): Copyedits. Remove some examples * os.texi (System Environment): Copyedits. Remove some examples
......
...@@ -38,7 +38,8 @@ properties, see @ref{Property Search}. ...@@ -38,7 +38,8 @@ properties, see @ref{Property Search}.
buffer. They are meant for use in programs, but you may call them buffer. They are meant for use in programs, but you may call them
interactively. If you do so, they prompt for the search string; the interactively. If you do so, they prompt for the search string; the
arguments @var{limit} and @var{noerror} are @code{nil}, and @var{repeat} arguments @var{limit} and @var{noerror} are @code{nil}, and @var{repeat}
is 1. is 1. For more details on interactive searching, @pxref{Search,,
Searching and Replacement, emacs, The GNU Emacs Manual}.
These search functions convert the search string to multibyte if the These search functions convert the search string to multibyte if the
buffer is multibyte; they convert the search string to unibyte if the buffer is multibyte; they convert the search string to unibyte if the
...@@ -71,8 +72,8 @@ The quick brown fox@point{} jumped over the lazy dog. ...@@ -71,8 +72,8 @@ The quick brown fox@point{} jumped over the lazy dog.
@end group @end group
@end example @end example
The argument @var{limit} specifies the upper bound to the search. (It The argument @var{limit} specifies the bound to the search, and should
must be a position in the current buffer.) No match extending after be a position in the current buffer. No match extending after
that position is accepted. If @var{limit} is omitted or @code{nil}, it that position is accepted. If @var{limit} is omitted or @code{nil}, it
defaults to the end of the accessible portion of the buffer. defaults to the end of the accessible portion of the buffer.
...@@ -82,9 +83,14 @@ What happens when the search fails depends on the value of ...@@ -82,9 +83,14 @@ What happens when the search fails depends on the value of
error is signaled. If @var{noerror} is @code{t}, @code{search-forward} error is signaled. If @var{noerror} is @code{t}, @code{search-forward}
returns @code{nil} and does nothing. If @var{noerror} is neither returns @code{nil} and does nothing. If @var{noerror} is neither
@code{nil} nor @code{t}, then @code{search-forward} moves point to the @code{nil} nor @code{t}, then @code{search-forward} moves point to the
upper bound and returns @code{nil}. (It would be more consistent now to upper bound and returns @code{nil}.
return the new position of point in that case, but some existing @c I see no prospect of this ever changing, and frankly the current
programs may depend on a value of @code{nil}.) @c behavior seems better, so there seems no need to mention this.
@ignore
(It would be more consistent now to return the new position of point
in that case, but some existing programs may depend on a value of
@code{nil}.)
@end ignore
The argument @var{noerror} only affects valid searches which fail to The argument @var{noerror} only affects valid searches which fail to
find a match. Invalid arguments cause errors regardless of find a match. Invalid arguments cause errors regardless of
...@@ -132,7 +138,7 @@ the ball boy!" ...@@ -132,7 +138,7 @@ the ball boy!"
@group @group
(word-search-forward "Please find the ball, boy.") (word-search-forward "Please find the ball, boy.")
@result{} 35 @result{} 36
---------- Buffer: foo ---------- ---------- Buffer: foo ----------
He said "Please! Find He said "Please! Find
...@@ -153,11 +159,16 @@ end of the accessible portion of the buffer) and returns @code{nil}. ...@@ -153,11 +159,16 @@ end of the accessible portion of the buffer) and returns @code{nil}.
If @var{repeat} is non-@code{nil}, then the search is repeated that many If @var{repeat} is non-@code{nil}, then the search is repeated that many
times. Point is positioned at the end of the last match. times. Point is positioned at the end of the last match.
@findex word-search-regexp
Internal, @code{word-search-forward} and related functions use the
function @code{word-search-regexp} to convert @var{string} to a
regular expression that ignores punctuation.
@end deffn @end deffn
@deffn Command word-search-forward-lax string &optional limit noerror repeat @deffn Command word-search-forward-lax string &optional limit noerror repeat
This command is identical to @code{word-search-forward}, except that This command is identical to @code{word-search-forward}, except that
the end of @code{string} need not match a word boundary unless it ends the end of @var{string} need not match a word boundary, unless @var{string} ends
in whitespace. For instance, searching for @samp{ball boy} matches in whitespace. For instance, searching for @samp{ball boy} matches
@samp{ball boyee}, but does not match @samp{aball boy}. @samp{ball boyee}, but does not match @samp{aball boy}.
@end deffn @end deffn
...@@ -171,7 +182,7 @@ beginning of the match. ...@@ -171,7 +182,7 @@ beginning of the match.
@deffn Command word-search-backward-lax string &optional limit noerror repeat @deffn Command word-search-backward-lax string &optional limit noerror repeat
This command is identical to @code{word-search-backward}, except that This command is identical to @code{word-search-backward}, except that
the end of @code{string} need not match a word boundary unless it ends the end of @var{string} need not match a word boundary, unless @var{string} ends
in whitespace. in whitespace.
@end deffn @end deffn
...@@ -189,24 +200,26 @@ regular expressions, too; thus, @samp{[aB]} would match @samp{a} or ...@@ -189,24 +200,26 @@ regular expressions, too; thus, @samp{[aB]} would match @samp{a} or
@code{case-fold-search} to @code{nil}. Then all letters must match @code{case-fold-search} to @code{nil}. Then all letters must match
exactly, including case. This is a buffer-local variable; altering the exactly, including case. This is a buffer-local variable; altering the
variable affects only the current buffer. (@xref{Intro to variable affects only the current buffer. (@xref{Intro to
Buffer-Local}.) Alternatively, you may change the default value of Buffer-Local}.) Alternatively, you may change the default value.
@code{case-fold-search}. In Lisp code, you will more typically use @code{let} to bind
@code{case-fold-search} to the desired value.
Note that the user-level incremental search feature handles case Note that the user-level incremental search feature handles case
distinctions differently. When the search string contains only lower distinctions differently. When the search string contains only lower
case letters, the search ignores case, but when the search string case letters, the search ignores case, but when the search string
contains one or more upper case letters, the search becomes contains one or more upper case letters, the search becomes
case-sensitive. But this has nothing to do with the searching case-sensitive. But this has nothing to do with the searching
functions used in Lisp code. functions used in Lisp code. @xref{Incremental Search,,, emacs,
The GNU Emacs Manual}.
@defopt case-fold-search @defopt case-fold-search
This buffer-local variable determines whether searches should ignore This buffer-local variable determines whether searches should ignore
case. If the variable is @code{nil} they do not ignore case; otherwise case. If the variable is @code{nil} they do not ignore case; otherwise
they do ignore case. (and by default) they do ignore case.
@end defopt @end defopt
@defopt case-replace @defopt case-replace
This variable determines whether the higher level replacement This variable determines whether the higher-level replacement
functions should preserve case. If the variable is @code{nil}, that 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 use the replacement text verbatim. A non-@code{nil} value
means to convert the case of the replacement text according to the means to convert the case of the replacement text according to the
......
2012-03-27 Glenn Morris <rgm@gnu.org>
* search.c (Fword_search_backward_lax, Fword_search_forward_lax):
Doc fixes.
2012-03-26 Kenichi Handa <handa@m17n.org> 2012-03-26 Kenichi Handa <handa@m17n.org>
* dispextern.h (struct glyph): Fix previous change. Change the * dispextern.h (struct glyph): Fix previous change. Change the
......
/* String search routines for GNU Emacs. /* String search routines for GNU Emacs.
Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2012
Free Software Foundation, Inc. Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2012
Free Software Foundation, Inc.
This file is part of GNU Emacs. This file is part of GNU Emacs.
...@@ -2257,7 +2258,7 @@ DEFUN ("word-search-backward-lax", Fword_search_backward_lax, Sword_search_backw ...@@ -2257,7 +2258,7 @@ DEFUN ("word-search-backward-lax", Fword_search_backward_lax, Sword_search_backw
Set point to the beginning of the occurrence found, and return point. Set point to the beginning of the occurrence found, and return point.
Unlike `word-search-backward', the end of STRING need not match a word Unlike `word-search-backward', the end of STRING need not match a word
boundary unless it ends in whitespace. boundary, unless STRING ends in whitespace.
An optional second argument bounds the search; it is a buffer position. An optional second argument bounds the search; it is a buffer position.
The match found must not extend before that position. The match found must not extend before that position.
...@@ -2279,7 +2280,7 @@ DEFUN ("word-search-forward-lax", Fword_search_forward_lax, Sword_search_forward ...@@ -2279,7 +2280,7 @@ DEFUN ("word-search-forward-lax", Fword_search_forward_lax, Sword_search_forward
Set point to the end of the occurrence found, and return point. Set point to the end of the occurrence found, and return point.
Unlike `word-search-forward', the end of STRING need not match a word Unlike `word-search-forward', the end of STRING need not match a word
boundary unless it ends in whitespace. boundary, unless STRING ends in whitespace.
An optional second argument bounds the search; it is a buffer position. An optional second argument bounds the search; it is a buffer position.
The match found must not extend after that position. The match found must not extend after that position.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment