From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: usr1-signal, usr2-signal, etc. Date: Mon, 04 Dec 2006 14:08:09 +0100 Message-ID: References: NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1165237877 24727 80.91.229.10 (4 Dec 2006 13:11:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 4 Dec 2006 13:11:17 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 04 14:11:15 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1GrDb8-0003Yw-BD for ged-emacs-devel@m.gmane.org; Mon, 04 Dec 2006 14:11:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GrDb7-0004ja-QX for ged-emacs-devel@m.gmane.org; Mon, 04 Dec 2006 08:11:05 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GrDYb-0001dC-Bq for emacs-devel@gnu.org; Mon, 04 Dec 2006 08:08:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GrDYW-0001Y7-Uw for emacs-devel@gnu.org; Mon, 04 Dec 2006 08:08:28 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GrDYW-0001Xk-Jv for emacs-devel@gnu.org; Mon, 04 Dec 2006 08:08:24 -0500 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GrDYU-0002zZ-PS; Mon, 04 Dec 2006 08:08:23 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepa.post.tele.dk (Postfix) with SMTP id D32C8FAC02B; Mon, 4 Dec 2006 14:08:20 +0100 (CET) Original-To: rms@gnu.org In-Reply-To: (Kim F. Storm's message of "Mon\, 04 Dec 2006 10\:05\:26 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) 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:63266 Archived-At: >> To me, it would be cleaner to define them as [signal usr1], >> [signal usr2], etc. >> I agree. Please change it. > > I'll do that. Done. > Currently we only have usr1 and usr2 signals, but if we add more (the > "etc") later, this would be a cleaner interface for such extensions. For example, we could handle SIGTERM, SIGHUP, and SIGQUIT like this to allow a user to handle those signals in some other way: The only real difference with the existing code is that a) this will run the kill-emacs-hook b) you don't get a "Fatal Error (sig=nn) message I don't see either as a problem! *** bindings.el 04 Dec 2006 11:18:25 +0100 1.174 --- bindings.el 04 Dec 2006 13:59:24 +0100 *************** *** 1066,1071 **** --- 1066,1074 ---- ;; Signal handlers (define-key global-map [signal] (make-sparse-keymap)) + (define-key global-map [signal term] 'kill-emacs) + (define-key global-map [signal quit] 'kill-emacs) + (define-key global-map [signal hup] 'kill-emacs) (define-key global-map [signal t] 'ignore) ;; Don't look for autoload cookies in this file. *** emacs.c 04 Dec 2006 10:56:50 +0100 1.393 --- emacs.c 04 Dec 2006 13:57:45 +0100 *************** *** 1192,1198 **** That makes nohup work. */ if (! noninteractive || signal (SIGHUP, SIG_IGN) != SIG_IGN) ! signal (SIGHUP, fatal_error_signal); sigunblock (sigmask (SIGHUP)); } --- 1192,1198 ---- That makes nohup work. */ if (! noninteractive || signal (SIGHUP, SIG_IGN) != SIG_IGN) ! signal (SIGHUP, handle_user_signal); sigunblock (sigmask (SIGHUP)); } *************** *** 1207,1213 **** /* Don't catch these signals in batch mode if dumping. On some machines, this sets static data that would make signal fail to work right when the dumped Emacs is run. */ ! signal (SIGQUIT, fatal_error_signal); signal (SIGILL, fatal_error_signal); signal (SIGTRAP, fatal_error_signal); #ifdef SIGUSR1 --- 1207,1213 ---- /* Don't catch these signals in batch mode if dumping. On some machines, this sets static data that would make signal fail to work right when the dumped Emacs is run. */ ! signal (SIGQUIT, handle_user_signal); signal (SIGILL, fatal_error_signal); signal (SIGTRAP, fatal_error_signal); #ifdef SIGUSR1 *************** *** 1252,1258 **** #ifdef SIGSYS signal (SIGSYS, fatal_error_signal); #endif ! signal (SIGTERM, fatal_error_signal); #ifdef SIGXCPU signal (SIGXCPU, fatal_error_signal); #endif --- 1252,1258 ---- #ifdef SIGSYS signal (SIGSYS, fatal_error_signal); #endif ! signal (SIGTERM, handle_user_signal); #ifdef SIGXCPU signal (SIGXCPU, fatal_error_signal); #endif *** keyboard.c 04 Dec 2006 13:35:04 +0100 1.882 --- keyboard.c 04 Dec 2006 13:58:08 +0100 *************** *** 5952,5957 **** --- 5952,5965 ---- { case 0: return Qsignal; + case SIGQUIT: + return Qquit; + case SIGHUP: + return intern ("hup"); + #ifdef SIGTERM + case SIGTERM: + return intern ("term"); + #endif #ifdef SIGUSR1 case SIGUSR1: return intern ("usr1"); -- Kim F. Storm http://www.cua.dk