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#47766: 28.0.50; choose-completion fails Date: Thu, 22 Apr 2021 15:07:47 +0000 Message-ID: References: <20210414.103308.2181932615044049035.enometh@meer.net> <7d9667a70f0babba48d0@heytings.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="31689"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gregory Heytings , 47766@debbugs.gnu.org To: Madhu , Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 22 17:08:10 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 1lZaw5-0007vY-OB for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Apr 2021 17:08:09 +0200 Original-Received: from localhost ([::1]:45332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZaw4-0000OC-LF for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Apr 2021 11:08:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZavy-0000Nu-C9 for bug-gnu-emacs@gnu.org; Thu, 22 Apr 2021 11:08:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51963) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZavy-0008Hk-4N for bug-gnu-emacs@gnu.org; Thu, 22 Apr 2021 11:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lZavx-0007hm-T8 for bug-gnu-emacs@gnu.org; Thu, 22 Apr 2021 11:08: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, 22 Apr 2021 15:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47766 X-GNU-PR-Package: emacs Original-Received: via spool by 47766-submit@debbugs.gnu.org id=B47766.161910407929610 (code B ref 47766); Thu, 22 Apr 2021 15:08:01 +0000 Original-Received: (at 47766) by debbugs.gnu.org; 22 Apr 2021 15:07:59 +0000 Original-Received: from localhost ([127.0.0.1]:35276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lZavu-0007hV-CO for submit@debbugs.gnu.org; Thu, 22 Apr 2021 11:07:59 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:37826 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lZavr-0007hE-FI for 47766@debbugs.gnu.org; Thu, 22 Apr 2021 11:07:56 -0400 Original-Received: (qmail 87416 invoked by uid 3782); 22 Apr 2021 15:07:48 -0000 Original-Received: from acm.muc.de (p4fe15bfe.dip0.t-ipconnect.de [79.225.91.254]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 22 Apr 2021 17:07:47 +0200 Original-Received: (qmail 26412 invoked by uid 1000); 22 Apr 2021 15:07:47 -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" Xref: news.gmane.io gmane.emacs.bugs:204695 Archived-At: Hello, Madhu and Stefan. On Tue, Apr 20, 2021 at 08:25:13 -0500, Stefan Kangas wrote: > Gregory Heytings writes: > >> In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, Motif Version 2.3.8, cairo > >> version 1.16.0) of 2021-04-14 built on maher based on master > >> 844b8949a71f180d395a237c768b22d91cf91ded (with the motif revert reverted) > >> 1. emacs -Q -eval '(setq pop-up-windows nil pop-up-frames t)' > >> 2. C-x b TAB > >> this would pop up a new *Completions* buffer in a new frame with are two > >> choices *Messages* and *scratch* > >> 3. choose a completion (click or hit enter on one of the choices) > >> user-error: Cannot switch buffers in minibuffer window > > This is because of commit 7c2ebf6e23. Or, more accurately, because the changes in that commit were incomplete. In particular, functions iconify-frame and make-frame-invisible were moving minibuffers in a way no longer consistent with the rest of Emacs. Madhu, would you please try out the following patch (which gives a couple of harmless warnings in compilation), and tell us whether it fixes the problems in your setup, or what is still not working properly. Thanks! diff --git a/lisp/window.el b/lisp/window.el index 071761ea50..faf639cddd 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4119,7 +4119,7 @@ window-deletable-p (let ((minibuf (active-minibuffer-window))) (and minibuf (eq frame (window-frame minibuf)) (not (eq (default-toplevel-value - minibuffer-follows-selected-frame) + 'minibuffer-follows-selected-frame) t))))) 'frame)) ((window-minibuffer-p window) diff --git a/src/frame.c b/src/frame.c index 097cd555c6..a1a6d58cb6 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2085,9 +2085,10 @@ delete_frame (Lisp_Object frame, Lisp_Object force) do_switch_frame (frame1, 0, 1, Qnil); sf = SELECTED_FRAME (); } - - /* Don't allow minibuf_window to remain on a deleted frame. */ - check_minibuf_window (frame, minibuffer_selected); + else + /* Ensure any minibuffers on FRAME are moved onto the selected + frame. */ + move_minibuffers_onto_frame (f, true); /* Don't let echo_area_window to remain on a deleted frame. */ if (EQ (f->minibuffer_window, echo_area_window)) @@ -2718,9 +2719,6 @@ DEFUN ("make-frame-invisible", Fmake_frame_invisible, Smake_frame_invisible, if (NILP (force) && !other_frames (f, true, false)) error ("Attempt to make invisible the sole visible or iconified frame"); - /* Don't allow minibuf_window to remain on an invisible frame. */ - check_minibuf_window (frame, EQ (minibuf_window, selected_window)); - if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->frame_visible_invisible_hook) FRAME_TERMINAL (f)->frame_visible_invisible_hook (f, false); @@ -2763,9 +2761,6 @@ DEFUN ("iconify-frame", Ficonify_frame, Siconify_frame, } #endif /* HAVE_WINDOW_SYSTEM */ - /* Don't allow minibuf_window to remain on an iconified frame. */ - check_minibuf_window (frame, EQ (minibuf_window, selected_window)); - if (FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->iconify_frame_hook) FRAME_TERMINAL (f)->iconify_frame_hook (f); diff --git a/src/minibuf.c b/src/minibuf.c index c4482d7f1e..bc7d439398 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -212,7 +212,23 @@ DEFUN ("active-minibuffer-window", Factive_minibuffer_window, doc: /* Return the currently active minibuffer window, or nil if none. */) (void) { - return minibuf_level ? minibuf_window : Qnil; + Lisp_Object frames, frame; + struct frame *f; + Lisp_Object innermost_MB; + + if (!minibuf_level) + return Qnil; + + innermost_MB = nth_minibuffer (minibuf_level); + FOR_EACH_FRAME (frames, frame) + { + f = XFRAME (frame); + if (FRAME_LIVE_P (f) + && WINDOW_LIVE_P (f->minibuffer_window) + && EQ (XWINDOW (f->minibuffer_window)->contents, innermost_MB)) + return f->minibuffer_window; + } + return minibuf_window; /* "Can't happen." */ } DEFUN ("set-minibuffer-window", Fset_minibuffer_window, > Copying in Alan here. -- Alan Mackenzie (Nuremberg, Germany).