Subject: bug#12526: 24.2.50; `query-replace-interactive' not always respected

From: Dani Moncayo <[email-masked]>
Date: Wed, 3 Oct 2012 12:00:05 +0200

>> Is that feature documented somewhere?
>
> Yes, it is documented in the Info node
> (info "(emacs) Special Isearch")

Ok, but definitely the docstring of query-replace should be updated,
because currently it is misleading:
  If `query-replace-interactive' is non-nil, the last incremental search
  string is used as FROM-STRING--you don't have to specify it with the
  minibuffer.

This paragraph is incomplete (and therefore misleading) because it
doesn't explain the behavior I complained about.

Also, the docstring of `query-replace-interactive' should be update
for the same reason.

>> Is there a way to disable that feature?
>
> Yes, you can easily disable this feature
> by adding this keybinding to your init file:
>
> (define-key isearch-mode-map [?\M-%]
>   (lambda ()
>     (interactive)
>     (isearch-exit)  ;; I'm too lazy to terminate search with RET.
>     (call-interactively 'query-replace)))

This is an ugly solution, IMO.  I don't want to define a new command
and bind M-% to it;

I'd like to set some user-option in my init file so that query-replace
never assumes nothing about the "from" string.

BTW: I think that a much better approach would be to add the last
search string to the list of default arguments, so that, after an
Isearch, I could do `M-% M-n' if I wanted to retrieve that last search
string.

-- 
Dani Moncayo