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

From: Jim Rees <[email-masked]>
Date: Sun, 6 Aug 2023 11:18:34 -0600

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

Configured using:
 'configure --disable-silent-rules --prefix=/usr/local --sysconfdir=/etc
 --libexecdir=/usr/local/lib --localstatedir=/var
 --mandir=/usr/local/man --with-x --with-x-toolkit=gtk3
 --without-toolkit-scroll-bars --without-xaw3d --with-cairo
 --without-imagemagick --without-sound --without-gif
 --without-libsystemd --without-dbus --without-gconf --without-gsettings
 --without-selinux CFLAGS=-Os'

Configured features:
ACL CAIRO FREETYPE GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2 LIBOTF
LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP THREADS
TIFF X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LC_COLLATE: C
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: ELisp/d

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/rees/lib/lisp/cmuscheme hides /usr/local/share/emacs/28.1/lisp/cmuscheme
/home/rees/lib/lisp/tempo hides /usr/local/share/emacs/28.1/lisp/tempo
/home/rees/lib/lisp/rng-nxml hides /usr/local/share/emacs/28.1/lisp/nxml/rng-nxml
/home/rees/lib/lisp/syntax hides /usr/local/share/emacs/28.1/lisp/emacs-lisp/syntax

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core eieio-loaddefs
password-cache json map text-property-search mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date
subr-x tabify imenu man ansi-color pp seq byte-opt bytecomp byte-compile
cconv zoom-frm frame-cmds cl-macs gv frame-fns avoid server ps-ccrypt
html-mode dtrt-indent advice easy-mmode whitespace plain-mode edmacro
kmacro cl-loaddefs cl-lib fit-frame iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads inotify lcms2 dynamic-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 74590 6483)
 (symbols 48 8146 1)
 (strings 32 22376 2052)
 (string-bytes 1 771015)
 (vectors 16 15645)
 (vector-slots 8 222601 10111)
 (floats 8 64 30)
 (intervals 56 254 244)
 (buffers 992 13))