emacs-31 293eaf323a0: Have 'frame-deletable-p' check other frame's terminal (Bug#81575)

Martin Rudalics via Mailing list for Emacs changes <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit 293eaf323a0e23184f86d55433c2805bc7501dc8
Author: Martin Rudalics <[email protected]>
Commit: Martin Rudalics <[email protected]>

    Have 'frame-deletable-p' check other frame's terminal (Bug#81575)
    
    * lisp/frame.el (frame-deletable-p): Return nil when there's no
    other visible or iconified frame on FRAME's terminal (Bug#81575).
---
 lisp/frame.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lisp/frame.el b/lisp/frame.el
index 36c14304ec7..d6cd3dea359 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -198,7 +198,7 @@ FRAME must be a live frame and defaults to the selected frame.
 
 FRAME cannot be safely deleted in the following cases:
 
-- FRAME is the only visible or iconified frame.
+- There is no other visible or iconified frame on FRAME's terminal.
 
 - FRAME hosts the active minibuffer window that does not follow the
   selected frame.
@@ -216,6 +216,7 @@ will be better to wrap the `delete-frame' call in a `condition-case'
 form."
   (setq frame (window-normalize-frame frame))
   (let ((active-minibuffer-window (active-minibuffer-window))
+        (terminal (frame-terminal frame))
 	deletable)
     (catch 'deletable
       (when (and active-minibuffer-window
@@ -228,12 +229,13 @@ form."
 
       (let ((frames (delq frame (frame-list))))
 	(dolist (other frames)
-	  ;; A suitable "other" frame must be either visible or
-	  ;; iconified.  Child frames and frames with a non-nil
-	  ;; 'delete-before' parameter do not qualify as other frame -
-	  ;; either of these will depend on a "suitable" frame found in
-	  ;; this loop.
-	  (unless (or (frame-parent other)
+	  ;; A suitable "other" frame must be on the same terminal as
+          ;; FRAME and must be either visible or iconified.  Child
+          ;; frames and frames with a non-nil 'delete-before' parameter
+          ;; do not qualify as other frame - either of these will depend
+          ;; on a "suitable" frame found in this loop.
+	  (unless (or (not (eq (frame-terminal other) terminal))
+                      (frame-parent other)
 		      (frame-parameter other 'delete-before)
 		      (not (frame-visible-p other)))
 	    (setq deletable t))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.