From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <831qalivwr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31531"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Po Lu , acm@muc.de, Eli Zaretskii , 65116@debbugs.gnu.org To: Jim Rees Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 13 21:07:25 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rOkHs-000827-W2 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Jan 2024 21:07:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOkHa-0003X9-Ox; Sat, 13 Jan 2024 15:07:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rOkHX-0003W9-F7 for bug-gnu-emacs@gnu.org; Sat, 13 Jan 2024 15:07:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOkHX-00024t-6O for bug-gnu-emacs@gnu.org; Sat, 13 Jan 2024 15:07:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rOkHV-0004NT-OC for bug-gnu-emacs@gnu.org; Sat, 13 Jan 2024 15:07:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Jan 2024 20:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65116 X-GNU-PR-Package: emacs Original-Received: via spool by 65116-submit@debbugs.gnu.org id=B65116.170517640316799 (code B ref 65116); Sat, 13 Jan 2024 20:07:01 +0000 Original-Received: (at 65116) by debbugs.gnu.org; 13 Jan 2024 20:06:43 +0000 Original-Received: from localhost ([127.0.0.1]:41189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOkHD-0004Ms-7B for submit@debbugs.gnu.org; Sat, 13 Jan 2024 15:06:43 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:51151) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rOkHB-0004Mf-QD for 65116@debbugs.gnu.org; Sat, 13 Jan 2024 15:06:42 -0500 Original-Received: (qmail 61209 invoked by uid 3782); 13 Jan 2024 21:06:37 +0100 Original-Received: from acm.muc.de (p4fe15740.dip0.t-ipconnect.de [79.225.87.64]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 13 Jan 2024 21:06:36 +0100 Original-Received: (qmail 19923 invoked by uid 1000); 13 Jan 2024 20:06:36 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:278157 Archived-At: 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).