Emacs: Search Text in Buffer

By Xah Lee. Date: . Last updated: .

This page shows you how to use search and highlight features in emacs.

The most useful one is “isearch”.

Alt+x isearch-forwardCtrl+s】 → interactive search.

emacs isearch 2016-11-02
emacs isearch. Ctrl+s

While in isearch:

How to make case sensitive in isearch?

By default, search is not case sensitive unless your search string contains Capital Letter.

While in isearch, press Alt+s c to toggle search case-sensitivity.

Or, Alt+x toggle-case-fold-search before isearch. Remember to toggle it back.

Search Word Under Cursor

While in isearch, press Ctrl+w to select more strings to the right of cursor.

The following commands do isearch but uses the word the cursor is on, saves you typing.


  1. Boundary check means, if current word or symbol is “xy”, it will not find “xy2”.
  2. emacs “word” usually means alphanumeric with hyphen. “symbol” means programing language's identifier. Whether LOW LINE _ or HYPHEN-MINUS - is part of “symbol” or “word” depends on current syntax table, which is usually different in different major modes.

Search Current Word Without Boundary Check

Emacs: isearch Current Word

Emacs Isearch Whitespace Regex

Emacs Isearch Whitespace Regex

isearch Keys/Modes

isearch has many complex features. You can read about them by:

I don't recommend using them. If you need regex search, use Alt+x list-matching-lines

[see Emacs: List/Highlight/Delete Matching Lines, Sort Reverse]

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial

Emacs Tutorial

Emacs Init

Emacs Keys


ELisp Examples

ELisp Write Major Mode

Emacs Tutorial

Quick Start

Manage Windows



Find Replace




Rectangle Edit

Line Wrap


View Doc

Working with Brackets

Power Editing

Org Mode


Emacs Efficiency