Next: , Previous: , Up: Incremental Search   [Contents][Index]

15.1.3 Isearch Yanking

In many cases, you will want to use text at or near point as your search string. The commands described in this subsection let you do that conveniently.

C-w (isearch-yank-word-or-char) appends the next character or word at point to the search string. This is an easy way to search for another occurrence of the text at point. (The decision of whether to copy a character or a word is heuristic.) With a prefix numeric argument of n, append the next n characters or words.

C-M-w (isearch-yank-symbol-or-char) appends the next character or symbol at point to the search string. This is an easy way to search for another occurrence of the symbol at point. (The decision of whether to copy a character or a symbol is heuristic.) With a prefix numeric argument of n, append the next n characters or symbols.

M-s C-e (isearch-yank-line) appends the rest of the current line to the search string. If point is already at the end of a line, it appends the next line. With a prefix argument n, it appends the next n lines.

Similarly, C-M-z (isearch-yank-until-char) appends to the search string everything from point until the next occurrence of a specified character (not including that character). This is especially useful for keyboard macros, for example in programming languages or markup languages in which that character marks a token boundary. With a prefix numeric argument of n, the command appends everything from point to the nth occurrence of the specified character.

Within incremental search, C-y (isearch-yank-kill) appends the current kill to the search string. M-y (isearch-yank-pop), if called after C-y, replaces that appended text with an earlier kill, similar to the usual M-y (yank-pop) command (see Yanking). Clicking mouse-2 in the echo area appends the current X selection (see Primary Selection) to the search string (isearch-yank-x-selection).

C-M-d (isearch-del-char) deletes the last character from the search string, and C-M-y (isearch-yank-char) appends the character after point to the search string. An alternative method to add the character after point is to enter the minibuffer with M-e (see Repeat Isearch) and type C-f or RIGHT at the end of the search string in the minibuffer. Each C-f or RIGHT you type adds another character following point to the search string.

Normally, when the search is case-insensitive, text yanked into the search string is converted to lower case, so that the search remains case-insensitive (see case folding). However, if the value of the variable search-upper-case (see search-upper-case) is other than not-yanks, that disables this down-casing.

Next: , Previous: , Up: Incremental Search   [Contents][Index]