Subject: bug#65116: 29.1; query-replace-read-args fails reading second arg in detached minibuf

From: Eli Zaretskii <[email-masked]>
Date: Mon, 07 Aug 2023 18:57:17 +0300

> Date: Sun, 6 Aug 2023 11:18:34 -0600
> From:  Jim Rees via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> 
> With detached minibuf, query-replace doesn't work because
> query-replace-read-args doesn't shift focus to minibuf for the replacement
> string. Possibly related to Bug 64152. This worked in 28.1.
> 
> To reproduce, create init.el with these two lines:
> 
> (add-to-list 'initial-frame-alist '(minibuffer . nil))
> (add-to-list 'minibuffer-frame-alist '(minibuffer . only))
> 
> Now run emacs:
> emacs-29.1 -Q --load init.el
> 
> Run query-replace, usually bound to M-%. Focus will shift to the minibuf.
> Enter a string and hit <return>. The minibuf will now prompt for a
> replacement string, but focus will now be in the scratch buffer instead of
> the minibuf, and it will be impossible to enter the replacement string
> without re-focusing.

What I see here is that the frame where *scratch* is shown becomes the
selected frame, but input focus stays in the minibuffer frame, so if I
type the replacement string (without any refocusing), the command
accepts the replacement and starts replacing after I type RET.

YMMV, depending on your WM, I think.

> In GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6)
>  of 2023-01-15 built on motul

The Subject says "Emacs 29.1", but this report is from Emacs 28.1.  So
which one is the version where you see the problem?