unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Gregory Heytings <gregory@heytings.org>
Cc: 51377@debbugs.gnu.org
Subject: bug#51377: Automatically exit server when it has no remaining clients
Date: Sun, 24 Oct 2021 11:08:57 -0700	[thread overview]
Message-ID: <7f3dde25-f81b-d7db-efc5-f8d471fd06bc@gmail.com> (raw)
In-Reply-To: <90ba36dcccc2abc8dec1@heytings.org>

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	other threads:[~2021-10-24 18:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-24 15:15 bug#51377: Automatically exit server when it has no remaining clients Gregory Heytings
2021-10-24 16:03 ` Jim Porter
2021-10-24 16:14   ` Jim Porter
2021-10-24 16:32   ` Gregory Heytings
2021-10-24 18:08     ` Jim Porter [this message]
2021-10-24 18:43       ` Gregory Heytings
2021-10-24 19:39         ` Jim Porter
2021-10-24 20:42           ` Gregory Heytings
2021-10-24 21:19             ` Jim Porter
2021-10-24 21:37               ` Gregory Heytings
2021-10-25 18:21                 ` Jim Porter
2021-10-26 10:37                   ` Gregory Heytings
2021-10-26 11:59                     ` Gregory Heytings
2021-10-26 15:07                       ` Gregory Heytings
2021-11-11  5:43                         ` Lars Ingebrigtsen
2021-10-24 21:40           ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f3dde25-f81b-d7db-efc5-f8d471fd06bc@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=51377@debbugs.gnu.org \
    --cc=gregory@heytings.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).