From: storm@cua.dk (Kim F. Storm)
Cc: emacs-devel@gnu.org
Subject: Re: usr1-signal, usr2-signal, etc.
Date: Mon, 04 Dec 2006 14:08:09 +0100 [thread overview]
Message-ID: <m31wnfx0zq.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <m364csvxnt.fsf@kfs-l.imdomain.dk> (Kim F. Storm's message of "Mon\, 04 Dec 2006 10\:05\:26 +0100")
>> 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 <storm@cua.dk> http://www.cua.dk
next prev parent reply other threads:[~2006-12-04 13:08 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-03 1:39 usr1-signal, usr2-signal, etc Kim F. Storm
2006-12-04 5:15 ` Richard Stallman
2006-12-04 9:05 ` Kim F. Storm
2006-12-04 13:08 ` Kim F. Storm [this message]
2006-12-05 1:45 ` Richard Stallman
2006-12-05 3:40 ` YAMAMOTO Mitsuharu
2006-12-05 22:26 ` David Kastrup
2006-12-05 22:51 ` Kim F. Storm
2006-12-08 10:28 ` YAMAMOTO Mitsuharu
2006-12-11 9:41 ` Kim F. Storm
2006-12-11 14:31 ` YAMAMOTO Mitsuharu
2006-12-12 9:47 ` Kim F. Storm
2006-12-12 13:32 ` YAMAMOTO Mitsuharu
2006-12-12 13:54 ` Kim F. Storm
2006-12-13 9:38 ` YAMAMOTO Mitsuharu
2006-12-13 10:26 ` Kim F. Storm
2006-12-14 9:14 ` YAMAMOTO Mitsuharu
2006-12-14 11:23 ` Kim F. Storm
2006-12-18 16:38 ` Chong Yidong
2006-12-19 2:14 ` YAMAMOTO Mitsuharu
2006-12-19 9:48 ` Kim F. Storm
2006-12-19 15:46 ` Kim F. Storm
2006-12-20 13:01 ` Richard Stallman
2006-12-20 15:58 ` Kim F. Storm
2006-12-12 21:46 ` Richard Stallman
2006-12-06 0:46 ` Richard Stallman
2006-12-06 9:44 ` Johan Bockgård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m31wnfx0zq.fsf@kfs-l.imdomain.dk \
--to=storm@cua.dk \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).