Begin incremental search (
Begin reverse incremental search (
isearch-forward) starts a forward incremental
search. It reads characters from the keyboard, and moves point just
past the end of the next occurrence of those characters in the buffer.
For instance, if you type C-s and then F, that puts the cursor after the first ‘F’ that occurs in the buffer after the starting point. Then if you then type O, the cursor moves to just after the first ‘FO’; the ‘F’ in that ‘FO’ might not be the first ‘F’ previously found. After another O, the cursor moves to just after the first ‘FOO’.
At each step, Emacs highlights the current match—the buffer
text that matches the search string—using the
(see Faces). The current search string is also displayed in the
If you make a mistake typing the search string, type DEL. Each DEL cancels the last character of the search string.
When you are satisfied with the place you have reached, type RET. This stops searching, leaving the cursor where the search brought it. Also, any command not specially meaningful in searches stops the searching and is then executed. Thus, typing C-a exits the search and then moves to the beginning of the line. RET is necessary only if the next command you want to type is a printing character, DEL, RET, or another character that is special within searches (C-q, C-w, C-r, C-s, C-y, M-y, M-r, M-c, M-e, and some others described below).
As a special exception, entering RET when the search string is empty launches nonincremental search (see Nonincremental Search).
When you exit the incremental search, it adds the original value of point to the mark ring, without activating the mark; you can thus use C-u C-SPC to return to where you were before beginning the search. See Mark Ring. It only does this if the mark was not already active.
To search backwards, use C-r (
of C-s to start the search. A backward search finds matches
that end before the starting point, just as a forward search finds
matches that begin after it.