all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Jim Rees <jim@rees.org>
Cc: Po Lu <luangruo@yahoo.com>,
	acm@muc.de, Eli Zaretskii <eliz@gnu.org>,
	65116@debbugs.gnu.org
Subject: bug#65116: 29.1; query-replace-read-args fails reading second arg in detached minibuf
Date: Sat, 13 Jan 2024 20:06:36 +0000	[thread overview]
Message-ID: <ZaLtTEwu9dVziNlt@ACM> (raw)
In-Reply-To: <ZaLBwstGoWE62TF4@rees.org>

Hello again, Jim.

On Sat, Jan 13, 2024 at 11:00:50 -0600, Jim Rees wrote:
> Could it have something to do with the mouse warping? Why is the mouse
> warping at all? I would prefer it stay right where it is. I'm pretty sure it
> did at some recent time in the past, maybe emacs 26.

I think I've got it.  The problem was which frame has X-Windows's
focus.  Most of the time, that's the minibuffer's/echo-area's frame,
because at the end of most commands, something gets written to the
echo-area.

In the current bug situation, after the first read-minibuffer of M-%,
nothing is output to the echo-area, but the GUI focus is switched to the
main frame.  It stays there for the second read-minibuffer, and that's
what you saw on your terminal.

The solution would appear to be explicitly to switch the focus to the
minibuffer frame before attempting to read from it.  The following patch
does this, and appears to work for me.



diff --git a/src/minibuf.c b/src/minibuf.c
index f4f9da9c3f9..d940c0d717f 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -825,6 +825,11 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
   /* Use set_window_buffer instead of Fset_window_buffer (see
      discussion of bug#11984, bug#12025, bug#12026).  */
   set_window_buffer (minibuf_window, Fcurrent_buffer (), 0, 0);
+  /* Make sure the minibuffer's frame has the input focus.  This is
+     particularly for the twm window manager with detached minibuffer.
+     (See Bug#65116.)  */
+  if (!EQ (mini_frame, selected_frame))
+    call2 (Qselect_frame_set_input_focus, mini_frame, Qt);
   Fselect_window (minibuf_window, Qnil);
   XWINDOW (minibuf_window)->hscroll = 0;
   XWINDOW (minibuf_window)->suspend_auto_hscroll = 0;


Would you please apply the patch, rebuild your Emacs, and see if the
problem really is solved.  The patch should apply cleanly to either the
Emacs master, or the 29.x sources.  (I'm assuming you have no troubles
with patching and building, but if so, feel free to send me private
email.)  Then please confirm things are OK so that I can close the bug,
or tell me what's still not working properly.

Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).





  parent reply	other threads:[~2024-01-13 20:06 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-06 17:18 bug#65116: 29.1; query-replace-read-args fails reading second arg in detached minibuf Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-07 15:57 ` Eli Zaretskii
2024-01-12  6:26   ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 12:00     ` Eli Zaretskii
2024-01-12 14:38       ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 15:25       ` Alan Mackenzie
2024-01-12 15:37 ` Alan Mackenzie
2024-01-12 15:59   ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 17:28     ` Alan Mackenzie
2024-01-12 18:57       ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 21:44         ` Alan Mackenzie
2024-01-13  6:34           ` Eli Zaretskii
2024-01-13  9:23             ` Alan Mackenzie
2024-01-13 13:47               ` Alan Mackenzie
2024-01-13 17:00                 ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-13 17:47                   ` Alan Mackenzie
2024-01-13 19:15                   ` Drew Adams
2024-01-13 20:18                     ` Alan Mackenzie
2024-01-13 21:19                       ` Drew Adams
2024-01-13 21:35                         ` Alan Mackenzie
2024-01-13 20:06                   ` Alan Mackenzie [this message]
2024-01-13 23:53                     ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14  6:21                       ` Eli Zaretskii
2024-01-14 14:33                         ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14 15:03                           ` Alan Mackenzie
2024-01-14 16:59                         ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14 17:17                           ` Eli Zaretskii
2024-01-14 17:33                             ` Eli Zaretskii
2024-01-14 19:10                               ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14 19:42                                 ` Eli Zaretskii
2024-01-15  0:27                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15  1:29                                     ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15  3:38                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15  4:52                                         ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15  6:31                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15 16:47                                             ` Jim Rees via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14  0:27             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14 14:14               ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZaLtTEwu9dVziNlt@ACM \
    --to=acm@muc.de \
    --cc=65116@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jim@rees.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.