* process.c (exec_sentinel): Preserve current-buffer.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 11 Apr 2010 16:15:09 +0000 (12:15 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 11 Apr 2010 16:15:09 +0000 (12:15 -0400)
src/ChangeLog
src/process.c

index 6f0e2a7..92a0550 100644 (file)
@@ -1,5 +1,7 @@
 2010-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * process.c (exec_sentinel): Preserve current-buffer.
+
        * process.c (read_process_output): Move the save-current-buffer to
        apply to both the filter and the non-filter branches.
 
index 69cd0d9..4a1f31f 100644 (file)
@@ -6840,6 +6840,11 @@ exec_sentinel (proc, reason)
   XSETBUFFER (obuffer, current_buffer);
   okeymap = current_buffer->keymap;
 
+  /* There's no good reason to let sentinels change the current
+     buffer, and many callers of accept-process-output, sit-for, and
+     friends don't expect current-buffer to be changed from under them.  */
+  record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+
   sentinel = p->sentinel;
   if (NILP (sentinel))
     return;