[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Interactive query-replace

From: Ole Laursen
Subject: Interactive query-replace
Date: Thu, 9 Feb 2017 22:27:30 +0100


I realized the other day that search and replace in Emacs isn't very
interactive when a coworker showed me another editor he was
experimenting with. What he somehow did there seemed like something
Emacs would do when query-replacing, only it doesn't.

Search and replace has three phases:

- Enter search term
- Enter replacement term
- Confirmation

Only confirmation is interactive in Emacs.

The search phase could move the cursor and highlight all matches as
you type, just like isearch. Then we can see what we're about to

Replacement text phase could overwrite each match visible in the
buffer with the replacement text as you type it. The replacements
would still be highlighted so it's obvious what's happening. Then we
can actually evaluate how the replacement works in practice in the
buffer before committing to it.

Confirmation then actually commits the changes to the buffer, just like today.

Doesn't this sound like something Emacs should be doing?

I'll admit I have no idea how to actually implement it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]