bug#81583: 32.0.50; Optional preview of the replacement text while typing it
Stéphane Marks <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <CAN+1HbozGyWu5W4B7d_=LXG46mvpxxmgO8h2G-9fK3WL0MLefw@mail.gmail.com> |
On Fri, Aug 14, 2026 at 4:04 PM Rahul Martim Juliato <[email protected]> wrote: > Juri Linkov <[email protected]> writes: > > >> Personally, I'd prefer to keep the same "topic" in a single bug thread, > >> if you're okay with committing 'bug#81583' in several commits. > > > > This would be nice. > > > >> Would you mind listing the features you had in mind? > > > > 1. We could add a special value 'both' of the new option > > 'query-replace-show-preview' to customize the display of > > both strings side by side (match → replacement). > > > > Hi Juri! Thanks for your patience. > > Here's an almost final scratch of what I'm working on. Before I go > ahead with tests and manual entries, I'd like to share it with you for > reviewing code, feature expectations, grammar, doc length and so on. > > In summary 'query-replace-show-preview' can now be: > > - nil (default current behavior) > - t (replaces are shown "as you type") > - both (shows match→replacement as you type) > - fn (a function users can customize receiving match and replace and > come with their own ideas) > > Users can also set 'query-replace-preview-separator' to: > > - nil (automatic default, will use → or -> if not available) > - "" (a custom string in case of wanting another symbol or adding spaces > around, like " → ") > > Regarding faces, following this scheme: > > [match]→[replace] > 1 2 3 > > The provided faces are: > > 1 -> query-replace-preview-match > 2 -> query-replace-preview-separator > 3 -> query-replace-preview > > Please find attached the diff and some screenshots. > > > 2. Another feature that could be added is to have a variable > > that contains a string to display for zero-length matches. > > Like a vertical bar for empty rectangular region after 'C-x SPC'. > > This will be next and hopefully easier :) > This is nice. Question on one use case that will surely come up. When replacing a string with an empty string, should the replacement display as something special to illustrate the blank or just be blank? There are unicode symbols for blanks but not sure what the ASCII version would be (perhaps there is already a precedent in Emacs).