all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#6060: 24.0.50; Process filters can no longer kill buffers
@ 2010-04-28 14:08 Helmut Eller
  2010-04-29 14:31 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Helmut Eller @ 2010-04-28 14:08 UTC (permalink / raw)
  To: 6060

When GNU Emacs 24.0.50.7 (i686-pc-linux-gnu, GTK+ Version 2.12.12) of
2010-04-28 executes code like this:

(defun filter-test ()
  (let* ((proc (start-process 
                "test" nil "/bin/bash" "-c" 
                "for i in 1 2 3 4 ; do echo $i ; sleep 1 ; done"))
         (buffer (generate-new-buffer "test-buffer"))
         (filter (lambda (proc str)
                   (message "filter: %S" str)
                   (kill-buffer buffer))))
    (set-process-filter proc filter)
    (unwind-protect
        (with-current-buffer buffer
          (while (buffer-live-p buffer)
            (accept-process-output proc)))
      (kill-process proc))))

Emacs signals this error:  (error "Selecting deleted buffer")

This used to work in earlier versions of Emacs.
The problem was most likely introduced by:

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.







^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6060: 24.0.50; Process filters can no longer kill buffers
  2010-04-28 14:08 bug#6060: 24.0.50; Process filters can no longer kill buffers Helmut Eller
@ 2010-04-29 14:31 ` Stefan Monnier
  2010-04-29 16:00   ` Helmut Eller
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2010-04-29 14:31 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 6060

> 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))







^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6060: 24.0.50; Process filters can no longer kill buffers
  2010-04-29 14:31 ` Stefan Monnier
@ 2010-04-29 16:00   ` Helmut Eller
  2010-04-29 22:52     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Helmut Eller @ 2010-04-29 16:00 UTC (permalink / raw)
  To: bug-gnu-emacs

* Stefan Monnier [2010-04-29 16:31+0200] writes:

>> 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?

Yes, works. Thanks for the quick fix.

Helmut








^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6060: 24.0.50; Process filters can no longer kill buffers
  2010-04-29 16:00   ` Helmut Eller
@ 2010-04-29 22:52     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-04-29 22:52 UTC (permalink / raw)
  To: Helmut Eller

> Yes, works. Thanks for the quick fix.

Thanks for confirming,


        Stefan






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-29 22:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-28 14:08 bug#6060: 24.0.50; Process filters can no longer kill buffers Helmut Eller
2010-04-29 14:31 ` Stefan Monnier
2010-04-29 16:00   ` Helmut Eller
2010-04-29 22:52     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.