Please tell me the command to delete "A certain character A" and "C" between "B" in Emacs with confirmation (query).
As a concrete example, we would like to "remove only one blank between two "x".What commands do you want to run this on?
Assume that the buffer contains:
The desired results are as follows:
For example, if you run
M-%x x RET xx RET, replacing all of them with
! will naturally fail to meet the requirements:
I can only think of doing a replacement twice or redefining the replace-search-function, but I'm asking because I think there's already a solution in a common situation.emacs
According to the
I can write a Lisp expression, so
You can replace it with .
The Emacs regular expression does not have lookahead, so
M-x query-replace-regexp seems impossible.
If necessary, I will write Elisp without thinking deeply:
What's the rule if you don't want to replace the item in the string? has a way to call Perl and use lookahead, which means you can rewrite it all at once without a query.
And I've defined it as a function, and I've done it, but I think it's going to do the expected movement. (I wanted to comment on Camlspotter's post, but I still didn't have enough reputations, so I answered independently.)
© 2023 OneMinuteCode. All rights reserved.