When I use replace-string
for the first time, it asks me for the string to replace and string to replace with. When running it again, it uses the previous values as default:
Replace string (default a -> b):
I want to replace an empty string now. I can't just press Enter, though, as that would confirm the default. Is there a way how to replace the empty string after having previously replaced something else?
When asked for the first time without default, just pressing Enter works.
Note: I know there are other ways how to get the thing done. My question is how to enter an empty string when there's a default.
(setq query-replace-defaults nil)
the right way at the right time, but I haven't come up with anything yet, hence no answer. Setting that variable tonil
will get rid of the default, but only temporarily.read-from-minibuffer
returnnil
. Authors of those prompt functions could then clear the defaults if that happened.