On Mon, Mar 31, 2025 at 2:59 PM Juri Linkov 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)