If Emacs was started with "--daemon" then (frame-list)
returns 2 frames when only 1 is opened
(frame-list)
(#<frame *Minibuf-1* - Emacs 24.3.50.1 0x11c7270> #<frame F1 0xb94ac8>)
If you start Emacs without daemon flag - no "F1" buffer will be there.
How to reliably determine what frames were opened by a user? Are there any specific properties?
It's a "physically invisible" frame (even though frame-visible-p
says otherwise) associated with initial terminal where the daemon was started. I suspect that a sole reason for its existence is that emacs is not ready to run with no frames at all, and it's hard enough to fix it.
For filtering it out I would use this test:
(string-equal "initial_terminal" (terminal-name <frame>))
;;; => t for the "pseudo-"frame created by emacs -daemon
There might be better tests, but as far as I know this one is reliable enough: terminal-name
returns something like "/dev/tty"
for tty frames and the X11 display name like ":0"
for X11 frames (I can't recall what it returns on other platforms, like in a Windows console window, but I believe it can't be "initial_terminal"
by accident).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With