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: Tue, 08 Oct 2024 20:53:53 +0300 Organization: LINKOV.NET Message-ID: <86msjefqfa.fsf@mail.linkov.net> References: <86fsds8mlm.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> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31388"; 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 Tue Oct 08 20:19:17 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 1syEnk-000802-M3 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Oct 2024 20:19:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1syEnP-0007no-J5; Tue, 08 Oct 2024 14:18:55 -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 1syEnN-0007mz-Lv for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2024 14:18:53 -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 1syEnN-00079N-DZ for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2024 14:18:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=5OKBVf/EIyRbNNMqgSczyY17uyC8646d8AwkfbjYxoY=; b=ra71fF42Ej14k/bV3f/rYjewhLvCNc2ai90ZcTjVjwDYIVkgzNqR9qYghaoMrpooWHxpH5PxbuxbTs9fVfX+LPWRj6ogHUbr+qOrhdynNGy46iD3VtuQ3A/ffawHnt1xxZ659g58aCTDW7e4N+4QJkxnC3cXWyba+fvjc3PgxeCc1uw7mXr4KMMP1H3rAbY16AN4BkLOLKvlk6zgOBh7TUfO/SI+DCU1cRcYw8I2WMSoM6AsH3GR3oDR6rHdOOQAxbaeaQGJ/oN/2tTKCtwbzKKSoa15hoEn/281GFP6FqSvvzjEsMchluY1DTiw9X1wQzPVNtWRFDjuEjt1mtCuDg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1syEnW-000642-0y for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2024 14:19: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: Tue, 08 Oct 2024 18:19:01 +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.172841151423271 (code B ref 59862); Tue, 08 Oct 2024 18:19:01 +0000 Original-Received: (at 59862) by debbugs.gnu.org; 8 Oct 2024 18:18:34 +0000 Original-Received: from localhost ([127.0.0.1]:54376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1syEn4-00063H-6C for submit@debbugs.gnu.org; Tue, 08 Oct 2024 14:18:34 -0400 Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:50645) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1syEn1-000632-Tq for 59862@debbugs.gnu.org; Tue, 08 Oct 2024 14:18:33 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id BE9D31C0004; Tue, 8 Oct 2024 18:17:54 +0000 (UTC) In-Reply-To: <86ed78w7t4.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 01 Aug 2024 19:01:59 +0300") 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:293167 Archived-At: >> Pushed now. Lets hope for the best. Please consider closing Bug#59862. > > Thank you! I'm going to test bug#59862 and bug#71386. I tried to support this case C-x t t ;; other-tab-prefix C-h i ;; info C-h e ;; view-echo-area-messages q ;; quit-window should not close the tab using the new hook 'window-deletable-functions', but I see no way. Could you please help. Here is what I did: diff --git a/lisp/window.el b/lisp/window.el index e08680aa392..5b4f642afc9 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -5340,13 +5346,7 @@ quit-restore-window ;; If the previously selected window is still alive, select it. (window--quit-restore-select-window quit-restore-2)) ((and (not prev-buffer) - (eq (nth 1 quit-restore) 'tab) - (eq (nth 3 quit-restore) buffer)) - (tab-bar-close-tab) - ;; If the previously selected window is still alive, select it. - (window--quit-restore-select-window quit-restore-2)) - ((and (not prev-buffer) - (or (eq (nth 1 quit-restore) 'frame) + (or (memq (nth 1 quit-restore) '(frame tab)) (and (eq (nth 1 quit-restore) 'window) ;; If the window has been created on an existing ;; frame and ended up as the sole window on that So frame and tab will be handled equally. Then also code for tab-bar.el: (defun tab-bar-window-deletable (window single) (if (and single (eq (nth 1 (window-parameter window 'quit-restore)) 'tab)) (progn (tab-bar-close-tab) nil) t)) (add-hook 'window-deletable-functions 'tab-bar-window-deletable) But 'window-deletable-functions' is not called at all, because 'window-deletable-p' first checks (frame-deletable-p (window-frame window)) and a single frame with tabs is not deletable. Also instead of 'frame-root-window-p' in 'window-deletable-p' the tab-bar needs to use another code.