On Sun, Oct 24, 2021 at 8:18 AM Gregory Heytings <gregory@heytings.org> wrote:

>
> Even better (because it also works with emacsclient -n):
>
> (when (daemonp) (run-with-timer 2 2 (lambda () (when (<= (length (frame-list)) 1) (save-buffers-kill-emacs)))))
>

Slightly improved and submitted in bug#51377.

Apologies for the thread necromancy; I was away for a long while. While catching up, I wondered if there was an appropriate hook to use, rather than a timer. I think that delete-frame-functions may DTRT, but it depends a bit on the use case.

Hope that helps,
~Chad