diff options
| author | Glenn Morris | 2012-03-26 23:46:42 -0700 |
|---|---|---|
| committer | Glenn Morris | 2012-03-26 23:46:42 -0700 |
| commit | 4fb9a543142d6cdd7760e7bfcad186017fa57ead (patch) | |
| tree | 8f81fdb1144372447e55e3d144bab15e31404481 | |
| parent | b4fa35fa9c8468dc1a26c54f5e84e64301f7e1d8 (diff) | |
| download | emacs-4fb9a543142d6cdd7760e7bfcad186017fa57ead.tar.gz emacs-4fb9a543142d6cdd7760e7bfcad186017fa57ead.zip | |
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.
| -rw-r--r-- | doc/lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/lispref/searching.texi | 41 | ||||
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/search.c | 9 |
4 files changed, 41 insertions, 18 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 34323d947e7..a326117cdce 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2012-03-27 Glenn Morris <rgm@gnu.org> | 1 | 2012-03-27 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * searching.texi (String Search): Add xref to Emacs manual. | ||
| 4 | Copyedits. Mention the function word-search-regexp. | ||
| 5 | (Searching and Case): Add xref to Emacs manual. Copyedits. | ||
| 6 | |||
| 3 | * processes.texi (Network Servers): Standardize apostrophe usage. | 7 | * processes.texi (Network Servers): Standardize apostrophe usage. |
| 4 | 8 | ||
| 5 | * os.texi (System Environment): Copyedits. Remove some examples | 9 | * os.texi (System Environment): Copyedits. Remove some examples |
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 5bda1940b51..9a508d37340 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -38,7 +38,8 @@ properties, see @ref{Property Search}. | |||
| 38 | buffer. They are meant for use in programs, but you may call them | 38 | buffer. They are meant for use in programs, but you may call them |
| 39 | interactively. If you do so, they prompt for the search string; the | 39 | interactively. If you do so, they prompt for the search string; the |
| 40 | arguments @var{limit} and @var{noerror} are @code{nil}, and @var{repeat} | 40 | arguments @var{limit} and @var{noerror} are @code{nil}, and @var{repeat} |
| 41 | is 1. | 41 | is 1. For more details on interactive searching, @pxref{Search,, |
| 42 | Searching and Replacement, emacs, The GNU Emacs Manual}. | ||
| 42 | 43 | ||
| 43 | These search functions convert the search string to multibyte if the | 44 | These search functions convert the search string to multibyte if the |
| 44 | buffer is multibyte; they convert the search string to unibyte if the | 45 | 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 | @end group | 72 | @end group |
| 72 | @end example | 73 | @end example |
| 73 | 74 | ||
| 74 | The argument @var{limit} specifies the upper bound to the search. (It | 75 | The argument @var{limit} specifies the bound to the search, and should |
| 75 | must be a position in the current buffer.) No match extending after | 76 | be a position in the current buffer. No match extending after |
| 76 | that position is accepted. If @var{limit} is omitted or @code{nil}, it | 77 | that position is accepted. If @var{limit} is omitted or @code{nil}, it |
| 77 | defaults to the end of the accessible portion of the buffer. | 78 | defaults to the end of the accessible portion of the buffer. |
| 78 | 79 | ||
| @@ -82,9 +83,14 @@ What happens when the search fails depends on the value of | |||
| 82 | error is signaled. If @var{noerror} is @code{t}, @code{search-forward} | 83 | error is signaled. If @var{noerror} is @code{t}, @code{search-forward} |
| 83 | returns @code{nil} and does nothing. If @var{noerror} is neither | 84 | returns @code{nil} and does nothing. If @var{noerror} is neither |
| 84 | @code{nil} nor @code{t}, then @code{search-forward} moves point to the | 85 | @code{nil} nor @code{t}, then @code{search-forward} moves point to the |
| 85 | upper bound and returns @code{nil}. (It would be more consistent now to | 86 | upper bound and returns @code{nil}. |
| 86 | return the new position of point in that case, but some existing | 87 | @c I see no prospect of this ever changing, and frankly the current |
| 87 | programs may depend on a value of @code{nil}.) | 88 | @c behavior seems better, so there seems no need to mention this. |
| 89 | @ignore | ||
| 90 | (It would be more consistent now to return the new position of point | ||
| 91 | in that case, but some existing programs may depend on a value of | ||
| 92 | @code{nil}.) | ||
| 93 | @end ignore | ||
| 88 | 94 | ||
| 89 | The argument @var{noerror} only affects valid searches which fail to | 95 | The argument @var{noerror} only affects valid searches which fail to |
| 90 | find a match. Invalid arguments cause errors regardless of | 96 | find a match. Invalid arguments cause errors regardless of |
| @@ -132,7 +138,7 @@ the ball boy!" | |||
| 132 | 138 | ||
| 133 | @group | 139 | @group |
| 134 | (word-search-forward "Please find the ball, boy.") | 140 | (word-search-forward "Please find the ball, boy.") |
| 135 | @result{} 35 | 141 | @result{} 36 |
| 136 | 142 | ||
| 137 | ---------- Buffer: foo ---------- | 143 | ---------- Buffer: foo ---------- |
| 138 | He said "Please! Find | 144 | He said "Please! Find |
| @@ -153,11 +159,16 @@ end of the accessible portion of the buffer) and returns @code{nil}. | |||
| 153 | 159 | ||
| 154 | If @var{repeat} is non-@code{nil}, then the search is repeated that many | 160 | If @var{repeat} is non-@code{nil}, then the search is repeated that many |
| 155 | times. Point is positioned at the end of the last match. | 161 | times. Point is positioned at the end of the last match. |
| 162 | |||
| 163 | @findex word-search-regexp | ||
| 164 | Internal, @code{word-search-forward} and related functions use the | ||
| 165 | function @code{word-search-regexp} to convert @var{string} to a | ||
| 166 | regular expression that ignores punctuation. | ||
| 156 | @end deffn | 167 | @end deffn |
| 157 | 168 | ||
| 158 | @deffn Command word-search-forward-lax string &optional limit noerror repeat | 169 | @deffn Command word-search-forward-lax string &optional limit noerror repeat |
| 159 | This command is identical to @code{word-search-forward}, except that | 170 | This command is identical to @code{word-search-forward}, except that |
| 160 | the end of @code{string} need not match a word boundary unless it ends | 171 | the end of @var{string} need not match a word boundary, unless @var{string} ends |
| 161 | in whitespace. For instance, searching for @samp{ball boy} matches | 172 | in whitespace. For instance, searching for @samp{ball boy} matches |
| 162 | @samp{ball boyee}, but does not match @samp{aball boy}. | 173 | @samp{ball boyee}, but does not match @samp{aball boy}. |
| 163 | @end deffn | 174 | @end deffn |
| @@ -171,7 +182,7 @@ beginning of the match. | |||
| 171 | 182 | ||
| 172 | @deffn Command word-search-backward-lax string &optional limit noerror repeat | 183 | @deffn Command word-search-backward-lax string &optional limit noerror repeat |
| 173 | This command is identical to @code{word-search-backward}, except that | 184 | This command is identical to @code{word-search-backward}, except that |
| 174 | the end of @code{string} need not match a word boundary unless it ends | 185 | the end of @var{string} need not match a word boundary, unless @var{string} ends |
| 175 | in whitespace. | 186 | in whitespace. |
| 176 | @end deffn | 187 | @end deffn |
| 177 | 188 | ||
| @@ -189,24 +200,26 @@ regular expressions, too; thus, @samp{[aB]} would match @samp{a} or | |||
| 189 | @code{case-fold-search} to @code{nil}. Then all letters must match | 200 | @code{case-fold-search} to @code{nil}. Then all letters must match |
| 190 | exactly, including case. This is a buffer-local variable; altering the | 201 | exactly, including case. This is a buffer-local variable; altering the |
| 191 | variable affects only the current buffer. (@xref{Intro to | 202 | variable affects only the current buffer. (@xref{Intro to |
| 192 | Buffer-Local}.) Alternatively, you may change the default value of | 203 | Buffer-Local}.) Alternatively, you may change the default value. |
| 193 | @code{case-fold-search}. | 204 | In Lisp code, you will more typically use @code{let} to bind |
| 205 | @code{case-fold-search} to the desired value. | ||
| 194 | 206 | ||
| 195 | Note that the user-level incremental search feature handles case | 207 | Note that the user-level incremental search feature handles case |
| 196 | distinctions differently. When the search string contains only lower | 208 | distinctions differently. When the search string contains only lower |
| 197 | case letters, the search ignores case, but when the search string | 209 | case letters, the search ignores case, but when the search string |
| 198 | contains one or more upper case letters, the search becomes | 210 | contains one or more upper case letters, the search becomes |
| 199 | case-sensitive. But this has nothing to do with the searching | 211 | case-sensitive. But this has nothing to do with the searching |
| 200 | functions used in Lisp code. | 212 | functions used in Lisp code. @xref{Incremental Search,,, emacs, |
| 213 | The GNU Emacs Manual}. | ||
| 201 | 214 | ||
| 202 | @defopt case-fold-search | 215 | @defopt case-fold-search |
| 203 | This buffer-local variable determines whether searches should ignore | 216 | This buffer-local variable determines whether searches should ignore |
| 204 | case. If the variable is @code{nil} they do not ignore case; otherwise | 217 | case. If the variable is @code{nil} they do not ignore case; otherwise |
| 205 | they do ignore case. | 218 | (and by default) they do ignore case. |
| 206 | @end defopt | 219 | @end defopt |
| 207 | 220 | ||
| 208 | @defopt case-replace | 221 | @defopt case-replace |
| 209 | This variable determines whether the higher level replacement | 222 | This variable determines whether the higher-level replacement |
| 210 | functions should preserve case. If the variable is @code{nil}, that | 223 | functions should preserve case. If the variable is @code{nil}, that |
| 211 | means to use the replacement text verbatim. A non-@code{nil} value | 224 | means to use the replacement text verbatim. A non-@code{nil} value |
| 212 | means to convert the case of the replacement text according to the | 225 | means to convert the case of the replacement text according to the |
diff --git a/src/ChangeLog b/src/ChangeLog index 81448982563..381d2ad631c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-03-27 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * search.c (Fword_search_backward_lax, Fword_search_forward_lax): | ||
| 4 | Doc fixes. | ||
| 5 | |||
| 1 | 2012-03-26 Kenichi Handa <handa@m17n.org> | 6 | 2012-03-26 Kenichi Handa <handa@m17n.org> |
| 2 | 7 | ||
| 3 | * dispextern.h (struct glyph): Fix previous change. Change the | 8 | * dispextern.h (struct glyph): Fix previous change. Change the |
diff --git a/src/search.c b/src/search.c index 55a6d893479..1f3ccc25dc8 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* String search routines for GNU Emacs. | 1 | /* String search routines for GNU Emacs. |
| 2 | Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2012 | 2 | |
| 3 | Free Software Foundation, Inc. | 3 | Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2012 |
| 4 | Free Software Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| 6 | 7 | ||
| @@ -2257,7 +2258,7 @@ DEFUN ("word-search-backward-lax", Fword_search_backward_lax, Sword_search_backw | |||
| 2257 | Set point to the beginning of the occurrence found, and return point. | 2258 | Set point to the beginning of the occurrence found, and return point. |
| 2258 | 2259 | ||
| 2259 | Unlike `word-search-backward', the end of STRING need not match a word | 2260 | Unlike `word-search-backward', the end of STRING need not match a word |
| 2260 | boundary unless it ends in whitespace. | 2261 | boundary, unless STRING ends in whitespace. |
| 2261 | 2262 | ||
| 2262 | An optional second argument bounds the search; it is a buffer position. | 2263 | An optional second argument bounds the search; it is a buffer position. |
| 2263 | The match found must not extend before that position. | 2264 | 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 | Set point to the end of the occurrence found, and return point. | 2280 | Set point to the end of the occurrence found, and return point. |
| 2280 | 2281 | ||
| 2281 | Unlike `word-search-forward', the end of STRING need not match a word | 2282 | Unlike `word-search-forward', the end of STRING need not match a word |
| 2282 | boundary unless it ends in whitespace. | 2283 | boundary, unless STRING ends in whitespace. |
| 2283 | 2284 | ||
| 2284 | An optional second argument bounds the search; it is a buffer position. | 2285 | An optional second argument bounds the search; it is a buffer position. |
| 2285 | The match found must not extend after that position. | 2286 | The match found must not extend after that position. |