From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#59862: quit-restore per window buffer Date: Thu, 11 Jul 2024 09:47:27 +0300 Organization: LINKOV.NET Message-ID: <86a5ioo269.fsf@mail.linkov.net> References: <86fsds8mlm.fsf@mail.linkov.net> <86ttibq1w1.fsf@mail.linkov.net> <8243325e-ed03-4e9e-b64f-c8225fb6dc60@gmx.at> <18173da7-32e1-4f14-bbea-9a8fa66af7dd@gmx.at> <86plsxmc6d.fsf@mail.linkov.net> <86r0d4ezdc.fsf@mail.linkov.net> <0d01a044-d7d6-456a-9ba9-d987faad4332@gmx.at> <86frthjq4y.fsf@mail.linkov.net> <743dc4dd-cf09-4c5e-9209-b63a47480e0b@gmx.at> <86msnne7ut.fsf@mail.linkov.net> <86plsgrfvu.fsf@mail.linkov.net> <86le2b12ni.fsf@mail.linkov.net> <86y169kafb.fsf@mail.linkov.net> <61c4f245-3dd8-4e24-9c84-7ddd4cfe3c49@gmx.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31419"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: 59862@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 11 08:58:45 2024 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 1sRnlN-00083B-Ja for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Jul 2024 08:58:45 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sRnki-0001SA-L6; Thu, 11 Jul 2024 02:58: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 1sRnkh-0001Qn-CW for bug-gnu-emacs@gnu.org; Thu, 11 Jul 2024 02:58:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sRnkh-0005gt-40 for bug-gnu-emacs@gnu.org; Thu, 11 Jul 2024 02:58:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sRnkg-0002Pn-Am for bug-gnu-emacs@gnu.org; Thu, 11 Jul 2024 02:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jul 2024 06:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59862 X-GNU-PR-Package: emacs Original-Received: via spool by 59862-submit@debbugs.gnu.org id=B59862.17206810629242 (code B ref 59862); Thu, 11 Jul 2024 06:58:02 +0000 Original-Received: (at 59862) by debbugs.gnu.org; 11 Jul 2024 06:57:42 +0000 Original-Received: from localhost ([127.0.0.1]:50782 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sRnkL-0002Oz-RC for submit@debbugs.gnu.org; Thu, 11 Jul 2024 02:57:42 -0400 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:46047) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sRnkH-0002Oi-89 for 59862@debbugs.gnu.org; Thu, 11 Jul 2024 02:57:40 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 8A6ABE0003; Thu, 11 Jul 2024 06:57:10 +0000 (UTC) In-Reply-To: <61c4f245-3dd8-4e24-9c84-7ddd4cfe3c49@gmx.at> (martin rudalics's message of "Wed, 10 Jul 2024 11:16:24 +0200") X-GND-Sasl: juri@linkov.net 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:288717 Archived-At: >> But there is no *scratch* in the list of previous buffers for 'C-x t t C-h i' >> (that can be confirmed when tab-line is enabled), so the user won't expect >> to show *scratch*. And indeed the frame case doesn't show *scratch*. > > 'window--display-buffer' resets that window's previous buffers here > > (when (memq type '(window frame tab)) > (set-window-prev-buffers window nil)) > > In the "window" and "frame" case these are actually not needed because > when making a new window (on the same or a new frame), that window's > previous buffers are automatically set to nil - by make_window in the > release version and by the allocation routine with my patch. I reset > them just to make sure. When you show *info* in an already existing > window, that window's previous buffers are not reset. So the presence > of "tab" in the form above is not entirely correct in this regard. I checked that prev-buffers is nil in both frame and tab cases, so everything is correct here. >> I hoped that it would be possible for the tab case to do the same, >> but I don't know how the frame case is handled to do the right thing. > > In 'quit-restore-window' you count the windows with a 'quit-restore' > parameter. In the scenario at hand this gives 2 so you don't close the > tab. If you told me in detail what this counting is supposed to > accomplish, I might be able to help you. 'seq-count' with (window-parameter w 'quit-restore) is intended to be equivalent to (frame-root-window window) in the frame case, and even better. So the problem is not here. The difference between frame and tab case is that the frame branch calls 'window--delete' that decides whether to delete the frame, or just delete the window. But in the tab case it either closes the tab, or does nothing. So in the tab case it should call 'window--delete' as well, that will decide whether to close the tab, or just delete the window. Then 'window--delete' should do something like this: (unless (and dedicated-only (not (window-dedicated-p window))) (let ((deletable (window-deletable-p window))) (cond + ((eq deletable 'tab) + (tab-bar-close-tab) + 'tab) ((eq deletable 'frame) (let ((frame (window-frame window))) (cond Then maybe 'seq-count' with (window-parameter w 'quit-restore) should be moved to 'window-deletable-p'.