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: Wed, 04 Feb 2009 22:37:02 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> Actually it requires only three lines to get something that seems to
> work quite nicely, at least for demonstration purposes.

> Replace one line in emacs.c:~1315:

> -  signal (SIGTERM, fatal_error_signal);
> +  add_user_signal (SIGTERM, "sigterm");

> and add some lisp to catch the signal (can be put into .emacs, to begin with)

> (define-key special-event-map [sigterm] 'sigterm-handler)
> (defun sigterm-handler () (interactive) (kill-emacs))

> Where kill-emacs will also run the kill-emacs-hooks in a safe way, as 
> intended.

Yes, I think this is the right way to do it.  The only change I'd like
to do is to do the autosaves as before in the signal handler before
passing on the signal through the normal input handling (i.e. before
running kill-emacs-hook).


        Stefan




reply via email to

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