[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs
From: |
Juri Linkov |
Subject: |
bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs |
Date: |
Fri, 07 Jun 2024 20:20:03 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
>> Sorry, I don't understand what I should do in tab-bar-mode
>> for quit-restore-window. I expected that changes should be
>> in window.el.
>
> Provide an option, say 'tab-bar-save-frame', that allows users to
> customize whether a frame should be deleted when "other tabs are
> available for that frame". And provide a function, say
> 'tab-bar-save-frame-p', 'window--delete' could call thusly
Ok, here is a better patch:
diff --git a/lisp/window.el b/lisp/window.el
index 2208346ec8c..abc9f1b4011 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4968,6 +4968,10 @@ frame-auto-hide-function
:group 'frames
:version "26.1")
+(defvar window-delete-frame-predicate-functions nil
+ "Don't delete frame when one of functions returns t.
+Called with two arguments: FRAME and KILL.")
+
(defun window--delete (&optional window dedicated-only kill)
"Delete WINDOW if possible.
WINDOW must be a live window and defaults to the selected one.
@@ -4982,6 +4986,10 @@ window--delete
((eq deletable 'frame)
(let ((frame (window-frame window)))
(cond
+ ((run-hook-with-args-until-success
+ 'window-delete-frame-predicate-functions
+ frame kill)
+ nil)
(kill
(delete-frame frame))
((functionp (frame-parameter frame 'auto-hide-function))
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index dac57ce2070..25bfefbc205 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -2631,6 +2631,14 @@ tab-switcher-mouse-select
(goto-char (posn-point (event-end event)))
(tab-switcher-select))
+
+(defun tab-bar-window-delete-frame-p (frame _kill)
+ "Whether FRAME should be deleted when other tabs are available for that
frame.
+Used via `window-delete-frame-predicate-functions' by `window--delete'."
+ (and tab-bar-mode (> (length (funcall tab-bar-tabs-function frame)) 1)))
+
+(add-hook 'window-delete-frame-predicate-functions
#'tab-bar-window-delete-frame-p)
+
(defun tab-bar--reusable-frames (all-frames)
(cond
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Al Haji-Ali, 2024/06/05
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Eli Zaretskii, 2024/06/06
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Juri Linkov, 2024/06/06
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, martin rudalics, 2024/06/06
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Juri Linkov, 2024/06/07
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, martin rudalics, 2024/06/07
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs,
Juri Linkov <=
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Eli Zaretskii, 2024/06/07
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Juri Linkov, 2024/06/07
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Al Haji-Ali, 2024/06/07
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Juri Linkov, 2024/06/09
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Eli Zaretskii, 2024/06/09
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Juri Linkov, 2024/06/09
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Eli Zaretskii, 2024/06/09
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Juri Linkov, 2024/06/09
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, martin rudalics, 2024/06/10
- bug#71386: 29.1; Frame is auto-deleted even when it has multiple tabs, Juri Linkov, 2024/06/11