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, 14 Nov 2020 18:48:58 +0000 Message-ID: <20201114184858.GA8992@ACM> References: <835z6b27xm.fsf@gnu.org> <20201111203716.GA19003@ACM> <83v9e8ukk4.fsf@gnu.org> <837dqnvp53.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="21078"; mail-complaints-to="usenet@ciao.gmane.io" Cc: enometh@meer.net, monnier@iro.umontreal.ca, andreyk.mad@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 14 19:49:55 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 1ke0cV-0005PT-Rw for ged-emacs-devel@m.gmane-mx.org; Sat, 14 Nov 2020 19:49:55 +0100 Original-Received: from localhost ([::1]:42522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ke0cU-0005j6-TH for ged-emacs-devel@m.gmane-mx.org; Sat, 14 Nov 2020 13:49:54 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ke0bh-000595-TG for emacs-devel@gnu.org; Sat, 14 Nov 2020 13:49:05 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:59052 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1ke0bf-0001Lr-Gz for emacs-devel@gnu.org; Sat, 14 Nov 2020 13:49:05 -0500 Original-Received: (qmail 75153 invoked by uid 3782); 14 Nov 2020 18:48:59 -0000 Original-Received: from acm.muc.de (p2e5d5492.dip0.t-ipconnect.de [46.93.84.146]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Sat, 14 Nov 2020 19:48:59 +0100 Original-Received: (qmail 9022 invoked by uid 1000); 14 Nov 2020 18:48:58 -0000 Content-Disposition: inline In-Reply-To: <837dqnvp53.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/14 13:48:59 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:259178 Archived-At: Hello, Eli. On Sat, Nov 14, 2020 at 19:12:24 +0200, Eli Zaretskii wrote: > > Date: Sat, 14 Nov 2020 15:36:43 +0200 > > From: Eli Zaretskii > > Cc: enometh@meer.net, monnier@iro.umontreal.ca, andreyk.mad@gmail.com, > > emacs-devel@gnu.org > > > Date: Wed, 11 Nov 2020 20:37:16 +0000 > > > Cc: Andrii Kolomoiets , monnier@iro.umontreal.ca, > > > enometh@meer.net, emacs-devel@gnu.org > > > From: Alan Mackenzie > > > > > C-x 5 2 > > > > > M-x > > > > > C-x 5 o > > > > > M-x > > > > > With the default setting of `enable-recursive-minibuffers`, the > > > > > minibuffer is moved to active frame, but the error message is displayed > > > > > in the other frame. > > > > Arguably a bug. Alan, could you please look into this? > > > I think this is a bug, too. > > > I've been looking at the C sources for some while but haven't found > > > anything useful. I've tried setting echo_area_window during the frame > > > change, but this doesn't have any visible effect. > > > I'll carry on with the diagnosis. Any quick tips would be welcome. > > My guess is that this is somehow related to the fact that error > > messages are displayed as part of handling an error signal, which > > causes a throw to top level. > Specifically, read-from-minibuffer (called when we type the first M-x) > binds some variables, then enters recursive-edit. When the error > unwinds the stack, it restores the original window configuration, > which includes the frame which was selected back then. And that > undoes the effect of "C-x 5 o", so the error message is displayed on > the original frame. Thanks! I was approaching the same conclusion myself, but much more slowly than you. ;-) Arguably, Fset_window_configuration selecting the pertinent frame is a bug in the specification of that function - one should be able to restore a frame's configuration without selecting the frame as well. However, backwards compatibility, and all that.... I propose fixing the bug at the place where read_minibuf saves the frame configuration. As well as saving that frame configuration, it should additionally save another Lisp_Object for which nil means "restore the selected frame", non-nil means "don't restore it". Fset_window_configuration would acquire an extra &optional parameter with the same meaning. The function restore_window_configuration, frustratingly, is used in only one place apart from read_minibuf, and that is in an obsolete byte code in bytecode.c. What do you think? -- Alan Mackenzie (Nuremberg, Germany).