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#48674: Frames and minibuffer bug Date: Thu, 27 May 2021 10:34:36 +0000 Message-ID: References: <1911d1b0-ed9f-7359-b28c-fbaef27df8f3@gmx.at> 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="11011"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48674@debbugs.gnu.org, Iris =?UTF-8?Q?Garc=C3=ADa?= To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 27 12:43:09 2021 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 1lmDTo-0002k7-Ur for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 May 2021 12:43:08 +0200 Original-Received: from localhost ([::1]:41376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmDTj-0003HS-2m for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 May 2021 06:43:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmDM4-0006k5-Vw for bug-gnu-emacs@gnu.org; Thu, 27 May 2021 06:35:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39165) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmDLy-0001jj-3A for bug-gnu-emacs@gnu.org; Thu, 27 May 2021 06:35:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lmDLx-000102-Tt for bug-gnu-emacs@gnu.org; Thu, 27 May 2021 06:35: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: Thu, 27 May 2021 10:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48674 X-GNU-PR-Package: emacs Original-Received: via spool by 48674-submit@debbugs.gnu.org id=B48674.16221116863816 (code B ref 48674); Thu, 27 May 2021 10:35:01 +0000 Original-Received: (at 48674) by debbugs.gnu.org; 27 May 2021 10:34:46 +0000 Original-Received: from localhost ([127.0.0.1]:50711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmDLi-0000zU-4h for submit@debbugs.gnu.org; Thu, 27 May 2021 06:34:46 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:49792 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lmDLf-0000zD-LT for 48674@debbugs.gnu.org; Thu, 27 May 2021 06:34:44 -0400 Original-Received: (qmail 81671 invoked by uid 3782); 27 May 2021 10:34:36 -0000 Original-Received: from acm.muc.de (p4fe1599a.dip0.t-ipconnect.de [79.225.89.154]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 27 May 2021 12:34:36 +0200 Original-Received: (qmail 5780 invoked by uid 1000); 27 May 2021 10:34:36 -0000 Content-Disposition: inline In-Reply-To: <1911d1b0-ed9f-7359-b28c-fbaef27df8f3@gmx.at> 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:207365 Archived-At: Hello, Iris and Martin. Iris, thanks for taking the trouble to report this bug, and thanks even more for cutting the test case down to the absolute minimum, making the bug easier to diagnose. On Wed, May 26, 2021 at 19:45:11 +0200, martin rudalics wrote: > merge 48674 48675 > quit > Thanks for the report. I've just tried to merge this with the following > one. > > 4. M-x (The bug appears, it is not possible to write in the minibuffer) > The crucial part is the > (dolist (frame (frame-list)) > (with-selected-frame frame > setting the cursor is not necessary to reproduce it. Since the bug does > not appear with Emacs 27, this could be due to Alan's minibuffer window > changes. Sort of, almost. What is happening is that the with-selected-frame invocation is selecting (temporarily) a different frame from the minibuffer's frame. This has the (intended) side effect of making the MB no longer selected in that frame. When the MB's frame becomes selected again, nothing makes the mini-window the selected window. This needs fixing. I think it likely that this bug could be triggered in Emacs 27 by putting something into minibuffer-setup-hook that selects a different window in the MB's frame, though I haven't tried this. > > Note: > > As soon as the new frame is destroyed, it is possible again to write in the > > minibuffer. > Right but as soon as I make another frame and type M-x I get > completing-read-default: Command attempted to use minibuffer while in minibuffer > so I'm at the same time in the active minibuffer and a normal buffer. Yes. I think the following patch should fix the trouble. Iris, could you please apply the patch (in directory ..../emacs/src) and rebuild your Emacs-28, then try it out on your real lisp source code. Should you want any help with the patching or building, feel free to send me private email. Then please confirm that the problem is fixed, or tell us what's still not working. Thanks! Martin, that Qt in the Fselect_window call (the NORECORD argument) - would it be perhaps be better as Qnil? diff --git a/src/minibuf.c b/src/minibuf.c index cffb7fe787..3468643a7e 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -893,6 +893,11 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, run_hook (Qminibuffer_setup_hook); + /* If the above hook has made the mini-window no longer the selected + window, restore it. */ + if (!EQ (selected_window, minibuf_window)) + Fselect_window (minibuf_window , Qt); + /* Don't allow the user to undo past this point. */ bset_undo_list (current_buffer, Qnil); > martin -- Alan Mackenzie (Nuremberg, Germany).