Subject: bug#6060: 24.0.50; Process filters can no longer kill buffers

From: Stefan Monnier <[email-masked]>
Date: Thu, 29 Apr 2010 10:31:46 -0400

> Emacs signals this error:  (error "Selecting deleted buffer")
[...]
> This used to work in earlier versions of Emacs.
> The problem was most likely introduced by:
[...]
> 	* 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.

Indeed, thank you.  I believe the patch below has fixed this, can you confirm?

        Stefan

=== modified file 'src/process.c'
--- src/process.c	2010-04-13 02:07:48 +0000
+++ src/process.c	2010-04-29 14:17:52 +0000
@@ -5396,7 +5396,7 @@
   /* There's no good reason to let process filters 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 ());
+  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
 
   /* Read and dispose of the process output.  */
   outstream = p->filter;
@@ -6814,7 +6814,7 @@
   /* 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 ());
+  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
 
   sentinel = p->sentinel;
   if (NILP (sentinel))