From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel 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 Message-ID: References: <87prihxeu5.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1232636507 31807 80.91.229.12 (22 Jan 2009 15:01:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 Jan 2009 15:01:47 +0000 (UTC) Cc: tassilo@member.fsf.org, emacs-devel@gnu.org To: "Eli Zaretskii" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 22 16:02:59 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LQ14z-0000Dq-HU for ged-emacs-devel@m.gmane.org; Thu, 22 Jan 2009 16:02:49 +0100 Original-Received: from localhost ([127.0.0.1]:55150 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQ13i-0000xe-Ew for ged-emacs-devel@m.gmane.org; Thu, 22 Jan 2009 10:01:30 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LQ0od-0007mO-PF for emacs-devel@gnu.org; Thu, 22 Jan 2009 09:45:55 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LQ0oc-0007ku-JG for emacs-devel@gnu.org; Thu, 22 Jan 2009 09:45:54 -0500 Original-Received: from [199.232.76.173] (port=56803 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQ0oc-0007kc-5U for emacs-devel@gnu.org; Thu, 22 Jan 2009 09:45:54 -0500 Original-Received: from mail.g-wis.com ([204.250.154.18]:3703) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LQ0ob-0003p9-FE for emacs-devel@gnu.org; Thu, 22 Jan 2009 09:45:53 -0500 thread-index: Acl8n3ckq8oMyLK6TGyyYwbBtvgmfA== X-Received-From-Address: 69.38.23.210 X-Envelope-From: monnier@iro.umontreal.ca X-Envelope-To: eliz@gnu.org, emacs-devel@gnu.org, tassilo@member.fsf.org, monnier@iro.umontreal.ca Original-Received: from ceviche.home ([69.38.23.210]) by mail.g-wis.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 22 Jan 2009 06:41:08 -0800 Original-Received: by ceviche.home (Postfix, from userid 20848) id 3892CB400C; Thu, 22 Jan 2009 09:41:03 -0500 (EST) Content-Class: urn:content-classes:message Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325 In-Reply-To: (Eli Zaretskii's message of "Thu, 22 Jan2009 06:09:39 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-OriginalArrivalTime: 22 Jan 2009 14:41:09.0027 (UTC) FILETIME=[76B94F30:01C97C9F] X-detected-operating-system: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:108091 Archived-At: > 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