Subject: Re: bug#13579: 24.3.50; query-replace ressurrects previous minibuffer contents

From: Juri Linkov <[email-masked]>
Date: Wed, 30 Jan 2013 08:03:30 +0200

> From "emacs -Q":
>   M-x set-variable <return>
>   enable-recursive-minibuffers <return>
>   t <return>
>   M-x switch-to-butter
>   C-a M-%
>   t <return>
>   f <return>
>   !
>   ;; wait two seconds
>
> Expected (in minibuffer): "swifch-to-buffer".
> Actual (in minibutter): "sef-variable".

Thanks for the report.  Initially `isearch-forward' is nil, so M-% tries
to search backward going through the minibuffer history (thus it uses the
global value of `isearch-forward' in `minibuffer-history-isearch-search').

It is evident now from your report that the search space for replacements
should be narrowed to the strict set of search functions defined in isearch.el.

This is a regression, so I propose to install the following patch to the
emacs-24 release branch:

=== modified file 'lisp/replace.el'
--- lisp/replace.el	2013-01-01 09:11:05 +0000
+++ lisp/replace.el	2013-01-30 06:03:10 +0000
@@ -1831,7 +1831,7 @@ (defun perform-replace (from-string repl
 		     replace-regexp-lax-whitespace)
 		    (isearch-case-fold-search case-fold-search)
 		    (isearch-forward t))
-		(isearch-search-fun))))
+		(isearch-search-fun-default))))
          (search-string from-string)
          (real-match-data nil)       ; The match data for the current match.
          (next-replacement nil)