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: Sat, 31 Oct 2020 19:44:19 +0000 Message-ID: <20201031194419.GC5887@ACM> References: <83sgafy56d.fsf@gnu.org> <20201015180143.GA10229@ACM> <83wnzrwdy5.fsf@gnu.org> <20201021151945.GA19276@ACM> <20201021200438.GF19276@ACM> <83h7qmkzla.fsf@gnu.org> <20201030220917.GA17594@ACM> <83v9eq97sj.fsf@gnu.org> <20201031161422.GA5887@ACM> <83d00ygx9c.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="12808"; 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 Sat Oct 31 20:45:28 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 1kYwoZ-0003Ef-Dk for ged-emacs-devel@m.gmane-mx.org; Sat, 31 Oct 2020 20:45:27 +0100 Original-Received: from localhost ([::1]:54110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYwoY-0001DK-Eo for ged-emacs-devel@m.gmane-mx.org; Sat, 31 Oct 2020 15:45:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYwna-0000kn-Uu for emacs-devel@gnu.org; Sat, 31 Oct 2020 15:44:28 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:43504 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1kYwnX-0002ys-FR for emacs-devel@gnu.org; Sat, 31 Oct 2020 15:44:26 -0400 Original-Received: (qmail 61176 invoked by uid 3782); 31 Oct 2020 19:44:20 -0000 Original-Received: from acm.muc.de (p2e5d5579.dip0.t-ipconnect.de [46.93.85.121]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Sat, 31 Oct 2020 20:44:19 +0100 Original-Received: (qmail 19033 invoked by uid 1000); 31 Oct 2020 19:44:19 -0000 Content-Disposition: inline In-Reply-To: <83d00ygx9c.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/10/31 15:44:20 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:258588 Archived-At: Hello again, Eli. On Sat, Oct 31, 2020 at 18:45:19 +0200, Eli Zaretskii wrote: > > Date: Sat, 31 Oct 2020 16:14:22 +0000 > > Cc: emacs-devel@gnu.org > > From: Alan Mackenzie > > > > @@ -416,11 +471,12 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, > > > > { > > > > Lisp_Object str > > > > = build_string ("Command attempted to use minibuffer while in minibuffer"); > > > > - if (EQ (selected_window, minibuf_window)) > > > > - Fsignal (Quser_error, (list1 (str))); > > > > + if (!minibuf_follows_frame () > > > > + || EQ (selected_window, minibuf_window)) > > > > + Fsignal (Quser_error, (list1 (str))); > > > I don't think I understand this change: what does > > > minibuffer-follows-selected-frame have to do with recursive minibuffer > > > usage? They are two independent features. > > They're not as independent as all that. The existing logic appeared to > > say "if we're in the miniwindow, just abort the current command, > > otherwise abort all nested commands.". Extending that logic to when we > > have several miniwindows, we'd (perhaps) get "if we're in _A_ miniwindow > > just abort the current command.". > > Which, further extended, goes "if we're in ANY window, just abort the > > current command.". I agree, this is an independent feature from the > > main one. But it brings consistency (and, possibly, usability) to this > > abort facility. I can put this back to more or less what it was. But > > why do we abort the whole command stack when there's just a single > > error? > Sorry, you've lost me here. The existing logic is: if we are in a > minibuffer with minibuf_level > 1, then we throw to top-level, either > by signaling a user-error or silently. Your change introduced the > call to minibuf_follows_frame into this equation, and I just cannot > understand what business does it have here? Recursive minibuffers > should be "verboten" regardless of whether the minibuffer follows the > selected frame or not. What am I missing here? Maybe I'm not being coherent. I think it would be better not to abort the first command when a user accidentally tries to invoke a recursive minibuffer. But it's not a big point. I can't remember very clearly, but I think I made this change early on in the project because the Fthrow (Qexit, str); left some mini-windows in a messy state; or something like that. That doesn't happen any more. So, maybe I should just remove this hunk from the proposed patch. It doesn't seem that important any more. > > > > - /* Empty out the minibuffers of all frames other than the one > > > > - where we are going to display one now. > > > > - 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; > > > > - > > > > - if (! NILP (mini_window) && ! EQ (mini_window, minibuf_window) > > > > - && !NILP (Fwindow_minibuffer_p (mini_window))) > > > > - /* 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); > > > > - } > > > Does this mean the minibuffers on other frames will now not be emptied? > > Yes, indeed. If minibuffer-follows-selected-frame, there'll only be a > > single mini-window, which we're about to write into, so there's no point > > emptying out a null set of other windows. > That's the intention, perhaps, but are we really 110% sure this will > happen? And where's the alternative code which will make sure the > other minibuffers are cleared in this case? Maybe something like edebug invoked from a recursive edit when there's a minibuffer live. That could be problematic, perhaps. 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. To be honest, I think I've been seeing stale messages hanging around in echo areas, and this emptying might clear them out. -- Alan Mackenzie (Nuremberg, Germany).