GNU bug report logs - #73745
Add query-replace-reverse functions

Previous Next

Package: emacs;

Reported by: Dan Jacobson <jidanni <at> jidanni.org>

Date: Fri, 11 Oct 2024 11:03:01 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Dan Jacobson <jidanni <at> jidanni.org>
To: 73745 <at> debbugs.gnu.org
Subject: bug#73745: Add query-replace-reverse functions
Date: Fri, 11 Oct 2024 19:00:02 +0800
I am looking at the M-% prompt:
```
Query replace (default <h2 → <h2 class="zzz"): <h2 → <h2 class="zz"
```
and I am wondering how to get it to do the reverse?

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.
https://stackoverflow.com/questions/39700435/emacs-query-replace-regexp-reverse-order-of-default#comment132667451_39705933
because my string is not so simple.

>Just hit the undo button.

I don't want to do an undo, I want to do a reverse query replace of my
previous query replace.

Wait. And then it dawned on me: emacs needs a
reverse-previous-query-replace function.

It would be just like query-replace, but using B -> A instead of A -> B.

And doing ESC p should march through the query replace history, but with
each pair reversed!

And same for query-replace-regexp. There needs to be a
reverse-query-replace-regexp too.

Or maybe call them query-replace-reverse, etc.




This bug report was last modified 244 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.