bug#81575: 31.0.91; Regression in window-deletable-p when Emacs is started as a daemon
Aaron Zeng via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]> Fri, 07 Aug 2026 14:06:54 -0400
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello,
When Emacs is started as a daemon:
$ emacs -Q --daemon
$ emacsclient -nw
Previously, (window-deletable-p) returned nil when there was only a
single window in the one-and-only emacsclient frame. In bd647f36,
this behavior changed so that (window-deletable-p) returns `frame'.
I believe the previous behavior was correct, and matches the intended
use of this function (namely, may a frame be deleted implicitly by
some other operation?). The attached patch restores the previous
behavior in this situation. (FWIW it's sort of confusing that the
initial frame is considered visible for the purpose of
frame-visible-p, but I didn't attempt to change that because it seemed
likely to be necessary for some internal reason.)
For context on the downstream effect, a user at my site reported a
regression with the vterm-toggle package which uses window-deletable-p
to decide how to "dispose of" the window displaying a vterm buffer
when the process exits:
(if (eq vterm-toggle-reset-window-configration-after-exit 'kill-window-only)
(cond
((eq (window-deletable-p) 'frame)
(delete-frame))
((eq (window-deletable-p) t)
(delete-window))
(t
(quit-window)))
I think the above snippet is sensible and should be made to continue
to work.
In GNU Emacs 31.0.91 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.18.4, Xaw scroll bars)
Repository revision: d4b0c58ece90c50b60345ad4a03d4ccc6f58c6d7
System Description: Rocky Linux 8.10 (Green Obsidian)
Configured using:
'configure
--prefix=/nix/store/gsjs85fqs3iljhf6j33pwlyi1vn2qp59-emacs-30.2
--disable-build-details --with-modules --with-x-toolkit=lucid
--with-cairo --without-xft --disable-gc-mark-trace
--without-compress-install --with-toolkit-scroll-bars
--with-native-compilation --without-imagemagick --with-mailutils
--without-small-ja-dic --with-tree-sitter --with-xinput2
--without-xwidgets --with-dbus --without-selinux --without-gif
--without-libotf --without-m17n-flt --without-xaw3d --without-webp'
Configured features:
CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSYSTEMD
LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE
XIM XINERAMA XINPUT2 XPM XRANDR LUCID ZLIB
Important settings:
value of $LANG: en_US.utf8
locale-coding-system: utf-8-unix
0001-Fix-window-deletable-p-behavior-change-in-daemon-mod.patch
(text/x-patch, 1.1 KB)
From 91360b5479e1ade96ca5d80ad42f2b0205ccb16b Mon Sep 17 00:00:00 2001 From: "Aaron L. Zeng" <[email protected]> Date: Fri, 7 Aug 2026 13:57:19 -0400 Subject: [PATCH] Fix window-deletable-p behavior change in daemon mode * lisp/frame.el (frame-deletable-p): Return nil if the only "other" frame is the initial frame. --- lisp/frame.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/frame.el b/lisp/frame.el index 36c14304ec7..83e7bf75878 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -232,8 +232,10 @@ frame-deletable-p ;; 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) + ;; this loop. The initial frame used internally during + ;; daemon/batch mode also does not qualify. + (unless (or (frame-initial-p other) + (frame-parent other) (frame-parameter other 'delete-before) (not (frame-visible-p other))) (setq deletable t)) -- 2.43.7