bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59862: quit-restore per window buffer


From: Juri Linkov
Subject: bug#59862: quit-restore per window buffer
Date: Sun, 16 Jun 2024 19:50:29 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>  +       (< (seq-count (lambda (w) (window-parameter w 'quit-restore))
>
> The entire clause in 'quit-restore-window' governed by
>
>          (eq (nth 1 quit-restore) 'tab)
>
> needs a comment on what it is supposed to restore.

So here is a comment:

diff --git a/lisp/window.el b/lisp/window.el
index b7bd59bc813..5b782c93098 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5241,9 +5246,13 @@ quit-restore-window
            (window--delete window 'dedicated (eq bury-or-kill 'kill)))
       ;; If the previously selected window is still alive, select it.
       (window--quit-restore-select-window quit-restore-2))
+     ;; Close the tab if it doesn't contain more explicitly created windows.
      ((and (not prev-buffer)
           (eq (nth 1 quit-restore) 'tab)
-          (eq (nth 3 quit-restore) buffer))
+          (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)
       ;; If the previously selected window is still alive, select it.
       (window--quit-restore-select-window quit-restore-2))

> Basically, you check
> here whether WINDOW is the only window with a 'quit-restore' parameter.
> Is it that what you really want?  If a window has a 'quit-restore'
> parameter whose second element is 'tab' does that mean that all other
> windows on the same frame must also have such a parameter?  What happens
> if there are other windows without a 'quit-restore' parameter?

If there are other windows without a 'quit-restore' parameter,
this means that they were created implicitly without a direct
user action.  So the tab can be closed in this case.  There are
not many commands that create windows without a 'quit-restore'
parameter.  For example, Gnus creates several windows, and
the tab should be closed when the user closes the first window.

> As designed, the 'quit-restore' parameter can cause the deletion of its
> window only if there are other windows on the same frame.  It can cause
> the deletion of its frame only if there is no other window on its frame.
> Are these principles preserved by your patch?

Yes, the patch closes the tab only if there is no other window on the tab
explicitly created by user.

>> +                     (window-list-1 nil 'nomini))
>
> I suppose that nil is not correct here when WINDOW is not on the
> selected frame.  I'd rather use that window instead here.

The current code doesn't support non-selected frames
as 'tab-bar-close-tab' below shows without a frame argument:

>> +              2))
>>         (tab-bar-close-tab)
>>         ;; If the previously selected window is still alive, select it.
>>         (window--quit-restore-select-window quit-restore-2))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]