bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51377: Automatically exit server when it has no remaining clients


From: Jim Porter
Subject: bug#51377: Automatically exit server when it has no remaining clients
Date: Sun, 24 Oct 2021 11:08:57 -0700

On 10/24/2021 9:32 AM, Gregory Heytings wrote:
I'm not sure I understand the patch; `save-buffers-kill-emacs' prompts the user to save buffers before killing Emacs, but how would that work in a daemon when there are no frames remaining?

There is one (invisible) frame remaining: the daemon frame.  And when there are no other frames (graphical or non-graphical) ones, there's nothing to save, save-buffer-kill-emacs just kills emacs.

I don't think this is true in general. The docstring for `server-save-buffers-kill-terminal' says: "If emacsclient was started with a list of filenames to edit, then only these files will be asked to be saved." As a result, some files with unsaved changes may still exist, so we'd want to prompt about those *before* the last frame is closed.

To see this in action:

  $ emacs -Q --daemon
  $ emacsclient foo.txt
  C-x C-f bar.txt
  ;; Make some edits
  C-x C-c
  ;; Exits immediately without prompting about saving bar.txt

If `save-buffers-kill-emacs' were called after that, the Emacs daemon would be killed, losing the edits to bar.txt.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]