Subject: bug#73745: Add query-replace-reverse functions

From: Juri Linkov <[email-masked]>
Date: Tue, 15 Oct 2024 09:17:08 +0300

>>> It is prompting with my previous action, but now I want to do the exact
>>> opposite,   `<h2 class="zz" → <h`
>>> No, I can't just put my (emacs -nw) cursor on top of the arrow and hit M-t.
>>
>> Some time ago we discussed 'M-t' to reverse 'from'/'to' parts.
>> But the problem is that for multi-word replacements
>> 'M-t' should still transpose words inside 'from' or 'to'
>> separately.
>>
>> All transpose keys ‘C-t’ (‘transpose-chars’), ‘M-t’
>> (‘transpose-words’), ‘C-M-t’ (‘transpose-sexps’), even ‘C-x C-t’
>> (‘transpose-lines’) for multi-line replacements -
>> all these keys can't be used to reverse 'from'/'to'.
>
> How about something like `C-c M-t`?

I see no other keys on the `C-c` keymap in the minibuffer:

  No commands with a binding that start with C-c.

OTOH, while reading a regexp for `C-M-%` there is:

  M-s c		read-regexp-toggle-case-fold

So maybe `M-s M-t` is not too bad.