Next: Regexp Search, Previous: Word Search, Up: Search [Contents][Index]

### 15.4 Symbol Search

A symbol search is much like an ordinary search, except that the boundaries of the search must match the boundaries of a symbol. The meaning of symbol in this context depends on the major mode, and usually refers to a source code token, such as a Lisp symbol in Emacs Lisp mode. For instance, if you perform an incremental symbol search for the Lisp symbol `forward-word`, it would not match `isearch-forward-word`. This feature is thus mainly useful for searching source code.

`M-s _`

  If incremental search is active, toggle symbol search mode (`isearch-toggle-symbol`); otherwise, begin an incremental forward symbol search (`isearch-forward-symbol`).

`M-s .`

  Start a symbol incremental search forward with the symbol found near point added to the search string initially.

`M-s _ RET symbol RET`

  Search forward for symbol, nonincrementally.

`M-s _ C-r RET symbol RET`

  Search backward for symbol, nonincrementally.

To begin a forward incremental symbol search, type `M-s _` (or `M-s .` if the symbol to search is near point). If incremental search is not already active, this runs the command `isearch-forward-symbol`. If incremental search is already active, `M-s _` switches to a symbol search, preserving the direction of the search and the current search string; you can disable symbol search by typing `M-s _` again. In incremental symbol search, only the beginning of the search string is required to match the beginning of a symbol.

To begin a nonincremental symbol search, type `M-s _ RET` for a forward search, or `M-s _ C-r RET` or a backward search. In nonincremental symbol searches, the beginning and end of the search string are required to match the beginning and end of a symbol, respectively.

The symbol search commands don’t perform character folding, and toggling lax whitespace matching (see lax space matching) has no effect on them.

Next: Regexp Search, Previous: Word Search, Up: Search [Contents][Index]