From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Benson Chu Newsgroups: gmane.emacs.bugs Subject: bug#62427: tab-bar-new-tab-to now handles cases with multiple side-windows Date: Tue, 28 Mar 2023 12:39:54 -0500 Message-ID: <874jq4zrdr.fsf@fastmail.com> References: <875yapvoxh.fsf@fastmail.com> <86jzz4mynj.fsf@mail.linkov.net> <83cz4wb0vz.fsf@gnu.org> <865yamhdx7.fsf@mail.linkov.net> <83cz4u9uz1.fsf@gnu.org> <86jzz2f8si.fsf@mail.linkov.net> <83sfdq86pi.fsf@gnu.org> <835yal82ta.fsf@gnu.org> <87a5zwzvga.fsf@fastmail.com> <83wn307qdr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31529"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.14; emacs 30.0.50 Cc: 62427@debbugs.gnu.org, juri@linkov.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 28 20:03:26 2023 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 1phDfI-00081C-Q9 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Mar 2023 20:03:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phDey-0006AB-JO; Tue, 28 Mar 2023 14:03:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phDex-00069q-2M for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2023 14:03:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1phDew-0000b3-Ny for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2023 14:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1phDew-0002Ww-0u for bug-gnu-emacs@gnu.org; Tue, 28 Mar 2023 14:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Benson Chu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Mar 2023 18:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62427 X-GNU-PR-Package: emacs Original-Received: via spool by 62427-submit@debbugs.gnu.org id=B62427.16800265379668 (code B ref 62427); Tue, 28 Mar 2023 18:03:01 +0000 Original-Received: (at 62427) by debbugs.gnu.org; 28 Mar 2023 18:02:17 +0000 Original-Received: from localhost ([127.0.0.1]:50680 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phDeC-0002Vs-L9 for submit@debbugs.gnu.org; Tue, 28 Mar 2023 14:02:17 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:53977) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phDeB-0002Vg-79 for 62427@debbugs.gnu.org; Tue, 28 Mar 2023 14:02:15 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id BD1235C016A; Tue, 28 Mar 2023 14:02:09 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 28 Mar 2023 14:02:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1680026529; x=1680112929; bh=0R uQyyb15trxOPhA4G/Er9IU3XXq/G2mtvNc6CbXRlg=; b=DIOnfsRB3JR+6mu4T0 jqe5RYe+Fqg2G0IBr+3uA9/iVmNQlDDFBojPl7FLdlXAcYfS0KFERQR2tSb1nlG8 8e+IM3RdvlXw63TVgcrNl6FNodsi3HbNaAEiVup2vCftPktb26ARVWbTR7vHZuoX ish9jWZDPoB3nNyRTU640XzVtk0deiInr6pt4HMDvcHvCGbUxR2i7BqEzlvkr4su MdYQvEfsfTrwji6UoSfIOEPuMSWWdqwPN1UaNjx0V0VL+xIwDYDYBJHv3wwF6lJS ApAp1H63mbI5GjJaXFpceZzTA6Or3g2Ko+YmH1ikRKivLMHJdmGFQt9XZCueTKJG xuAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1680026529; x=1680112929; bh=0RuQyyb15trxO PhA4G/Er9IU3XXq/G2mtvNc6CbXRlg=; b=gVZOb0MMo7AO5qLHuVVGSy7d471I2 tcnB9wThupcob3ri9wb6AgBUBwmTk+4WMMZRX0u7K674B+zQzX7SVPetcGcuCXJx sEpM3EZNue10tEiHVInaBbS1eIgWLZZ80yLcG7LoXMK0NEJmMXoP3UpAIzOSxfSM rWEUYKNUXWtzGc+P/3CP+Wn2af4olPwehCiFHp05q1aLzj/Rtwi69LaaztOLounG 3lvYHcnj2Sx+CROtbPp7VVcOl9cDm0IMIs0aURvPdFIcPoJQUKVCaAQO8uLbGpua /nMxW/GIm1mqu9Ab/HxXUlFx1Np+6ckniwqbOvWpTz4uhzP5SmMxqPU8Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehgedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpehffgfhvfevufffjgfkgggtsehttdertddtredtnecuhfhrohhmpeeuvghn shhonhcuvehhuhcuoegsvghnshhonhgthhhugeehjeesfhgrshhtmhgrihhlrdgtohhmqe enucggtffrrghtthgvrhhnpeffteeffeeuieffgfffteevieduhffhgeduudehudeuleet ledtvdegleeljeehleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegsvghnshhonhgthhhugeehjeesfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: id5c9466e:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Mar 2023 14:02:08 -0400 (EDT) In-reply-to: <83wn307qdr.fsf@gnu.org> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258819 Archived-At: > Ugh! That is _soooo_ inelegant... Also inefficient Hehe, I see what you mean, but creating frames is so expensive. These tabs are like lightweight frames for me. What would you suggest be done instead? > Is this inside unwind-protect, so that any error or quit or throw is > caught and the parameters restored? If so, it might be semi-okay. Ahhh, that is a good point. The reason I even noticed this error was that there wasn't an unwind-protect around it, so not only would Emacs not switch to a new tab, but my window paramters for the current tab would be all messed up. > What does display-buffer do in this case? reuse the same window > regardless of any action alists? Huh, that is a gooood question. I will look into what #'display-buffer does. Eli Zaretskii writes: >> From: Benson Chu >> Cc: juri@linkov.net, 62427@debbugs.gnu.org >> Date: Tue, 28 Mar 2023 11:17:29 -0500 >> >> > Can't we create a completely new window and show the buffer in it? >> >> I'm not sure how easy this is. Typically new windows come from calls to >> #'split-window, and you can't do that for a side-window. > > What does display-buffer do in this case? reuse the same window > regardless of any action alists? > >> > I'm very uncomfortable with removing window >> > parameters like that. These windows don't belong to us, right? >> >> Let me know if this is wrong, but I am interpreting this statement as: >> >> "We shouldn't be modifying the window parameters of the windows that >> belong to the old tab." > > There doesn't have to be any "old tab". AFAIU, this option's default > value is t, so even when you create the first tab, the code you > suggest changing will run and mess with the window parameters of the > windows that happen to exist at that point. Right? > >> Because if that's the case, we're not /really/ modifying the old tab's >> window-parameters. They're only "removed" "temporarily", for the >> purposes of creating the new tab. You can see right before we modify any >> window parameters, we make a call to (tab-bar--tab), which returns a tab >> data structure, which contain a representation of the current wconf >> (window configuration) - effectively saving the wconf - including the >> paramaters. It's kind of like a save excursion: >> >> (let ((old-tab-num (tab-bar--current-tab-index tabs)) >> (old-window-configuration (tab-bar--tab))) >> ;; modify window-parameters >> ;; do appropriate splitting >> ;; Now we have the window layout for the new tab >> >> ;; The old tab should have the old-window-configuration >> (setf (nth old-tab-num tabs) old-window-configuration) >> >> ;; The rest of the function >> ) > > Is this inside unwind-protect, so that any error or quit or throw is > caught and the parameters restored? If so, it might be semi-okay. > >> So, we capture the current window configuration at the start of the >> function, transition the current window configuration into the window >> configuration for the new tab (which involves mangling window >> parameters and destroying windows), then we make sure that the old tab >> has an unmodified window-configuration. > > Ugh! That is _soooo_ inelegant... Also inefficient, and quite > fragile (as any code which uses seve/restore window-configuration is). > But I guess that ship has sailed long ago. > >> When the user switches back to the tab they left, all the >> window-parameters are still present, untouched. Are you still >> uncomfortable with doing things this way? > > What happens with all kinds of hooks that run due to this saving and > restoring window-configuration? they still will see windows without > their parameters, right?