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, 09 Jul 2024 09:58:49 +0300 Organization: LINKOV.NET Message-ID: <86le2b12ni.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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29534"; 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 Jul 09 09:00:26 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 1sR4pu-0007cX-3U for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Jul 2024 09:00:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sR4pU-0004RN-9T; Tue, 09 Jul 2024 03:00:00 -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 1sR4pR-0004Qo-IG for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2024 02:59:57 -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 1sR4pR-0006i5-A7 for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2024 02:59:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sR4pW-00019Q-GH for bug-gnu-emacs@gnu.org; Tue, 09 Jul 2024 03:00: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, 09 Jul 2024 07:00: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.17205083714350 (code B ref 59862); Tue, 09 Jul 2024 07:00:02 +0000 Original-Received: (at 59862) by debbugs.gnu.org; 9 Jul 2024 06:59:31 +0000 Original-Received: from localhost ([127.0.0.1]:52018 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sR4p0-000185-KG for submit@debbugs.gnu.org; Tue, 09 Jul 2024 02:59:31 -0400 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:38985) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sR4oy-00017r-2e for 59862@debbugs.gnu.org; Tue, 09 Jul 2024 02:59:29 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id B13BEE0007; Tue, 9 Jul 2024 06:58:55 +0000 (UTC) In-Reply-To: (martin rudalics's message of "Mon, 8 Jul 2024 18:49:52 +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:288620 Archived-At: > It took me some time to rewrite the code for this since I found a couple > of leaks in the window handling code which I tried to plug now. In a > nutshell, the new patch is supposed to fix the following issues. > > - I introduced a new variable called 'kill-buffer-quit-windows'. If > non-nil, it makes killing a buffer call 'quit-restore-window' for each > window showing the buffer thus implementing the behavior you want. If > nil, killing a buffer works as before apart from the fixes I added > below. Thanks, I hope it will help to replace such configurations: (defun quit-window-kill-buffer () "Quit WINDOW and kill its buffer." (interactive) (quit-window 1)) (define-key special-mode-map "q" 'quit-window-kill-buffer) (define-key image-mode-map "q" 'quit-window-kill-buffer) (define-key global-map "\C-q" 'quit-window-kill-buffer) (define-key dired-mode-map "q" 'quit-window-kill-buffer) (define-key archive-mode-map "q" 'quit-window-kill-buffer) (define-key tar-mode-map "q" 'quit-window-kill-buffer) ... I suppose it will affect only interactive uses of 'kill-buffer'. > In earlier versions of Emacs, window configurations were mostly used to > handle window excursions and were consequently rather short-lived. Your > tab bar code has changed that. Hence we should try to avoid any leaks > introduced by long-lived configurations. Indeed now window configurations are long-lived, so tab-bar uses (split-window) followed by (delete-window) to create a new window different from the window saved in a window configuration. > Please test the patch intensively and report any problems you see. I > used the forms below to test the various features of the patch. I have used your previous patch for a long time, and it worked perfectly. I hope your new patch will be as good as the old one. PS: I noticed one difference between handling of frames and tabs: C-x 5 5 ;; other-frame-prefix C-h i ;; info C-h e ;; view-echo-area-messages q ;; quit-window This deletes the Info window, and doesn't delete the frame. Everything is correct. C-x t t ;; other-tab-prefix C-h i ;; info C-h e ;; view-echo-area-messages q ;; quit-window This doesn't close the tab (correct), but doesn't delete the Info window. This differs from the frame case that keeps only the Messages window on the frame.