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: Wed, 4 Nov 2020 17:39:54 +0000 Message-ID: <20201104173954.GA14535@ACM> References: <20201031194419.GC5887@ACM> <834kmago8m.fsf@gnu.org> <20201031203914.GD5887@ACM> <835z6ogc1h.fsf@gnu.org> <20201101195313.GA6190@ACM> <83sg9rd6cp.fsf@gnu.org> <20201102185147.GC7297@ACM> <83mtzzd0s3.fsf@gnu.org> <20201103210853.GA21923@ACM> <83ft5pax2p.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="21839"; 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 Wed Nov 04 18:40:45 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 1kaMm4-0005ZG-W1 for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Nov 2020 18:40:44 +0100 Original-Received: from localhost ([::1]:35954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kaMm4-0003dr-1y for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Nov 2020 12:40:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kaMlL-0002hh-Nq for emacs-devel@gnu.org; Wed, 04 Nov 2020 12:39:59 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:60824 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1kaMlJ-0001Rl-7Z for emacs-devel@gnu.org; Wed, 04 Nov 2020 12:39:59 -0500 Original-Received: (qmail 19051 invoked by uid 3782); 4 Nov 2020 17:39:54 -0000 Original-Received: from acm.muc.de (p4fe15a34.dip0.t-ipconnect.de [79.225.90.52]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Wed, 04 Nov 2020 18:39:54 +0100 Original-Received: (qmail 14557 invoked by uid 1000); 4 Nov 2020 17:39:54 -0000 Content-Disposition: inline In-Reply-To: <83ft5pax2p.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/04 12:39:55 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:258688 Archived-At: Hello, Eli. On Wed, Nov 04, 2020 at 18:47:10 +0200, Eli Zaretskii wrote: > > Date: Tue, 3 Nov 2020 21:08:53 +0000 > > Cc: emacs-devel@gnu.org > > From: Alan Mackenzie > > OK, I've extracted a new function `live_minibuffer_p' from > > Fminibufferp, and call that directly from the mini-window emptying > > code. (The new second parameter in Fminibufferp is still needed, > > since it is used in minibuffer.el.) > > Here's a patch of the subset of changes to minibuf.c which are > > relevant to our discussions of the last two or three days. Perhaps > > we are close to the stage when this could be committed to master. > Yes, I think so. Maybe I should do that this evening. WDYT? > > + if (EQ (buffer, Fcar (Vminibuffer_list))) > > + /* *Minibuf-0* is never active. */ > > + return false; > > + tem = Fcdr (Vminibuffer_list); > > + for (i = 1; i <= minibuf_level; i++, tem = Fcdr (tem)) > > + if (EQ (Fcar (tem), buffer)) > > + return true; > > + return false; > I'm curious: why a loop instead of a call to Fmemq? Because Vminibuffer_list is a list of all minibuffers which have ever been active. When the use of a MB is terminated, the MB stays on the list (for reuse), and minibuf_level is decremented. So an Fmemq would need somehow to ignore the end of the Vminibuffer_list. Just doing a loop in C seems simpler. -- Alan Mackenzie (Nuremberg, Germany).