From 1ed0e9ccde3414d4345ee42d488c58adb3af8a35 Mon Sep 17 00:00:00 2001 From: "Ryan C. Thompson" Date: Sat, 30 Nov 2024 19:26:44 -0500 Subject: [PATCH] Fix a bug with deleting the last frame on a terminal For some reason, Emacs thinks it's deleting the last frame when it's not, so we just use the FORCE argument to "delete-frame" because we (presumably) know better. --- pseudo-daemon.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pseudo-daemon.el b/pseudo-daemon.el index 53b65ef..7088434 100644 --- a/pseudo-daemon.el +++ b/pseudo-daemon.el @@ -373,8 +373,13 @@ as normal, so that the pseudo-daemon can do its work." (apply orig-fun args)))) (defsubst pseudo-daemon-delete-all-frames-on-terminal (terminal) - "Call `delete-frame' on all frames on TERMINAL" - (mapc #'delete-frame (pseudo-daemon--terminal-frame-list terminal))) + "Call `delete-frame' on all frames on TERMINAL." + ;; We use the FORCE argument to `delete-frame' here, because + ;; otherwise when it gets to the "last" frame, it thinks that the + ;; frame is still last even after running + ;; `pseudo-daemon-make-hidden-frame' first. + (mapc (lambda (frm) (delete-frame frm t)) + (pseudo-daemon--terminal-frame-list terminal))) (defun save-buffers-kill-terminal@pseudo-daemon (orig-fun &rest args) "Advice implementing `pseudo-daemon-mode'.