Subject: Re: 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 17:28:06 +0000

Hello, Jim.

On Fri, Jan 12, 2024 at 09:59:10 -0600, Jim Rees wrote:
> Normally this happens when I'm trying to edit text in a buffer. I only
> mention the scratch buffer in the bug report because that's the easiest way
> to reproduce the problem.

> The mouse starts out somewhere in the window displaying the text I'm trying
> to edit. I type M-%, enter the 'from' text, and when I hit <enter> the mouse
> warps to the upper right corner of the window. I get the 'to' prompt but
> then I can't type anything because the focus is on the edit window, not on
> the minibuf.

> I don't think it matters where in the text window the mouse starts out, but
> it's hard to tell. About 10% of the time M-% works correctly but I can't
> figure out why. I'll try to see if it has something to do with mouse
> position.

> Can you try with twm? It is lightweight and should run with no
> configuration. I'm at a loss as to why I'm seeing this bug and no one else
> is.

I've installed twm which, as you say, is lightweight (~250 kB) but it
pulled in a ~750 kB font with it.  ;-)  No big deal (like it would have
been 30 years ago).

I can reproduce the bug with this set up.  With the mouse starting in
the text frame, the bug as you describe it happens, and the mouse must
be moved to the minibuffer frame to be able to type in the replacement
text.

If the mouse starts in the MB frame, typing M-% allows one to enter
original and replacement texts without moving the mouse, but this is
useless, since it then attempts to substitute in the mini-window.

I'll have a closer look at this to see if I can fix it.  But things with
detached minibuffers and focus are complicated and have given rise to
quite a few bugs over the years.  Add in focus follows mouse, and it
gets more complicated still.  ;-(

Reading between the lines, it would appear you're still on Emacs 28
because of this bug.  That's a pity, and it would be good to fix things.

-- 
Alan Mackenzie (Nuremberg, Germany).