emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: usr1-signal, usr2-signal, etc.


From: Kim F. Storm
Subject: Re: usr1-signal, usr2-signal, etc.
Date: Mon, 04 Dec 2006 14:08:09 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

>>     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 <address@hidden> http://www.cua.dk





reply via email to

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