Re: [PATCH] Optional preview of the replacement text while typing it

Juri Linkov <[email protected]> Sun, 09 Aug 2026 09:49:54 +0300
Newsgroups gmane.emacs.devel
Organization LINKOV.NET
Message-ID <[email protected]>
>> Have you tried to generalize `minibuffer-lazy-highlight-setup'
>> to use for displaying replacements?  For example, by providing
>> a lambda to make replacements from the matches.  But probably
>> it's not possible to use the argument 'transform' since
>> every match might be transformed to different replacements.
>> So lazy-highlight would need to display different strings
>> instead of one search string like Isearch does.
>
> I hadn't considered it before you asked.  Sharing the minibuffer part
> looks easy: my 'replace-preview-setup' is nearly a copy of the skeleton
> of 'minibuffer-lazy-highlight-setup', and that could be factored out.
> Reusing the lazy highlight loop itself seems harder, mostly because it
> is asynchronous: the preview uses a display property, so highlighting in
> chunks would reflow the buffer in stages on every keystroke.
> Zero-length matches also never reach 'isearch-lazy-highlight-match', and
> the preview does show those.  I'd rather look into this as a follow-up,
> if that's fine with you.

Yes, this could be postponed as an optimization.