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

From: Alan Mackenzie <[email-masked]>
Date: Fri, 12 Jan 2024 15:37:08 +0000

Hello, Jim.

On Sun, Aug 06, 2023 at 11:18:34 -0600, Jim Rees wrote:

> 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.

> 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
> Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
> System Description: Arch Linux

.... and in a more recent post:

> The problem is in 29.1. I think report-emacs-bug just appends the info
> for whatever version of emacs you are running at the time you report a
> bug.

> I have tried two different window managers, twm and openbox, and get
> the bug in both of them. However, it only happens if I am running with
> focus follows mouse. It does not happen if I have set click to focus.
> The settings of focus-follows-mouse and
> minibuffer-follows-selected-frame make no difference.

I can't reproduce the bug on my setup, GNU/Linux with an XFCE window
manager with "focus follows mouse" set.  I've tried both with Emacs
29.1, and a fairly recent version from our git master branch.

Seeing as how "focus follows mouse" is set, does it make any difference
where on the screen the mouse is when you perform the various steps of
the bug recipe?  Where was your mouse when entering the original string
and then attempting to enter the replacement string?

-- 
Alan Mackenzie (Nuremberg, Germany).