GNU bug report logs - #71386
29.1; Frame is auto-deleted even when it has multiple tabs

Previous Next

Package: emacs;

Reported by: Al Haji-Ali <abdo.haji.ali <at> gmail.com>

Date: Thu, 6 Jun 2024 00:11:02 UTC

Severity: wishlist

Found in version 29.1

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #202 received at 71386 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: martin rudalics <rudalics <at> gmx.at>, Eli Zaretskii <eliz <at> gnu.org>,
 abdo.haji.ali <at> gmail.com, 71386 <at> debbugs.gnu.org
Subject: Re: bug#71386: 29.1;
 Frame is auto-deleted even when it has multiple tabs
Date: Mon, 31 Mar 2025 15:31:10 -0400
[Message part 1 (text/plain, inline)]
On Mon, Mar 31, 2025 at 2:59 PM Juri Linkov <juri <at> linkov.net> wrote:

> > I thought Martin agreed that we don't need `(window-dedicated-p window)`
> in
> > `window-deleteable-p`?  That makes my use case work.  Or are you waiting
> > for the test case and do you want that stand alone or in the test suite?
>
> Currently we have such test:
>
>     ;; 3. Don't delete the frame with dedicated window
>     ;; from the second tab (bug#71386)
>     (with-selected-frame (make-frame frame-params)
>       (switch-to-buffer (generate-new-buffer "test1"))
>       (tab-new)
>       (switch-to-buffer (generate-new-buffer "test2"))
>       (set-window-dedicated-p (selected-window) t)
>       (kill-buffer)
>       (should (eq (length (frame-list)) 2))
>       (should (eq (length (tab-bar-tabs)) 1))
>       ;; But now should delete the frame with dedicated window
>       ;; from the last tab
>       (set-window-dedicated-p (selected-window) t)
>       (kill-buffer)
>       (should (eq (length (frame-list)) 1)))
>
> So you propose to remove the line with 'set-window-dedicated-p', right?
>

Not quite.  The test that simulates the environment I find frames being
deleted in is more like this:

(setq switch-to-prev-buffer-skip #'always)
(setq kill-buffer-quit-windows nil)
(tab-bar-mode)
(select-frame-set-input-focus (make-frame))
(switch-to-buffer "FOO")
(tab-bar-new-tab)
(switch-to-buffer "BAR")
(set-window-prev-buffers nil nil) ; Martin said this is the moral
equivalent of window-dedicated-p, but not technically
;; (kill-buffer)

The suggestion about removing the dedicated window condition is in
`window-deletable-p` here which could be left in place as long as the case
representing the above scenario is also accounted for.

     ((and tab-bar-mode
           ;; Fall back to frame handling in case of less than 2 tabs
           (> (length (funcall tab-bar-tabs-function frame)) 1)
           ;; Close the tab with the initial window (bug#59862)
           (or (eq (nth 1 (window-parameter window 'quit-restore)) 'tab)
               ;; or with the dedicated window (bug#71386)
               (and (window-dedicated-p window) ; <========================
                    (frame-root-window-p window)))
           ;; Don't close the tab if more windows were created explicitly
           (< (seq-count (lambda (w)
                           (memq (car (window-parameter w 'quit-restore))
                                 '(window tab frame same)))
                         (window-list-1 nil 'nomini))
              2))
      'tab)
[Message part 2 (text/html, inline)]

This bug report was last modified 34 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.