From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Functions in kill-emacs-hook aren't run if emacs gets killed with SIGTERM Date: Wed, 21 Jan 2009 20:42:58 +0200 Message-ID: References: <87prihxeu5.fsf@thinkpad.tsdh.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1232564118 29168 80.91.229.12 (21 Jan 2009 18:55:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 21 Jan 2009 18:55:18 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tassilo Horn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 21 19:56:30 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 1LPiFY-0004zM-VD for ged-emacs-devel@m.gmane.org; Wed, 21 Jan 2009 19:56:29 +0100 Original-Received: from localhost ([127.0.0.1]:50011 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPiEH-0003Ch-Oo for ged-emacs-devel@m.gmane.org; Wed, 21 Jan 2009 13:55:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LPi2Y-0006Wi-Dw for emacs-devel@gnu.org; Wed, 21 Jan 2009 13:43:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LPi2X-0006W1-GE for emacs-devel@gnu.org; Wed, 21 Jan 2009 13:43:01 -0500 Original-Received: from [199.232.76.173] (port=54913 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPi2X-0006Vy-Bf for emacs-devel@gnu.org; Wed, 21 Jan 2009 13:43:01 -0500 Original-Received: from mtaout6.012.net.il ([84.95.2.16]:56947) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LPi2W-0006nb-Vq for emacs-devel@gnu.org; Wed, 21 Jan 2009 13:43:01 -0500 Original-Received: from conversion-daemon.i-mtaout6.012.net.il by i-mtaout6.012.net.il (HyperSendmail v2007.08) id <0KDU000003QA5Q00@i-mtaout6.012.net.il> for emacs-devel@gnu.org; Wed, 21 Jan 2009 20:43:14 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.126.60.234]) by i-mtaout6.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KDU0066K4000WD0@i-mtaout6.012.net.il>; Wed, 21 Jan 2009 20:43:13 +0200 (IST) In-reply-to: <87prihxeu5.fsf@thinkpad.tsdh.de> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (1203?) 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:108045 Archived-At: > From: Tassilo Horn > Date: Wed, 21 Jan 2009 09:06:58 +0100 > > How does emacs handle SIGTERM? Doesn't it simply run `kill-emacs'? No. Fatal signals, such as SIGTERM, are caught by a signal handler, which runs emacs.c:shut_down_emacs. `kill-emacs' in a nutshell runs `kill-emacs-hook' and then also calls shut_down_emacs. > At least that's what I would expect. I don't think it's a good idea to run Lisp code from within a fatal signal handler. shut_down_emacs saves all unsaved buffers and cleans up the terminal, but doesn't do anything else, because Emacs's internal data structures can be very unstable at this point. > A related question: What does emacs --daemon do when it receives a > SIGTERM and there are unsaved buffers? Sorry, I don't know. Someone else will have to answer this.