unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Functions in kill-emacs-hook aren't run if emacs gets killed	with	SIGTERM
Date: Tue, 03 Feb 2009 11:43:58 +0100	[thread overview]
Message-ID: <87hc3b6brl.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: <uk588v949.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 02 Feb 2009 23:09:42 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Tassilo Horn <tassilo@member.fsf.org>
>> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,  emacs-devel@gnu.org
>> Date: Mon, 02 Feb 2009 21:52:29 +0100
>> 
>> > Anyway, Dan suggested a better way long ago, so it's IMO pointless to
>> > continue this argument.
>> 
>> Do you have a message-id / url at hand?
>
> No, but it should be in this thread, IIRC.

Ok, I think you mean <200901232033.n0NKXJ3p017121@rodan.ics.uci.edu>
where Dan suggests to shutdown emacs --daemon with:

  emacsclient --eval "(save-buffers-kill-emacs)"

I agree that this is a good way to shutdown emacs, but it won't work in
cases the server doesn't accept a connection anymore.  And it forces
users to add snippets like this to some rc file that is executed on
system shutdown, one snippet for each running daemon process.

I'm not sure how that could be done.  Iterating over the socket files in
/tmp/emacsUID/ may work.  But maybe someone uses TCP connections on the
local system and you'd have to distinguish between local and remote
processes where the latter must not be killed.

I think this can be quite complex whereas a SIGTERM is sent to any local
process by init, anyway.

I'm not strictly against the "SIGTERM should not cause kill-emacs-hook
to be run" argument, but at least the use-case of users forgetting to
kill all emacs processes on system shutdown should be considered with
new (very nice!) features like --daemon and multi-tty.  I currently see
two solutions:

  1) Run kill-emacs-hook after saving all buffers when a SIGTERM was
     received, or

  2) provide a shell script which figures out all emacs daemon processes
     and shuts them down like Dan suggested.

Point 2 has the disadvantage of failing with broken daemons, but
nevertheless that's an error case, so maybe it would be a good idea not
to run kill-emacs-hook here anyway.

Bye,
Tassilo




  reply	other threads:[~2009-02-03 10:43 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-24 20:32 Functions in kill-emacs-hook aren't run if emacs gets killed with SIGTERM Stefan Monnier
2009-02-02 20:23 ` Eli Zaretskii
2009-02-02 20:52   ` Tassilo Horn
2009-02-02 21:09     ` Eli Zaretskii
2009-02-03 10:43       ` Tassilo Horn [this message]
2009-02-05  3:34   ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2009-02-03 17:28 grischka
2009-02-05  3:37 ` Stefan Monnier
2009-02-05 13:31   ` grischka
2009-02-05 19:40     ` Stefan Monnier
2009-01-24 20:39 Stefan Monnier
2009-01-23 19:01 grischka
2009-01-23 22:52 ` Eli Zaretskii
2009-01-24 14:16   ` grischka
2009-01-24 16:14     ` Eli Zaretskii
2009-01-24 17:56       ` grischka
2009-01-24 18:20         ` Eli Zaretskii
2009-01-24 19:11           ` grischka
2009-01-24 20:08             ` Eli Zaretskii
2009-01-24 20:28               ` grischka
2009-01-21  8:06 Tassilo Horn
2009-01-21 18:42 ` Eli Zaretskii
2009-01-21 19:49   ` Tassilo Horn
2009-01-21 20:35     ` Chong Yidong
2009-01-22  9:03       ` Tassilo Horn
2009-01-21 20:36   ` Stefan Monnier
2009-01-22  4:09     ` Eli Zaretskii
2009-01-22  9:00       ` Tassilo Horn
2009-01-22 18:23         ` Eli Zaretskii
2009-01-23  2:15           ` mail
2009-01-23 12:05             ` Eli Zaretskii
2009-01-22 10:08       ` Andreas Schwab
2009-01-22 18:25         ` Eli Zaretskii
2009-01-23  1:52         ` Richard M Stallman
2009-01-22 14:41       ` Stefan Monnier
2009-01-22 18:32         ` Eli Zaretskii
2009-01-22 21:16           ` Stefan Monnier
2009-01-23 15:25             ` Eli Zaretskii
2009-01-23 15:58               ` Tassilo Horn
2009-01-23 19:06                 ` Eli Zaretskii
2009-01-23 19:56                   ` David De La Harpe Golden
2009-01-23 22:39                     ` Eli Zaretskii
2009-01-23 23:00                       ` Tassilo Horn
2009-01-23 23:13                         ` Lennart Borgman
2009-01-24  9:04                           ` Tassilo Horn
2009-01-24  9:59                             ` Eli Zaretskii
2009-01-24 12:34                               ` Miles Bader
2009-01-24 10:00                             ` Eli Zaretskii
2009-01-23 20:33                   ` Dan Nicolaescu
2009-01-23 22:37                     ` Eli Zaretskii
2009-01-24  4:40               ` Jason Rumney
2009-01-24  6:11                 ` Miles Bader
2009-01-23  1:52         ` Richard M Stallman

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=87hc3b6brl.fsf@thinkpad.tsdh.de \
    --to=tassilo@member.fsf.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).