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: Eli Zaretskii
Subject: Re: Functions in kill-emacs-hook aren't run if emacs gets killed with SIGTERM
Date: Thu, 22 Jan 2009 20:32:43 +0200

> From: "Stefan Monnier" <address@hidden>
> Cc: <address@hidden>,
>       <address@hidden>
> Date: Thu, 22 Jan 2009 09:41:03 -0500
> 
> > 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.

Right, and that's what I meant: SIGTERM usually causes an exit, while
SIGUSR can set a flag and do its thing later.

> > 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.

I'm more worried by the possibility that they run Lisp code when Emacs
is in unstable state.

> Maybe another option is to first perform the autosaves (like
> shut_down_emacs does), and then run a hook.

I'm not sure this is enough.  We may need to defer exiting until it is
safe to call Lisp code.




reply via email to

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