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.devel Subject: Re: Stop frames stealing eachothers' minibuffers! Date: Sun, 1 Nov 2020 19:53:13 +0000 Message-ID: <20201101195313.GA6190@ACM> References: <20201021200438.GF19276@ACM> <83h7qmkzla.fsf@gnu.org> <20201030220917.GA17594@ACM> <83v9eq97sj.fsf@gnu.org> <20201031161422.GA5887@ACM> <83d00ygx9c.fsf@gnu.org> <20201031194419.GC5887@ACM> <834kmago8m.fsf@gnu.org> <20201031203914.GD5887@ACM> <835z6ogc1h.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="34171"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 01 20:54:03 2020 Return-path: Envelope-to: ged-emacs-devel@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 1kZJQR-0008o2-2D for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Nov 2020 20:54:03 +0100 Original-Received: from localhost ([::1]:50710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZJQQ-0004vc-3Y for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Nov 2020 14:54:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZJPl-0004Q6-U2 for emacs-devel@gnu.org; Sun, 01 Nov 2020 14:53:22 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:46425 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1kZJPj-0005aM-2W for emacs-devel@gnu.org; Sun, 01 Nov 2020 14:53:21 -0500 Original-Received: (qmail 93336 invoked by uid 3782); 1 Nov 2020 19:53:14 -0000 Original-Received: from acm.muc.de (p2e5d5fee.dip0.t-ipconnect.de [46.93.95.238]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Sun, 01 Nov 2020 20:53:13 +0100 Original-Received: (qmail 25991 invoked by uid 1000); 1 Nov 2020 19:53:13 -0000 Content-Disposition: inline In-Reply-To: <835z6ogc1h.fsf@gnu.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/01 14:53:15 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:258606 Archived-At: Hello, Eli. On Sun, Nov 01, 2020 at 20:35:54 +0200, Eli Zaretskii wrote: > > Date: Sat, 31 Oct 2020 20:39:14 +0000 > > Cc: emacs-devel@gnu.org > > From: Alan Mackenzie > > > > How about emptying mini-windows which don't have live minibuffers > > > > on them? This could be tested by Fminibufferp (b, Qt). In > > > > practice, when minibuffer-follows-selected-frame this would empty > > > > all mini-windows but the current one, and when !m-f-s-f it would > > > > leave intact the mini-windows we want to be left intact. > > > let me turn the table and ask why this hunk is needed? What > > > doesn't work right if this code is left in place? > > Without that hunk (i.e. with the emptying-out code): > > (i) emacs -Q > > (ii) M-: (setq minibuffer-follows-selected-frame nil) > > (iii) C-x 5 2 ; giving two frames. > > (iv) C-x b ; leaving a minibuffer open. > > (v) C-x 5 o ; move to other frame. > > (vi) C-r in ; start an isearch. > > (vii) C-x 8 RET ; intending on inserting a non-keyboard character. > > At this point, the mini-window in Frame 1 is emptied. This is bad. > But the same happens with the current master. So this is no worse than > what we have today. It might be no worse (the situations aren't exactly parallel), but I think the !minibuffer_f_s_frame case should be no worse than the m_f_s_f case. We should be aiming to improve things. The mental model for !m_f_s_f is that a minibuffer is attached to a frame. So actions in a different frame shouldn't affect it. > > By contrast, the same sequence of operations without (ii) (with an extra > > step: > > (v).5 C-x o ; move to the ordinary window. > > ), the first minibuffer is "protected" on Frame 2 underneath the C-x 8 > > RET minibuffer. So, when the isearch is finished, the "Switch to > > buffer" minibuffer appears again, and is active. > Is this with or without removing the code which empties all the other > minibuffers? This is with the emptying code present, exactly as in the previous case. I propose amending the emptying out code to look like this: /* Empty out the minibuffers of all frames, except those frames where there is an active minibuffer. Set them to point to ` *Minibuf-0*', which is always empty. */ empty_minibuf = get_minibuffer (0); FOR_EACH_FRAME (dummy, frame) { Lisp_Object root_window = Fframe_root_window (frame); Lisp_Object mini_window = XWINDOW (root_window)->next; Lisp_Object buffer; if (!NILP (mini_window) && !EQ (mini_window, minibuf_window) && !NILP (Fwindow_minibuffer_p (mini_window))) { buffer = XWINDOW (mini_window)->contents; if (NILP (Fminibufferp (buffer, Qt))) <======================== /* Use set_window_buffer instead of Fset_window_buffer (see discussion of bug#11984, bug#12025, bug#12026). */ set_window_buffer (mini_window, empty_minibuf, 0, 0); } } Here Fminibufferp (with the new argument Qt) tests for an active minibuffer. This code appears to work well. -- Alan Mackenzie (Nuremberg, Germany).