Subject: bug#48258: 28.0.50; minibuffer window not selected with non-nil mouse-autoselect-window

From: Stephen Berman <[email-masked]>
Date: Thu, 06 May 2021 17:41:23 +0200

0. emacs -Q
1. Type `M-x set-variable mouse-autoselect-window RET t RET'.
2. Type `M-x gnus', answer `y' at the prompt; in the Gnus buffer type
   `B RET news.gmane.io RET'.
3. In the *Gnus Browse Server* buffer type `C-s gmane.emacs.devel' to
   put point on the gmane.emacs.devel group; type RET to enter it.
4. Type `j <[email-masked]> RET', which
   displays an article containing an attachment.
5. Type `2 K o'.
=> The minibuffer displays a prompt to enter where to save the MIME part
   to, but the selected window remains the one containing Gnus Summary
   buffer instead of switching to the minibuffer window (but see below).

If I now select the minibuffer window, type C-g, select the Summary
buffer window and then repeat step 5, now the minibuffer window gets
selected, as expected.

Sometimes there is no failure to select the minibuffer window the first
time around, but I haven't been able to isolate the necessary
conditions.  I also haven't seen anything like this outside of Gnus.
And I only see the failure with non-nil mouse-autoselect-window, despite
the recipe only involving the keyboard.  This appears to be an old bug:
I can reproduce it with the above recipe not only in Emacs 28 and 27 but
also 26 (though my impression is I haven't been seeing it in normal use
for that long).

In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.17, cairo version 1.17.3)
 of 2021-04-26 built on strobe-jhalfs
Repository revision: 40c71e574ad27deee003a0850a40171750234d59
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Linux From Scratch SVN-20200401

Configured using:
 'configure --with-xwidgets 'CFLAGS=-Og -g3'
 PKG_CONFIG_PATH=/opt/qt5/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM XWIDGETS GTK3
ZLIB