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#56305: 29.0.50; 'yes-or-no-p' deselects minibuffer frame Date: Sat, 2 Jul 2022 11:38:06 +0000 Message-ID: References: <3984f6ec-1988-f0ae-d44c-f4b92a202938@gmx.at> <83o7yb5lqe.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="7665"; mail-complaints-to="usenet@ciao.gmane.io" Cc: martin rudalics , 56305@debbugs.gnu.org, acm@muc.de To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 02 13:43:05 2022 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 1o7bWj-0001pM-0e for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Jul 2022 13:43:05 +0200 Original-Received: from localhost ([::1]:45542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7bWh-00050M-EW for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Jul 2022 07:43:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7bSo-0001yy-8U for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 07:39:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46087) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7bSn-0000Ja-W0 for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 07:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o7bSn-0001XU-Tj for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2022 07:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jul 2022 11:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56305 X-GNU-PR-Package: emacs Original-Received: via spool by 56305-submit@debbugs.gnu.org id=B56305.16567618965861 (code B ref 56305); Sat, 02 Jul 2022 11:39:01 +0000 Original-Received: (at 56305) by debbugs.gnu.org; 2 Jul 2022 11:38:16 +0000 Original-Received: from localhost ([127.0.0.1]:39984 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7bS4-0001WS-0m for submit@debbugs.gnu.org; Sat, 02 Jul 2022 07:38:16 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:39766 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1o7bS1-0001WE-I6 for 56305@debbugs.gnu.org; Sat, 02 Jul 2022 07:38:14 -0400 Original-Received: (qmail 57021 invoked by uid 3782); 2 Jul 2022 11:38:07 -0000 Original-Received: from acm.muc.de (p4fe15928.dip0.t-ipconnect.de [79.225.89.40]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 02 Jul 2022 13:38:06 +0200 Original-Received: (qmail 13843 invoked by uid 1000); 2 Jul 2022 11:38:06 -0000 Content-Disposition: inline In-Reply-To: <83o7yb5lqe.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:235888 Archived-At: Hello, Eli and Martin. On Wed, Jun 29, 2022 at 22:10:49 +0300, Eli Zaretskii wrote: > > Date: Wed, 29 Jun 2022 19:54:44 +0200 > > From: martin rudalics > > With emacs -Q --load "~/mini.el" which contains the three lines > > (setq use-dialog-box nil) > > (setq default-frame-alist '((minibuffer . nil))) > > (shell) > > and type C-x C-c in the minibuffer frame. This asks a 'yes-or-no-p' > > question in the minibuffer frame but selects the *Process List* window > > on the other frame. > > FWICT this worked correctly until Emacs 26, was broken in Emacs 27, > > returned to work in Emacs 28.1 and is now broken on both, release and > > master branch, again. > Alan, could you please look into this? Emacs 28.2 is about to start > pretest. At the point in read_minibuf where recursive_edit_1 is called, all the frame and window variables appear to be in order - things like minibuf_window, current_buffer, selected_window, selected_frame, ... What is not in order is the window system focus, which in the bug scenario is on the "normal" frame rather than the minibuffer frame. As a matter of interest, if the C-x C-c command is invoked from the "normal" frame, things work correctly. As a matter of interest, when I moved from the "normal" frame to the minibuffer frame with (or clicking on the MB frame), there wasn't the expected call to do_switch_frame (). I don't understand why the current bug is happening; focus switching in Emacs is complicated. However, the following patch is, at least, a workaround for the problem. Should I commit it? diff --git a/src/minibuf.c b/src/minibuf.c index 0fc7f2caa1..5480d1f2af 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -896,6 +896,10 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, /* Don't allow the user to undo past this point. */ bset_undo_list (current_buffer, Qnil); + /* Ensure that the minibuffer frame has the window-system focus. + This is sometimes needed for minibuffer-only frames. */ + call2 (Qselect_frame_set_input_focus, mini_frame, Qt); + recursive_edit_1 (); /* If cursor is on the minibuffer line, > Thanks. -- Alan Mackenzie (Nuremberg, Germany).