# isearch-forward(2)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

isearch-forward - Search forward incrementally (interactive)
isearch-backward - Search backwards incrementally (interactive)

## SYNOPSIS

n isearch-forward [ "arg" ] (C-s)
n isearch-backward [ "arg" ] (C-r)

## DESCRIPTION

isearch-forward provides an interactive search in the forward direction. This command is similar to search-forward(2), but it processes the search as each character of the input string is typed in. This allows the user to only use as many key-strokes as are needed to uniquely specify the string being searched. The string argument arg is not supplied when invoked interactively.

The follow keys can be used at the start of an incremental search only:

`C-s` - Search for last string.
`C-m` - Perform a search-forward instead.
`esc p`,
`esc n` - Scroll through history list etc (See ml-bind-key(2)).

Several control characters are active while isearching:

C-s or C-x

Skip to the next occurrence of the current string

C-r

Skip to the last occurrence of the current string

C-h

Back up to the last match (possibly deleting the last character on the search string)

C-w

Insert the next word into the search string.

C-g

Abort the search, return to start.

esc or C-m

End the search, stay here

isearch-backward is the same as isearch-forward, but it searches in the reverse direction.

For both commands when the end of the buffer is reached, an alarm is raised (bell etc.) a further search request (`C-s`) causes the search to commence from the start of the buffer.

The numeric argument n controls the behavior of isearch-* at the end of the buffer. When specified as `0` then the search exits when the start/end of the buffer is reached and the search is exhausted. When omitted (or specified as `1`) then the search recommences again at the start/end of the buffer, this is the default behavior.

When isearch-* is invoked from a macro then the string argument arg specifies the search string. isearch is primarily designed for for interactive use and is not typically used from within a macro. When embedded in a macro then it is typically invoked with the `0` argument so that the calling macro may handle the start/end of buffer condition. The macro page-file(3) uses isearch-* and performs exactly this operation, for a comprehensive example refer to macro file `pagefile.emf`.

## NOTES

The ml-bind-key(2) bindings are used.

The incremental search supports buffer modes exact(2m) and magic(2m).

## HISTORY

The numeric argument to isearch-* was first introduced into MicroEmacs '04.

## BUGS

Due to the dynamic nature of active ipipe-shell-command(2) buffers the search history cannot be stored in the same way (list of fixed locations). As a result the search history is stored as a list of searches which are not guaranteed to be consistent.

## SEE ALSO

exact(2m), hunt-forward(2), magic(2m), ml-bind-key(2), narrow-search-forward(3), page-file(3), search-forward(2).
Regular Expressions

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>