emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100297: Move call to Fkill_emacs


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100297: Move call to Fkill_emacs from signal handler (session event) (Bug#7552).
Date: Fri, 10 Dec 2010 19:23:43 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100297
committer: Jan D. <address@hidden>
branch nick: emacs-23
timestamp: Fri 2010-12-10 19:23:43 +0100
message:
  Move call to Fkill_emacs from signal handler (session event) (Bug#7552).
  
  * keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT
  as (Qsave_session arg).
  
  * xsmfns.c (smc_interact_CB): Set arg to Qnil.
  (smc_die_CB): Make an event with arg Qt.
  (Fhandle_save_session): If event has Qt as argument,
  call Fkill_emacs.
modified:
  src/ChangeLog
  src/keyboard.c
  src/xsmfns.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-12-07 06:36:25 +0000
+++ b/src/ChangeLog     2010-12-10 18:23:43 +0000
@@ -1,3 +1,13 @@
+2010-12-10  Jan Djärv  <address@hidden>
+
+       * keyboard.c (kbd_buffer_get_event): Construct SAVE_SESSION_EVENT
+       as (Qsave_session arg).
+
+       * xsmfns.c (smc_interact_CB): Set arg to Qnil.
+       (smc_die_CB): Make an event with arg Qt.
+       (Fhandle_save_session): If event has Qt as argument,
+       call Fkill_emacs (Bug#7552).
+
 2010-12-07  Jan Djärv  <address@hidden>
 
        * xsmfns.c (smc_die_CB): Call Fkill_emacs (Bug#7552).

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2010-11-09 18:36:21 +0000
+++ b/src/keyboard.c    2010-12-10 18:23:43 +0000
@@ -4305,7 +4305,7 @@
 #endif
       else if (event->kind == SAVE_SESSION_EVENT)
         {
-          obj = Fcons (Qsave_session, Qnil);
+          obj = Fcons (Qsave_session, Fcons (event->arg, Qnil));
          kbd_fetch_ptr = event + 1;
         }
       /* Just discard these, by returning nil.

=== modified file 'src/xsmfns.c'
--- a/src/xsmfns.c      2010-12-07 06:36:25 +0000
+++ b/src/xsmfns.c      2010-12-10 18:23:43 +0000
@@ -172,6 +172,7 @@
 {
   doing_interact = True;
   emacs_event.kind = SAVE_SESSION_EVENT;
+  emacs_event.arg = Qnil;
 }
 
 /* This is called when the session manager tells us to save ourselves.
@@ -298,12 +299,8 @@
      SmcConn smcConn;
      SmPointer clientData;
 {
-  /* This may behave badly if desktop.el tries to ask questions.  */
-  Fkill_emacs (Qnil);
-
-  /* This will not be reached, but we want kill-emacs-hook to be run.  */
-  SmcCloseConnection (smcConn, 0, 0);
-  ice_connection_closed ();
+  emacs_event.kind = SAVE_SESSION_EVENT;
+  emacs_event.arg = Qt;
 }
 
 /* We don't use the next two but they are mandatory, leave them empty.
@@ -540,9 +537,12 @@
      (event)
      Lisp_Object event;
 {
+  int kill_emacs = CONSP (event) && CONSP (XCDR (event))
+    && EQ (Qt, XCAR (XCDR (event)));
+
   /* Check doing_interact so that we don't do anything if someone called
      this at the wrong time. */
-  if (doing_interact)
+  if (doing_interact && ! kill_emacs)
     {
       Bool cancel_shutdown = False;
 
@@ -553,9 +553,20 @@
 
       doing_interact = False;
     }
+  else if (kill_emacs)
+    {
+      /* We should not do user interaction here, but it is not easy to
+         prevent.  Fix this in next version.  */
+      Fkill_emacs (Qnil);
 
+      /* This will not be reached, but we want kill-emacs-hook to be run.  */
+      SmcCloseConnection (smc_conn, 0, 0);
+      ice_connection_closed ();
+    }
+  
   return Qnil;
 }
+  
 
 
 /***********************************************************************


reply via email to

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