Next: , Previous: Incremental Search, Up: Search


12.2 Non-Incremental Search

Emacs also has conventional non-incremental search commands, which require you type the entire search string before searching begins.

C-s <RET> string <RET>
Search for string.
C-r <RET> string <RET>
Search backward for string.

To do a non-incremental search, first type C-s <RET> (or C-s C-m). This enters the minibuffer to read the search string. Terminate the string with <RET> to start the search. If the string is not found, the search command gets an error.

By default, C-s invokes incremental search, but if you give it an empty argument, which would otherwise be useless, it invokes non-incremental search. Therefore, C-s <RET> invokes non-incremental search. C-r <RET> also works this way.

Forward and backward non-incremental searches are implemented by the commands search-forward and search-backward. You can bind these commands to keys. The reason that incremental search is programmed to invoke them as well is that C-s <RET> is the traditional sequence of characters used in Emacs to invoke non-incremental search.

Non-incremental searches performed using C-s <RET> do not call search-forward right away. They first check if the next character is C-w, which requests a word search.