diff options
| author | Richard M. Stallman | 2001-02-19 01:57:45 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-02-19 01:57:45 +0000 |
| commit | 91cf190988beb54c28478d5bc9e30bbf91bdf2dd (patch) | |
| tree | 56a4b94dc2034049a0435773edf3e6d6dd2b9807 | |
| parent | 6ebbcf5986f63acdae5296e35ed616fea95c3145 (diff) | |
| download | emacs-91cf190988beb54c28478d5bc9e30bbf91bdf2dd.tar.gz emacs-91cf190988beb54c28478d5bc9e30bbf91bdf2dd.zip | |
Comment out description of re-builder.
Clarify isearch highlighting info and input method info.
Rewrite descriptions of non-greedy repetition, \{...\},
and shy groups.
Rewrite "Other Repeating Search" node.
Other small clarifications.
| -rw-r--r-- | man/search.texi | 217 |
1 files changed, 115 insertions, 102 deletions
diff --git a/man/search.texi b/man/search.texi index 5383b0d2be8..19303c13209 100644 --- a/man/search.texi +++ b/man/search.texi | |||
| @@ -58,8 +58,7 @@ the cursor move to after the first @samp{FO}. After another @kbd{O}, the | |||
| 58 | cursor is after the first @samp{FOO} after the place where you started the | 58 | cursor is after the first @samp{FOO} after the place where you started the |
| 59 | search. At each step, the buffer text that matches the search string is | 59 | search. At each step, the buffer text that matches the search string is |
| 60 | highlighted, if the terminal can do that; at each step, the current search | 60 | highlighted, if the terminal can do that; at each step, the current search |
| 61 | string is updated in the echo area. Multilingual text can be input by | 61 | string is updated in the echo area. |
| 62 | toggling input methods with @kbd{C-\} or @kbd{C-^}, see below. | ||
| 63 | 62 | ||
| 64 | If you make a mistake in typing the search string, you can cancel | 63 | If you make a mistake in typing the search string, you can cancel |
| 65 | characters with @key{DEL}. Each @key{DEL} cancels the last character of | 64 | characters with @key{DEL}. Each @key{DEL} cancels the last character of |
| @@ -79,11 +78,11 @@ special within searches (@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s}, | |||
| 79 | @kbd{C-y}, @kbd{M-y}, @kbd{M-r}, or @kbd{M-s}). | 78 | @kbd{C-y}, @kbd{M-y}, @kbd{M-r}, or @kbd{M-s}). |
| 80 | 79 | ||
| 81 | Sometimes you search for @samp{FOO} and find it, but not the one you | 80 | Sometimes you search for @samp{FOO} and find it, but not the one you |
| 82 | expected to find. There was a second @samp{FOO} that you forgot about, | 81 | expected to find. There was a second @samp{FOO} that you forgot |
| 83 | before the one you were aiming for. In this event, type another @kbd{C-s} | 82 | about, before the one you were aiming for. In this event, type |
| 84 | to move to the next occurrence of the search string. This can be done any | 83 | another @kbd{C-s} to move to the next occurrence of the search string. |
| 85 | number of times. If you overshoot, you can cancel some @kbd{C-s} | 84 | You can repeat this any number of times. If you overshoot, you can |
| 86 | characters with @key{DEL}. | 85 | cancel some @kbd{C-s} characters with @key{DEL}. |
| 87 | 86 | ||
| 88 | After you exit a search, you can search for the same string again by | 87 | After you exit a search, you can search for the same string again by |
| 89 | typing just @kbd{C-s C-s}: the first @kbd{C-s} is the key that invokes | 88 | typing just @kbd{C-s C-s}: the first @kbd{C-s} is the key that invokes |
| @@ -112,15 +111,24 @@ entirely, returning point to where it was when the search started. | |||
| 112 | case-sensitive. If you delete the upper-case character from the search | 111 | case-sensitive. If you delete the upper-case character from the search |
| 113 | string, it ceases to have this effect. @xref{Search Case}. | 112 | string, it ceases to have this effect. @xref{Search Case}. |
| 114 | 113 | ||
| 114 | To search for a newline, type @kbd{C-j}. To search for another | ||
| 115 | control character, such as control-S or carriage return, you must quote | ||
| 116 | it by typing @kbd{C-q} first. This function of @kbd{C-q} is analogous | ||
| 117 | to its use for insertion (@pxref{Inserting Text}): it causes the | ||
| 118 | following character to be treated the way any ``ordinary'' character is | ||
| 119 | treated in the same context. You can also specify a character by its | ||
| 120 | octal code: enter @kbd{C-q} followed by a sequence of octal digits. | ||
| 121 | |||
| 115 | @cindex searching for non-ASCII characters | 122 | @cindex searching for non-ASCII characters |
| 116 | @cindex input method, during incremental search | 123 | @cindex input method, during incremental search |
| 117 | If an input method (@pxref{Input Methods}) is turned on in the | 124 | To search for non-ASCII characters, you must use an input method |
| 118 | current buffer when you start the search, that input method is used to | 125 | (@pxref{Input Methods}). If an input method is turned on in the |
| 119 | read the characters while you type the search string. Emacs indicates | 126 | current buffer when you start the search, you can use it while you |
| 120 | that by including the input method mnemonic in its prompt, like this: | 127 | type the search string also. Emacs indicates that by including the |
| 128 | input method mnemonic in its prompt, like this: | ||
| 121 | 129 | ||
| 122 | @example | 130 | @example |
| 123 | I-search [@var{im}]: | 131 | I-search [@var{im}]: |
| 124 | @end example | 132 | @end example |
| 125 | 133 | ||
| 126 | @noindent | 134 | @noindent |
| @@ -135,12 +143,13 @@ name of the input method. Note that the input method you turn on | |||
| 135 | during incremental search is turned on in the current buffer as well. | 143 | during incremental search is turned on in the current buffer as well. |
| 136 | 144 | ||
| 137 | If a search is failing and you ask to repeat it by typing another | 145 | If a search is failing and you ask to repeat it by typing another |
| 138 | @kbd{C-s}, it starts again from the beginning of the buffer. Repeating | 146 | @kbd{C-s}, it starts again from the beginning of the buffer. |
| 139 | a failing reverse search with @kbd{C-r} starts again from the end. This | 147 | Repeating a failing reverse search with @kbd{C-r} starts again from |
| 140 | is called @dfn{wrapping around}. @samp{Wrapped} appears in the search | 148 | the end. This is called @dfn{wrapping around}, and @samp{Wrapped} |
| 141 | prompt once this has happened. If you keep on going past the original | 149 | appears in the search prompt once this has happened. If you keep on |
| 142 | starting point of the search, it changes to @samp{Overwrapped}, which | 150 | going past the original starting point of the search, it changes to |
| 143 | means that you are revisiting matches that you have already seen. | 151 | @samp{Overwrapped}, which means that you are revisiting matches that |
| 152 | you have already seen. | ||
| 144 | 153 | ||
| 145 | @cindex quitting (in search) | 154 | @cindex quitting (in search) |
| 146 | The @kbd{C-g} ``quit'' character does special things during searches; | 155 | The @kbd{C-g} ``quit'' character does special things during searches; |
| @@ -154,14 +163,6 @@ been found are discarded from the search string. With them gone, the | |||
| 154 | search is now successful and waiting for more input, so a second @kbd{C-g} | 163 | search is now successful and waiting for more input, so a second @kbd{C-g} |
| 155 | will cancel the entire search. | 164 | will cancel the entire search. |
| 156 | 165 | ||
| 157 | To search for a newline, type @kbd{C-j}. To search for another | ||
| 158 | control character, such as control-S or carriage return, you must quote | ||
| 159 | it by typing @kbd{C-q} first. This function of @kbd{C-q} is analogous | ||
| 160 | to its use for insertion (@pxref{Inserting Text}): it causes the | ||
| 161 | following character to be treated the way any ``ordinary'' character is | ||
| 162 | treated in the same context. You can also specify a character by its | ||
| 163 | octal code: enter @kbd{C-q} followed by a sequence of octal digits. | ||
| 164 | |||
| 165 | You can change to searching backwards with @kbd{C-r}. If a search fails | 166 | You can change to searching backwards with @kbd{C-r}. If a search fails |
| 166 | because the place you started was too late in the file, you should do this. | 167 | because the place you started was too late in the file, you should do this. |
| 167 | Repeated @kbd{C-r} keeps looking for more occurrences backwards. A | 168 | Repeated @kbd{C-r} keeps looking for more occurrences backwards. A |
| @@ -189,7 +190,7 @@ search remains case-insensitive. | |||
| 189 | 190 | ||
| 190 | The character @kbd{M-y} copies text from the kill ring into the search | 191 | The character @kbd{M-y} copies text from the kill ring into the search |
| 191 | string. It uses the same text that @kbd{C-y} as a command would yank. | 192 | string. It uses the same text that @kbd{C-y} as a command would yank. |
| 192 | @kbd{mouse-2} in the echo area does the same. | 193 | @kbd{Mouse-2} in the echo area does the same. |
| 193 | @xref{Yanking}. | 194 | @xref{Yanking}. |
| 194 | 195 | ||
| 195 | When you exit the incremental search, it sets the mark to where point | 196 | When you exit the incremental search, it sets the mark to where point |
| @@ -198,28 +199,20 @@ there. In Transient Mark mode, incremental search sets the mark without | |||
| 198 | activating it, and does so only if the mark is not already active. | 199 | activating it, and does so only if the mark is not already active. |
| 199 | 200 | ||
| 200 | @cindex lazy search highlighting | 201 | @cindex lazy search highlighting |
| 201 | By default, Isearch uses @dfn{lazy highlighting}. All matches for | ||
| 202 | the current search string in the buffer after the point where searching | ||
| 203 | starts are highlighted. The extra highlighting makes it easier to | ||
| 204 | anticipate where the cursor will end up each time you press @kbd{C-s} or | ||
| 205 | @kbd{C-r} to repeat a pending search. Highlighting of these additional | ||
| 206 | matches happens in a deferred fashion so as not to rob Isearch of its | ||
| 207 | usual snappy response. | ||
| 208 | @vindex isearch-lazy-highlight-cleanup | ||
| 209 | @findex isearch-lazy-highlight-cleanup | ||
| 210 | By default the highlighting of matches is cleared when you end the | ||
| 211 | search. Customize the variable @code{isearch-lazy-highlight-cleanup} to | ||
| 212 | avoid cleaning up automatically. The command @kbd{M-x | ||
| 213 | isearch-lazy-highlight-cleanup} can be used to clean up manually. | ||
| 214 | @vindex isearch-lazy-highlight | 202 | @vindex isearch-lazy-highlight |
| 215 | Customize the variable @code{isearch-lazy-highlight} to turn off this | 203 | When you pause for a little while during incremental search, it |
| 216 | feature. | 204 | highlights all other possible matches for the search string. This |
| 205 | makes it easier to anticipate where you can get to by typing @kbd{C-s} | ||
| 206 | or @kbd{C-r} to repeat the search. The short delay before highlighting | ||
| 207 | other matches helps indicate which match is the current one. | ||
| 208 | If you don't like this feature, you can turn it off by setting | ||
| 209 | @code{isearch-lazy-highlight} to @code{nil}. | ||
| 217 | 210 | ||
| 218 | @vindex isearch-lazy-highlight-face | 211 | @vindex isearch-lazy-highlight-face |
| 219 | @cindex faces for highlighting search matches | 212 | @cindex faces for highlighting search matches |
| 220 | You can control how does the highlighting of matches look like by | 213 | You can control how does the highlighting of matches look like by |
| 221 | customizing the faces @code{isearch} (highlights the current match) and | 214 | customizing the faces @code{isearch} (used for the current match) and |
| 222 | @code{isearch-lazy-highlight-face} (highlights the other matches). | 215 | @code{isearch-lazy-highlight-face} (used for the other matches). |
| 223 | 216 | ||
| 224 | @vindex isearch-mode-map | 217 | @vindex isearch-mode-map |
| 225 | To customize the special characters that incremental search understands, | 218 | To customize the special characters that incremental search understands, |
| @@ -240,11 +233,6 @@ on the screen. | |||
| 240 | Then Emacs redisplays the window in which the search was done, to show | 233 | Then Emacs redisplays the window in which the search was done, to show |
| 241 | its new position of point. | 234 | its new position of point. |
| 242 | 235 | ||
| 243 | @ignore | ||
| 244 | The three dots at the end of the search string, normally used to indicate | ||
| 245 | that searching is going on, are not displayed in slow style display. | ||
| 246 | @end ignore | ||
| 247 | |||
| 248 | @vindex search-slow-speed | 236 | @vindex search-slow-speed |
| 249 | The slow terminal style of display is used when the terminal baud rate is | 237 | The slow terminal style of display is used when the terminal baud rate is |
| 250 | less than or equal to the value of the variable @code{search-slow-speed}, | 238 | less than or equal to the value of the variable @code{search-slow-speed}, |
| @@ -459,20 +447,31 @@ preceding expression either once or not at all. For example, | |||
| 459 | @item *?, +?, ?? | 447 | @item *?, +?, ?? |
| 460 | @cindex non-greedy regexp matching | 448 | @cindex non-greedy regexp matching |
| 461 | are non-greedy variants of the operators above. The normal operators | 449 | are non-greedy variants of the operators above. The normal operators |
| 462 | @samp{*}, @samp{+}, @samp{?} are @dfn{greedy} in that they match as much | 450 | @samp{*}, @samp{+}, @samp{?} are @dfn{greedy} in that they match as |
| 463 | as they can, while if you append a @samp{?} after them, it makes them | 451 | much as they can, as long as the overall regexp can still match. With |
| 464 | non-greedy: they will match as little as possible. | 452 | a following @samp{?}, they are non-greedy: they will match as little |
| 453 | as possible. | ||
| 454 | |||
| 455 | Thus, both @samp{ab*} and @samp{ab*?} can match the string @samp{a} | ||
| 456 | and the string @samp{abbbb}; but if you try to match them both against | ||
| 457 | the text @samp{abbb}, @samp{ab*} will match it all (the longest valid | ||
| 458 | match), while @samp{ab*?} will match just @samp{a} (the shortest | ||
| 459 | valid match). | ||
| 460 | |||
| 461 | @item \@{@var{n}\@} | ||
| 462 | is a postfix operator that specifies repetition @var{n} times---that | ||
| 463 | is, the preceding regular expression must match exactly @var{n} times | ||
| 464 | in a row. For example, @samp{x\@{4\@}} matches the string @samp{xxxx} | ||
| 465 | and nothing else. | ||
| 465 | 466 | ||
| 466 | @item \@{@var{n},@var{m}\@} | 467 | @item \@{@var{n},@var{m}\@} |
| 467 | is another postfix operator that specifies an interval of iteration: | 468 | is a postfix operator that specifies repetition between @var{n} and |
| 468 | the preceding regular expression must match between @var{n} and | 469 | @var{m} times---that is, the preceding regular expression must match |
| 469 | @var{m} times. If @var{m} is omitted, then there is no upper bound | 470 | at least @var{n} times, but no more than @var{m} times. If @var{m} is |
| 470 | and if @samp{,@var{m}} is omitted, then the regular expression must match | 471 | omitted, then there is no upper limit, but the preceding regular |
| 471 | exactly @var{n} times. @* | 472 | expression must match at least @var{n} times.@* @samp{\@{0,1\@}} is |
| 472 | @samp{\@{0,1\@}} is equivalent to @samp{?}. @* | 473 | equivalent to @samp{?}. @* @samp{\@{0,\@}} is equivalent to |
| 473 | @samp{\@{0,\@}} is equivalent to @samp{*}. @* | 474 | @samp{*}. @* @samp{\@{1,\@}} is equivalent to @samp{+}. |
| 474 | @samp{\@{1,\@}} is equivalent to @samp{+}. @* | ||
| 475 | @samp{\@{@var{n}\@}} is equivalent to @samp{\@{@var{n},@var{n}\@}}. | ||
| 476 | 475 | ||
| 477 | @item [ @dots{} ] | 476 | @item [ @dots{} ] |
| 478 | is a @dfn{character set}, which begins with @samp{[} and is terminated | 477 | is a @dfn{character set}, which begins with @samp{[} and is terminated |
| @@ -591,15 +590,16 @@ To record a matched substring for future reference. | |||
| 591 | This last application is not a consequence of the idea of a | 590 | This last application is not a consequence of the idea of a |
| 592 | parenthetical grouping; it is a separate feature that is assigned as a | 591 | parenthetical grouping; it is a separate feature that is assigned as a |
| 593 | second meaning to the same @samp{\( @dots{} \)} construct. In practice | 592 | second meaning to the same @samp{\( @dots{} \)} construct. In practice |
| 594 | there is almost no conflict between the two meanings. | 593 | there is usually no conflict between the two meanings; when there is |
| 594 | a conflict, you can use a ``shy'' group. | ||
| 595 | 595 | ||
| 596 | @item \(?: @dots{} \) | 596 | @item \(?: @dots{} \) |
| 597 | is another grouping construct (often called ``shy'') that serves the same | 597 | @cindex shy group, in regexp |
| 598 | first two purposes, but not the third: | 598 | specifies a ``shy'' group that does not record the matched substring; |
| 599 | it cannot be referred to later on by number. This is only useful | 599 | you can't refer back to it with @samp{\@var{d}}. This is useful |
| 600 | for mechanically constructed regular expressions where grouping | 600 | in mechanically combining regular expressions, so that you |
| 601 | constructs need to be introduced implicitly and hence risk changing the | 601 | can add groups for syntactic purposes without interfering with |
| 602 | numbering of subsequent groups. | 602 | the numbering of the groups that were written by the user. |
| 603 | 603 | ||
| 604 | @item \@var{d} | 604 | @item \@var{d} |
| 605 | matches the same text that matched the @var{d}th occurrence of a | 605 | matches the same text that matched the @var{d}th occurrence of a |
| @@ -718,18 +718,26 @@ of times. | |||
| 718 | enter a tab, and @kbd{C-j} to enter a newline. You would also type | 718 | enter a tab, and @kbd{C-j} to enter a newline. You would also type |
| 719 | single backslashes as themselves, instead of doubling them for Lisp syntax. | 719 | single backslashes as themselves, instead of doubling them for Lisp syntax. |
| 720 | 720 | ||
| 721 | @ignore | ||
| 722 | @c I commented this out because it is missing vital information | ||
| 723 | @c and therefore useless. For instance, what do you do to *use* the | ||
| 724 | @c regular expression when it is finished? What jobs is this good for? | ||
| 725 | @c -- rms | ||
| 726 | |||
| 721 | @findex re-builder | 727 | @findex re-builder |
| 722 | @cindex authoring regular expressions | 728 | @cindex authoring regular expressions |
| 723 | For easier authoring of regular expressions, you can use the @kbd{M-x | 729 | For convenient interactive development of regular expressions, you |
| 724 | re-builder} command. It provides a convenient interface for creating | 730 | can use the @kbd{M-x re-builder} command. It provides a convenient |
| 725 | regular expressions, by giving immediate visual feedback. The buffer | 731 | interface for creating regular expressions, by giving immediate visual |
| 726 | from which @code{re-builder} was invoked becomes the target for the | 732 | feedback. The buffer from which @code{re-builder} was invoked becomes |
| 727 | regexp editor, which pops in a separate window. Text that matches the | 733 | the target for the regexp editor, which pops in a separate window. At |
| 728 | regular expression you typed so far is color marked in the target | 734 | all times, all the matches in the target buffer for the current |
| 729 | buffer. Each parenthesized sub-expression of the regexp is shown in a | 735 | regular expression are highlighted. Each parenthesized sub-expression |
| 730 | distinct face, which makes it easier to verify even very complex | 736 | of the regexp is shown in a distinct face, which makes it easier to |
| 731 | regexps. (On displays that don't support colors, Emacs blinks the | 737 | verify even very complex regexps. (On displays that don't support |
| 732 | cursor around the matched text, like it does for matching parens.) | 738 | colors, Emacs blinks the cursor around the matched text, as it does |
| 739 | for matching parens.) | ||
| 740 | @end ignore | ||
| 733 | 741 | ||
| 734 | @node Search Case, Replace, Regexps, Search | 742 | @node Search Case, Replace, Regexps, Search |
| 735 | @section Searching and Case | 743 | @section Searching and Case |
| @@ -972,13 +980,16 @@ to delete the occurrence, and then enter a recursive editing level as in | |||
| 972 | occurrence of @var{string}. When done, exit the recursive editing level | 980 | occurrence of @var{string}. When done, exit the recursive editing level |
| 973 | with @kbd{C-M-c} to proceed to the next occurrence. | 981 | with @kbd{C-M-c} to proceed to the next occurrence. |
| 974 | 982 | ||
| 983 | @item e | ||
| 984 | to edit the replacement string in the minibuffer. When you exit the | ||
| 985 | minibuffer by typing @key{RET}, the minibuffer contents replace the | ||
| 986 | current occurrence of the pattern. They also become the new | ||
| 987 | replacement string for any further occurrences. | ||
| 988 | |||
| 975 | @item C-l | 989 | @item C-l |
| 976 | to redisplay the screen. Then you must type another character to | 990 | to redisplay the screen. Then you must type another character to |
| 977 | specify what to do with this occurrence. | 991 | specify what to do with this occurrence. |
| 978 | 992 | ||
| 979 | @item e | ||
| 980 | to let you edit the replacement string. | ||
| 981 | |||
| 982 | @item C-h | 993 | @item C-h |
| 983 | to display a message summarizing these options. Then you must type | 994 | to display a message summarizing these options. Then you must type |
| 984 | another character to specify what to do with this occurrence. | 995 | another character to specify what to do with this occurrence. |
| @@ -1005,9 +1016,10 @@ copy, or link files by replacing regexp matches in file names. | |||
| 1005 | @section Other Search-and-Loop Commands | 1016 | @section Other Search-and-Loop Commands |
| 1006 | 1017 | ||
| 1007 | Here are some other commands that find matches for a regular | 1018 | Here are some other commands that find matches for a regular |
| 1008 | expression. They all operate from point to the end of the buffer, and | 1019 | expression. They all ignore case in matching, if the pattern contains |
| 1009 | all ignore case in matching, if the pattern contains no upper-case | 1020 | no upper-case letters and @code{case-fold-search} is non-@code{nil}. |
| 1010 | letters and @code{case-fold-search} is non-@code{nil}. | 1021 | Aside from @code{occur}, all operate on the text from point to the end |
| 1022 | of the buffer, or on the active region in Transient Mark mode. | ||
| 1011 | 1023 | ||
| 1012 | @findex list-matching-lines | 1024 | @findex list-matching-lines |
| 1013 | @findex occur | 1025 | @findex occur |
| @@ -1019,11 +1031,11 @@ letters and @code{case-fold-search} is non-@code{nil}. | |||
| 1019 | 1031 | ||
| 1020 | @table @kbd | 1032 | @table @kbd |
| 1021 | @item M-x occur @key{RET} @var{regexp} @key{RET} | 1033 | @item M-x occur @key{RET} @var{regexp} @key{RET} |
| 1022 | Display a list showing each line in the buffer that contains a match for | 1034 | Display a list showing each line in the buffer that contains a match |
| 1023 | @var{regexp}. A numeric argument specifies the number of context lines | 1035 | for @var{regexp}. To limit the search to part of the buffer, narrow |
| 1024 | to print before and after each matching line; the default is none. | 1036 | to that part (@pxref{Narrowing}). A numeric argument @var{n} |
| 1025 | To limit the search to part of the buffer, narrow to that part | 1037 | specifies to display @var{n} lines of context before and after each |
| 1026 | (@pxref{Narrowing}). | 1038 | matching line. |
| 1027 | 1039 | ||
| 1028 | @kindex RET @r{(Occur mode)} | 1040 | @kindex RET @r{(Occur mode)} |
| 1029 | The buffer @samp{*Occur*} containing the output serves as a menu for | 1041 | The buffer @samp{*Occur*} containing the output serves as a menu for |
| @@ -1036,22 +1048,23 @@ moves point to the original of the chosen occurrence. | |||
| 1036 | Synonym for @kbd{M-x occur}. | 1048 | Synonym for @kbd{M-x occur}. |
| 1037 | 1049 | ||
| 1038 | @item M-x how-many @key{RET} @var{regexp} @key{RET} | 1050 | @item M-x how-many @key{RET} @var{regexp} @key{RET} |
| 1039 | Print the number of matches for @var{regexp} after point, or in the | 1051 | Print the number of matches for @var{regexp} that exist in the buffer |
| 1040 | active region in Transient Mark mode. | 1052 | after point. In Transient Mark mode, if the region is active, the |
| 1053 | command operates on the region instead. | ||
| 1041 | 1054 | ||
| 1042 | @item M-x flush-lines @key{RET} @var{regexp} @key{RET} | 1055 | @item M-x flush-lines @key{RET} @var{regexp} @key{RET} |
| 1043 | Delete each line after point, or in the active region in Transient Mark | 1056 | Delete each line that contains a match for @var{regexp}, operating on |
| 1044 | mode, that contains a match for @var{regexp}. | 1057 | the text after point. In Transient Mark mode, if the region is |
| 1058 | active, the command operates on the region instead. | ||
| 1045 | 1059 | ||
| 1046 | @item M-x keep-lines @key{RET} @var{regexp} @key{RET} | 1060 | @item M-x keep-lines @key{RET} @var{regexp} @key{RET} |
| 1047 | Delete each line that follows point, or is in the active region in | 1061 | Delete each line that @emph{does not} contain a match for |
| 1048 | Transient Mark mode, and @emph{does not} contain a match for | 1062 | @var{regexp}, operating on the text after point. In Transient Mark |
| 1049 | @var{regexp}. | 1063 | mode, if the region is active, the command operates on the region |
| 1064 | instead. | ||
| 1050 | @end table | 1065 | @end table |
| 1051 | 1066 | ||
| 1052 | Searching and replacing can be performed under the control of tags | 1067 | You can also search multiple files under control of a tags table |
| 1053 | files (@pxref{Tags Search}) and Dired (@pxref{Operating on Files}). | 1068 | (@pxref{Tags Search}) or through Dired @kbd{A} command |
| 1054 | 1069 | (@pxref{Operating on Files}), or ask the @code{grep} program to do it | |
| 1055 | In addition, you can use @code{grep} from Emacs to search a collection | 1070 | (@pxref{Grep Searching}). |
| 1056 | of files for matches for a regular expression, then visit the matches | ||
| 1057 | either sequentially or in arbitrary order. @xref{Grep Searching}. | ||