diff options
| author | Richard M. Stallman | 2006-01-31 18:30:11 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-01-31 18:30:11 +0000 |
| commit | 5c5245f71f8699278cd7582ceb2d15a216e17466 (patch) | |
| tree | c84c32bf898326d0d8296b6517a7f36a37f89a35 | |
| parent | c48a6229970c6f2b4308fe8624bf169e938bf816 (diff) | |
| download | emacs-5c5245f71f8699278cd7582ceb2d15a216e17466.tar.gz emacs-5c5245f71f8699278cd7582ceb2d15a216e17466.zip | |
Minor clarifications.
(Isearch Scroll): Simplify.
(Other Repeating Search): Document multi-occur-in-matching-buffers.
| -rw-r--r-- | man/search.texi | 98 |
1 files changed, 48 insertions, 50 deletions
diff --git a/man/search.texi b/man/search.texi index 3c9e439e76d..b1593559c85 100644 --- a/man/search.texi +++ b/man/search.texi | |||
| @@ -41,7 +41,6 @@ found. When you have typed enough characters to identify the place you | |||
| 41 | want, you can stop. Depending on what you plan to do next, you may or | 41 | want, you can stop. Depending on what you plan to do next, you may or |
| 42 | may not need to terminate the search explicitly with @key{RET}. | 42 | may not need to terminate the search explicitly with @key{RET}. |
| 43 | 43 | ||
| 44 | @c WideCommands | ||
| 45 | @table @kbd | 44 | @table @kbd |
| 46 | @item C-s | 45 | @item C-s |
| 47 | Incremental search forward (@code{isearch-forward}). | 46 | Incremental search forward (@code{isearch-forward}). |
| @@ -73,9 +72,9 @@ from the keyboard, and moves point past the next occurrence of those | |||
| 73 | characters. If you type @kbd{C-s} and then @kbd{F}, that puts the | 72 | characters. If you type @kbd{C-s} and then @kbd{F}, that puts the |
| 74 | cursor after the first @samp{F} (the first following the starting point, since | 73 | cursor after the first @samp{F} (the first following the starting point, since |
| 75 | this is a forward search). Then if you type an @kbd{O}, you will see | 74 | this is a forward search). Then if you type an @kbd{O}, you will see |
| 76 | the cursor move just after the first @samp{FO} (the @samp{F} in that | 75 | the cursor move to just after the first @samp{FO} (the @samp{F} in that |
| 77 | @samp{FO} may or may not be the first @samp{F}). After another | 76 | @samp{FO} may or may not be the first @samp{F}). After another |
| 78 | @kbd{O}, the cursor moves after the first @samp{FOO} after the place | 77 | @kbd{O}, the cursor moves to just after the first @samp{FOO} after the place |
| 79 | where you started the search. At each step, the buffer text that | 78 | where you started the search. At each step, the buffer text that |
| 80 | matches the search string is highlighted, if the terminal can do that; | 79 | matches the search string is highlighted, if the terminal can do that; |
| 81 | the current search string is always displayed in the echo area. | 80 | the current search string is always displayed in the echo area. |
| @@ -135,19 +134,20 @@ string in the minibuffer without replacing it with items from the | |||
| 135 | search ring, type @kbd{M-e}. Type @kbd{C-s} or @kbd{C-r} | 134 | search ring, type @kbd{M-e}. Type @kbd{C-s} or @kbd{C-r} |
| 136 | to terminate editing the string and search for it. | 135 | to terminate editing the string and search for it. |
| 137 | 136 | ||
| 138 | You can change to searching backwards with @kbd{C-r}. If a search fails | 137 | You can change to searching backwards with @kbd{C-r}. For instance, |
| 139 | because the place you started was too late in the file, you should do this. | 138 | if you are searching forward but you realize you were looking for |
| 140 | Repeated @kbd{C-r} keeps looking for more occurrences backwards. A | 139 | something above the starting point, you can do this. Repeated |
| 141 | @kbd{C-s} starts going forwards again. @kbd{C-r} in a search can be canceled | 140 | @kbd{C-r} keeps looking for more occurrences backwards. A @kbd{C-s} |
| 141 | starts going forwards again. @kbd{C-r} in a search can be canceled | ||
| 142 | with @key{DEL}. | 142 | with @key{DEL}. |
| 143 | 143 | ||
| 144 | @kindex C-r | 144 | @kindex C-r |
| 145 | @findex isearch-backward | 145 | @findex isearch-backward |
| 146 | If you know initially that you want to search backwards, you can use | 146 | If you know initially that you want to search backwards, you can use |
| 147 | @kbd{C-r} instead of @kbd{C-s} to start the search, because @kbd{C-r} as | 147 | @kbd{C-r} instead of @kbd{C-s} to start the search, because @kbd{C-r} |
| 148 | a key runs a command (@code{isearch-backward}) to search backward. A | 148 | as a key runs a command (@code{isearch-backward}) to search backward. |
| 149 | backward search finds matches that are entirely before the starting | 149 | A backward search finds matches that end before the starting point, |
| 150 | point, just as a forward search finds matches that begin after it. | 150 | just as a forward search finds matches that begin after it. |
| 151 | 151 | ||
| 152 | @node Error in Isearch | 152 | @node Error in Isearch |
| 153 | @subsection Errors in Incremental Search | 153 | @subsection Errors in Incremental Search |
| @@ -281,50 +281,46 @@ If you don't like this feature, you can turn it off by setting | |||
| 281 | @cindex faces for highlighting search matches | 281 | @cindex faces for highlighting search matches |
| 282 | You can control how this highlighting looks by customizing the faces | 282 | You can control how this highlighting looks by customizing the faces |
| 283 | @code{isearch} (used for the current match) and @code{lazy-highlight} | 283 | @code{isearch} (used for the current match) and @code{lazy-highlight} |
| 284 | (for all the other matches). The latter is also used for other matches | 284 | (for all the other matches). |
| 285 | inside @code{query-replace}. | ||
| 286 | 285 | ||
| 287 | @node Isearch Scroll | 286 | @node Isearch Scroll |
| 288 | @subsection Scrolling During Incremental Search | 287 | @subsection Scrolling During Incremental Search |
| 289 | 288 | ||
| 290 | Vertical scrolling during incremental search can be enabled by | 289 | You can enable the use of vertical scrolling during incremental |
| 291 | setting the customizable variable @code{isearch-allow-scroll} to a | 290 | search (without exiting the search) by setting the customizable |
| 292 | non-@code{nil} value. | 291 | variable @code{isearch-allow-scroll} to a non-@code{nil} value. This |
| 293 | 292 | applies to using the vertical scroll-bar and to certain keyboard | |
| 294 | You can then use the vertical scroll-bar or certain keyboard | ||
| 295 | commands such as @kbd{@key{PRIOR}} (@code{scroll-down}), | 293 | commands such as @kbd{@key{PRIOR}} (@code{scroll-down}), |
| 296 | @kbd{@key{NEXT}} (@code{scroll-up}) and @kbd{C-l} (@code{recenter}) | 294 | @kbd{@key{NEXT}} (@code{scroll-up}) and @kbd{C-l} (@code{recenter}). |
| 297 | within the search, thus letting you see more of the text near the | 295 | You must run these commands via their key sequences to stay in the |
| 298 | current match. You must run these commands via their key sequences to | 296 | search---typing @kbd{M-x} will terminate the search. You can give |
| 299 | stay in the search---typing M-x @var{command-name} will always | 297 | prefix arguments to these commands in the usual way. |
| 300 | terminate a search. | ||
| 301 | 298 | ||
| 302 | You can give prefix arguments to these commands in the usual way. | 299 | This feature won't let you scroll the current match out of visibility, |
| 303 | The current match cannot be scrolled out of the window---this is | 300 | however. |
| 304 | intentional. | ||
| 305 | 301 | ||
| 306 | Several other commands, such as @kbd{C-x 2} | 302 | The feature also affects some other commands, such as @kbd{C-x 2} |
| 307 | (@code{split-window-vertically}) and @kbd{C-x ^} | 303 | (@code{split-window-vertically}) and @kbd{C-x ^} |
| 308 | (@code{enlarge-window}) which don't scroll the window, are | 304 | (@code{enlarge-window}) which don't exactly scroll but do affect where |
| 309 | nevertheless made available under this rubric, since they are likewise | 305 | the text appears on the screen. In general, it applies to any command |
| 310 | handy during a search. | 306 | whose name has a non-@code{nil} @code{isearch-scroll} property. So you |
| 307 | can control which commands are affected by changing these properties. | ||
| 311 | 308 | ||
| 312 | You can make other commands usable within an incremental search by | 309 | For example, to make @kbd{C-h l} usable within an incremental search |
| 313 | giving the command a non-@code{nil} @code{isearch-scroll} property. | ||
| 314 | For example, to make @kbd{C-h l} usable within an incremental search | ||
| 315 | in all future Emacs sessions, use @kbd{C-h c} to find what command it | 310 | in all future Emacs sessions, use @kbd{C-h c} to find what command it |
| 316 | runs. (You type @kbd{C-h c C-h l}; it says @code{view-lossage}.) Then | 311 | runs. (You type @kbd{C-h c C-h l}; it says @code{view-lossage}.) |
| 317 | you can put the following line in your @file{.emacs} file (@pxref{Init File}): | 312 | Then you can put the following line in your @file{.emacs} file |
| 313 | (@pxref{Init File}): | ||
| 318 | 314 | ||
| 319 | @example | 315 | @example |
| 320 | (put 'view-lossage 'isearch-scroll t) | 316 | (put 'view-lossage 'isearch-scroll t) |
| 321 | @end example | 317 | @end example |
| 322 | 318 | ||
| 323 | @noindent | 319 | @noindent |
| 324 | This works for commands that don't permanently change point, the | 320 | This feature can be applied to any command that doesn't permanently |
| 325 | buffer contents, the match data, the current buffer, or the selected | 321 | change point, the buffer contents, the match data, the current buffer, |
| 326 | window and frame. The command must not delete the current window and | 322 | or the selected window and frame. The command must not itself attempt |
| 327 | must not itself attempt an incremental search. | 323 | an incremental search. |
| 328 | 324 | ||
| 329 | @node Slow Isearch | 325 | @node Slow Isearch |
| 330 | @subsection Slow Terminal Incremental Search | 326 | @subsection Slow Terminal Incremental Search |
| @@ -387,7 +383,7 @@ which specifies a word search. | |||
| 387 | commands @code{search-forward} and @code{search-backward}. These | 383 | commands @code{search-forward} and @code{search-backward}. These |
| 388 | commands may be bound to keys in the usual manner. The feature that you | 384 | commands may be bound to keys in the usual manner. The feature that you |
| 389 | can get to them via the incremental search commands exists for | 385 | can get to them via the incremental search commands exists for |
| 390 | historical reasons, and to avoid the need to find key sequences | 386 | historical reasons, and to avoid the need to find separate key sequences |
| 391 | for them. | 387 | for them. |
| 392 | 388 | ||
| 393 | @node Word Search | 389 | @node Word Search |
| @@ -427,7 +423,7 @@ by constructing a regular expression and searching for that; see | |||
| 427 | @code{word-search-forward} and @code{word-search-backward}. These | 423 | @code{word-search-forward} and @code{word-search-backward}. These |
| 428 | commands may be bound to keys in the usual manner. They are available | 424 | commands may be bound to keys in the usual manner. They are available |
| 429 | via the incremental search commands both for historical reasons and | 425 | via the incremental search commands both for historical reasons and |
| 430 | to avoid the need to find suitable key sequences for them. | 426 | to avoid the need to find separate key sequences for them. |
| 431 | 427 | ||
| 432 | @node Regexp Search | 428 | @node Regexp Search |
| 433 | @section Regular Expression Search | 429 | @section Regular Expression Search |
| @@ -468,10 +464,10 @@ defaults. They also have separate search rings that you can access with | |||
| 468 | If you type @key{SPC} in incremental regexp search, it matches any | 464 | If you type @key{SPC} in incremental regexp search, it matches any |
| 469 | sequence of whitespace characters, including newlines. If you want to | 465 | sequence of whitespace characters, including newlines. If you want to |
| 470 | match just a space, type @kbd{C-q @key{SPC}}. You can control what a | 466 | match just a space, type @kbd{C-q @key{SPC}}. You can control what a |
| 471 | bare spece matches by setting the variable | 467 | bare space matches by setting the variable |
| 472 | @code{search-whitespace-regexp} to the desired regexp. | 468 | @code{search-whitespace-regexp} to the desired regexp. |
| 473 | 469 | ||
| 474 | Note that adding characters to the regexp in an incremental regexp | 470 | In some cases, adding characters to the regexp in an incremental regexp |
| 475 | search can make the cursor move back and start again. For example, if | 471 | search can make the cursor move back and start again. For example, if |
| 476 | you have searched for @samp{foo} and you add @samp{\|bar}, the cursor | 472 | you have searched for @samp{foo} and you add @samp{\|bar}, the cursor |
| 477 | backs up in case the first @samp{bar} precedes the first @samp{foo}. | 473 | backs up in case the first @samp{bar} precedes the first @samp{foo}. |
| @@ -932,7 +928,7 @@ of the pattern and asks you whether to replace it. | |||
| 932 | The replace commands normally operate on the text from point to the | 928 | The replace commands normally operate on the text from point to the |
| 933 | end of the buffer; however, in Transient Mark mode (@pxref{Transient | 929 | end of the buffer; however, in Transient Mark mode (@pxref{Transient |
| 934 | Mark}), when the mark is active, they operate on the region. The | 930 | Mark}), when the mark is active, they operate on the region. The |
| 935 | replace commands all replace one string (or regexp) with one | 931 | basic replace commands replace one string (or regexp) with one |
| 936 | replacement string. It is possible to perform several replacements in | 932 | replacement string. It is possible to perform several replacements in |
| 937 | parallel using the command @code{expand-region-abbrevs} | 933 | parallel using the command @code{expand-region-abbrevs} |
| 938 | (@pxref{Expanding Abbrevs}). | 934 | (@pxref{Expanding Abbrevs}). |
| @@ -1246,7 +1242,7 @@ Mark mode. | |||
| 1246 | @findex list-matching-lines | 1242 | @findex list-matching-lines |
| 1247 | @findex occur | 1243 | @findex occur |
| 1248 | @findex multi-occur | 1244 | @findex multi-occur |
| 1249 | @findex multi-occur-by-filename-regexp | 1245 | @findex multi-occur-in-matching-buffers |
| 1250 | @findex how-many | 1246 | @findex how-many |
| 1251 | @findex delete-non-matching-lines | 1247 | @findex delete-non-matching-lines |
| 1252 | @findex delete-matching-lines | 1248 | @findex delete-matching-lines |
| @@ -1273,19 +1269,21 @@ searched and moves point to the original of the chosen occurrence. | |||
| 1273 | @kbd{o} and @kbd{C-o} display the match in another window; @kbd{C-o} | 1269 | @kbd{o} and @kbd{C-o} display the match in another window; @kbd{C-o} |
| 1274 | does not select it. | 1270 | does not select it. |
| 1275 | 1271 | ||
| 1276 | Occur mode supports the @code{next-error} functionality described in | 1272 | After using @kbd{M-x occur}, you can use @code{next-error} to visit |
| 1277 | @ref{Compilation Mode}. | 1273 | the occurrences found, one by one. @ref{Compilation Mode}. |
| 1278 | 1274 | ||
| 1279 | @item M-x list-matching-lines | 1275 | @item M-x list-matching-lines |
| 1280 | Synonym for @kbd{M-x occur}. | 1276 | Synonym for @kbd{M-x occur}. |
| 1281 | 1277 | ||
| 1282 | @item M-x multi-occur @key{RET} @var{buffers} @key{RET} @var{regexp} @key{RET} | 1278 | @item M-x multi-occur @key{RET} @var{buffers} @key{RET} @var{regexp} @key{RET} |
| 1283 | This function is just like @code{occur}, except it is able to search | 1279 | This function is just like @code{occur}, except it is able to search |
| 1284 | through multiple buffers. | 1280 | through multiple buffers. It asks you to specify the buffer names one by one. |
| 1285 | 1281 | ||
| 1286 | @item M-x multi-occur-by-filename-regexp @key{RET} @var{bufregexp} @key{RET} @var{regexp} @key{RET} | 1282 | @item M-x multi-occur-in-matching-buffers @key{RET} @var{bufregexp} @key{RET} @var{regexp} @key{RET} |
| 1287 | This function is similar to @code{multi-occur}, except the buffers to | 1283 | This function is similar to @code{multi-occur}, except the buffers to |
| 1288 | search are specified by a regexp on their filename. | 1284 | search are specified by a regular expression that matches visited |
| 1285 | filenames. With a prefix argument, it uses the regular expression to match | ||
| 1286 | buffer names instead. | ||
| 1289 | 1287 | ||
| 1290 | @item M-x how-many @key{RET} @var{regexp} @key{RET} | 1288 | @item M-x how-many @key{RET} @var{regexp} @key{RET} |
| 1291 | Print the number of matches for @var{regexp} that exist in the buffer | 1289 | Print the number of matches for @var{regexp} that exist in the buffer |