Mercurial > hg > xemacs-beta
comparison src/event-stream.c @ 5881:31dd275fa683
Preserv the current buffer on non-local exit, #'accept-process-output.
2015-03-31 Aidan Kehoe <kehoea@parhasard.net>
* event-stream.c (Faccept_process_output):
Restore the current buffer even on non-local exit in this
function, none of the code that uses #'accept-process-output is
actually prepared to handle the current buffer changing.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 31 Mar 2015 18:42:21 +0100 |
parents | c87b776ab0e1 |
children |
comparison
equal
deleted
inserted
replaced
5880:44ba043ceada | 5881:31dd275fa683 |
---|---|
2615 Lisp_Object event = Qnil; | 2615 Lisp_Object event = Qnil; |
2616 Lisp_Object result = Qnil; | 2616 Lisp_Object result = Qnil; |
2617 int timeout_id = -1; | 2617 int timeout_id = -1; |
2618 int timeout_enabled = 0; | 2618 int timeout_enabled = 0; |
2619 int done = 0; | 2619 int done = 0; |
2620 struct buffer *old_buffer = current_buffer; | |
2621 int count; | 2620 int count; |
2622 | 2621 |
2623 /* We preserve the current buffer but nothing else. If a focus | 2622 /* We preserve the current buffer but nothing else. If a focus |
2624 change alters the selected window then the top level event loop | 2623 change alters the selected window then the top level event loop |
2625 will eventually alter current_buffer to match. In the mean time | 2624 will eventually alter current_buffer to match. In the mean time |
2652 | 2651 |
2653 count = specpdl_depth (); | 2652 count = specpdl_depth (); |
2654 record_unwind_protect (sit_for_unwind, | 2653 record_unwind_protect (sit_for_unwind, |
2655 timeout_enabled ? make_fixnum (timeout_id) : Qnil); | 2654 timeout_enabled ? make_fixnum (timeout_id) : Qnil); |
2656 recursive_sit_for = 1; | 2655 recursive_sit_for = 1; |
2656 record_unwind_protect (Fset_buffer, wrap_buffer (current_buffer)); | |
2657 | 2657 |
2658 while (!done && | 2658 while (!done && |
2659 ((NILP (process) && timeout_enabled) || | 2659 ((NILP (process) && timeout_enabled) || |
2660 (NILP (process) && event_stream_event_pending_p (0)) || | 2660 (NILP (process) && event_stream_event_pending_p (0)) || |
2661 (!NILP (process)))) | 2661 (!NILP (process)))) |
2721 Fdeallocate_event (event); | 2721 Fdeallocate_event (event); |
2722 | 2722 |
2723 status_notify (); | 2723 status_notify (); |
2724 | 2724 |
2725 UNGCPRO; | 2725 UNGCPRO; |
2726 current_buffer = old_buffer; | 2726 |
2727 return result; | 2727 return result; |
2728 } | 2728 } |
2729 | 2729 |
2730 DEFUN ("sleep-for", Fsleep_for, 1, 1, 0, /* | 2730 DEFUN ("sleep-for", Fsleep_for, 1, 1, 0, /* |
2731 Pause, without updating display, for SECONDS seconds. | 2731 Pause, without updating display, for SECONDS seconds. |