emacs-devel
[Top][All Lists]
Advanced

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

Re: Functions in kill-emacs-hook aren't run if emacs gets killed with SI


From: Stefan Monnier
Subject: Re: Functions in kill-emacs-hook aren't run if emacs gets killed with SIGTERM
Date: Thu, 22 Jan 2009 09:41:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> SIGUSRn are different in that they are ``soft'', and are not generally
> expected to interrupt code in dangerous state.

I don't know what you mean by "interrupt code in dangerous state".
AFAIK, the only difference between SIGTERM and SIGUSRn is that SIGTERM
has a clear intention "please exit now", whereas the other ones's
intention is user-specified.

> The fact that SIGTERM in this case is a programmed means to stop Emacs
> does not mean it's the only use case where SIGTERM is delivered
> to Emacs.

Definitely, but in all cases I can think of, running kill-emacs-hook is
a good idea.  This assumes that the functions placed on kill-emacs-hook
follow the recommendation of the docstring:

   Since `kill-emacs' may be invoked when the terminal is disconnected
   (or in other similar situations), functions placed on this hook
   should not expect to be able to interact with the user.

Maybe another option is to first perform the autosaves (like
shut_down_emacs does), and then run a hook.  This way, no matter what
the hook does, no data is lost.


        Stefan




reply via email to

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