From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59862: quit-restore per window buffer Date: Thu, 10 Oct 2024 16:54:02 +0200 Message-ID: <9c103d92-c8f5-4fe7-934f-2f56219475b8@gmx.at> References: <86fsds8mlm.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> <86a5ioo269.fsf@mail.linkov.net> <867cdr3xs7.fsf@mail.linkov.net> <3f399d4f-3dd2-4624-b857-e198f70b5565@gmx.at> <86h6csct0w.fsf@mail.linkov.net> <38aedd8d-8966-44eb-afc0-79b4db412483@gmx.at> <86r0b9tqo3.fsf@mail.linkov.net> <22c18c89-b288-4c2e-83ae-11fd7cb1ec24@gmx.at> <86ed78w7t4.fsf@mail.linkov.net> <86msjefqfa.fsf@mail.linkov.net> <6272a373-1e7c-4df9-b0c2-e535ca3fe49b@gmx.at> <864j5ll110.fsf@mail.linkov.net> Reply-To: martin rudalics Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32584"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 59862@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 10 16:55:20 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 1syuZU-0008Jq-8h for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Oct 2024 16:55:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syuZ6-0002fl-Ln; Thu, 10 Oct 2024 10:54:56 -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 1syuZ1-0002fJ-4w for bug-gnu-emacs@gnu.org; Thu, 10 Oct 2024 10:54:51 -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 1syuZ0-0002Ow-O6 for bug-gnu-emacs@gnu.org; Thu, 10 Oct 2024 10:54:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=eC7gqJEPnVYZm9nJn0maAmPxGXg2Xiar4e4JWvT8ssA=; b=Au9JZTP3PA/qy82cmWzdA6R6GQjIzKuxek7HsEUZ49XBnPD2qCbhK6cqQjxepTfCuiA4vOvmaCgCS0RFg/iA6jcaQotSHJkuUxJQCO35OOUXZc9EPqtpcjJwCuMgmkBdJY+8ErxcAHURdsptvED+bW/mxfNTBeDr13+z6jDN0jf9bCuxMsWrAsrV0W60zv9btFq4S6mI7aGUYIs0CatWcO3AXTEDv9Qq/M9mnu4DTH+rjWXYUQ4Tanx6lmLqefy0gow3MiG8sT34VfX/SHM67epid1n2dXRgW/hXKpCrUVS7jKsb9nqEG0d41m9JJ7T0rlTE7/MTXzv8Sil5gWh6iQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1syuZC-0006Uy-4p for bug-gnu-emacs@gnu.org; Thu, 10 Oct 2024 10:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Oct 2024 14:55: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.172857206824927 (code B ref 59862); Thu, 10 Oct 2024 14:55:02 +0000 Original-Received: (at 59862) by debbugs.gnu.org; 10 Oct 2024 14:54:28 +0000 Original-Received: from localhost ([127.0.0.1]:60202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1syuYd-0006Tz-K7 for submit@debbugs.gnu.org; Thu, 10 Oct 2024 10:54:27 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:34791) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1syuYa-0006Tj-T7 for 59862@debbugs.gnu.org; Thu, 10 Oct 2024 10:54:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at; s=s31663417; t=1728572046; x=1729176846; i=rudalics@gmx.at; bh=eC7gqJEPnVYZm9nJn0maAmPxGXg2Xiar4e4JWvT8ssA=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=ZMpz3T8isIMfAYyxyEeb6tuG8+Ens/P+POHp0KWPFgo5FZzZegLacl2Ehx8UbgCm MT8AOwAf5ibhxUsic9Z1z4gJ7jPWtDyZxDDP+pKBL8YpvVw9r0dWLn0pO+j1iu+YR Xm+PNzms0z3x7VFD3rfjGuOQfwNgbcG2lwUvwnIpzDPv9i9tLDoyFQCF1hkjyDbAT vd78FKyHlw4apxw4UjP//DM6tTLkU7DoR5OB9qqh1O78/EVlpJ/QZih/Nqt7ifsZ2 Rjq+wdVHghggkysmyMIwSqOPLcEaR/Sm8/pd9GAuC8YrLEnHQ31a02GxMEr77qBU7 B2caLoQ9NTI8XV3CQg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.31.113] ([46.125.249.23]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Ma20q-1tSWni05MC-00SXxN; Thu, 10 Oct 2024 16:54:06 +0200 Content-Language: en-US In-Reply-To: <864j5ll110.fsf@mail.linkov.net> X-Provags-ID: V03:K1:8eZ10qnOJfUgHxC5wWj4w19xS+Jg4xhr1fjOT+H10WoKRtU9lg1 08PGBejiPe8MNDfVRrOKGPbHkKXfWB4F5lC8v7LSmuOH/Kuyptn+kHICobOJ/uDXE1kN0AA HpGfemarOm8BU8zuWMRSSvSeEAhmXXdwfvj/BeF75f8vjn9O+y/YJND0axAlCICkEIBVl3b Ni8rT7hqI3/l8g25c5+Fw== UI-OutboundReport: notjunk:1;M01:P0:km94Zc7/Zdw=;TM7H1api+PPEGuWFiaZm0+FWpJU 50Dpu35HAL1KI+irOzzyMZWR+D5NhDPvyIAD9m4GQuQfcjbycSVW8PpTXV4weuFNBHznbMYOb 57vMUBZDWJmeJW5Tt/Q2X684IRSNKHi7Je3kNeWLkQBrrcltH9D/HHdQ0SkZEx/lGi5vtoHDu jvG2FmEC0+jc1AmhqK4fx6mQtNLSGW60OJXKrX1M/unnChq3Do0HH5s9CeoaQ4ASvwkdj9uV/ 8H7z5aUzTxsY0PP/km4C/7lypny/yGBcIDzgEQrIvgs/y7poR5Dif8Rr3J0yDsNtDm9VC1fCT dCKDZh6EqkOMEgPY8INBUzZnqafr1Nh5GOHlY7Ohq2ZIjsatG7dJ14GyzC71J/nRj+9khp+dL LQuPXk6xVLaMxhLt4/ZX8IVEsE8TEug7B3BtXplUtPWRG1OMRqNPIk4pp8PuzSwDbKWLNVQgD 04aAYhEqjKDUcm03fJCHvemx6bwoEob/jkRKUqfCqshJ/8/902TPrg0WYPpqpwiuTGTgV57fY CT8tLgla566EW+kL5/EWGvsQeV55BOd9sAqYbAUwyR0IPV5V/75QIPzGxafa+pHvFrVV+9bKp UjKgIjVdEsemiae0tQwhSDPyarpSAwEUz4CqKsu2vdfTeSslPZtAmK6Nlf8cI+irfjDfyRqf5 KUTVcg5mqQKd5zEpHVvFzrGWGmxcKxdCMPSFWfF092hIoQnuZftOncoYTaNqWbLrm2z1sS55+ npbDW0BDNWUVh6+AU2ZSQLpu2fZMr1CSVolg6NE/kPDOnKShhaiEOn67hMy5LTLhJ1ygcOjV 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:293286 Archived-At: > Because tabs have priority over frames. The precedence is: > windows -> tabs -> frames. When there are many tabs > then quit-restore-window should close tabs, and only > on the last tab should delete the frame. This is bug#71386, > but first need to finish bug#59862. So which bug are we discussing here? Bug#59862 or Bug#71386? >> I don't understand the problem yet. 'window-deletable-p' calls >> 'frame-deletable-p' iff WINDOW is the root window of the frame. At this >> time we can only either delete the frame or show another buffer in >> WINDOW; tertium non datur. What am I missing? > > The third first-class citizen is the tab-bar. But I haven't written anything for the tab-bar code. This is something you have to provide. Earlier you proposed diff --git a/lisp/window.el b/lisp/window.el index 58120c919c7..82efb3c40ce 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4120,6 +4120,11 @@ window-deletable-p (let ((frame (window-frame window))) (cond + ((and (eq (nth 1 (window-parameter window 'quit-restore)) 'tab) + (< (seq-count (lambda (w) (window-parameter w 'quit-restore)) + (window-list-1 nil 'nomini)) + 2)) + 'tab) ((frame-root-window-p window) ;; WINDOW's frame can be deleted only if there are other frames ;; on the same terminal, and it does not contain the active @@ -4990,6 +4995,9 @@ window--delete (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 @@ -5303,10 +5311,8 @@ quit-restore-window ((and (not prev-buffer) (eq (nth 1 quit-restore) 'tab) (eq (nth 3 quit-restore) buffer) - (< (seq-count (lambda (w) (window-parameter w 'quit-restore)) - (window-list-1 nil 'nomini)) - 2)) - (tab-bar-close-tab) + (window--delete + window nil (memq bury-or-kill '(kill killing)))) ;; If the previously selected window is still alive, select it. (window--quit-restore-select-window quit-restore-2)) ((and (not prev-buffer) martin