comparison src/process.c @ 103134:9569175bb813

(read_process_output): Make sure the current buffer is always restored.
author Andreas Schwab <schwab@linux-m68k.org>
date Sat, 02 May 2009 11:54:43 +0000
parents e61fae00d13e
children 3fb472c8bc3c
comparison
equal deleted inserted replaced
103133:2f7395806731 103134:9569175bb813
5183 register int channel; 5183 register int channel;
5184 { 5184 {
5185 register int nbytes; 5185 register int nbytes;
5186 char *chars; 5186 char *chars;
5187 register Lisp_Object outstream; 5187 register Lisp_Object outstream;
5188 register struct buffer *old = current_buffer;
5189 register struct Lisp_Process *p = XPROCESS (proc); 5188 register struct Lisp_Process *p = XPROCESS (proc);
5190 register int opoint; 5189 register int opoint;
5191 struct coding_system *coding = proc_decode_coding_system[channel]; 5190 struct coding_system *coding = proc_decode_coding_system[channel];
5192 int carryover = p->decoding_carryover; 5191 int carryover = p->decoding_carryover;
5193 int readmax = 4096; 5192 int readmax = 4096;
5383 Lisp_Object odeactivate; 5382 Lisp_Object odeactivate;
5384 int before, before_byte; 5383 int before, before_byte;
5385 int opoint_byte; 5384 int opoint_byte;
5386 Lisp_Object text; 5385 Lisp_Object text;
5387 struct buffer *b; 5386 struct buffer *b;
5387 int count = SPECPDL_INDEX ();
5388 5388
5389 odeactivate = Vdeactivate_mark; 5389 odeactivate = Vdeactivate_mark;
5390 5390
5391 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
5391 Fset_buffer (p->buffer); 5392 Fset_buffer (p->buffer);
5392 opoint = PT; 5393 opoint = PT;
5393 opoint_byte = PT_BYTE; 5394 opoint_byte = PT_BYTE;
5394 old_read_only = current_buffer->read_only; 5395 old_read_only = current_buffer->read_only;
5395 old_begv = BEGV; 5396 old_begv = BEGV;
5488 /* Handling the process output should not deactivate the mark. */ 5489 /* Handling the process output should not deactivate the mark. */
5489 Vdeactivate_mark = odeactivate; 5490 Vdeactivate_mark = odeactivate;
5490 5491
5491 current_buffer->read_only = old_read_only; 5492 current_buffer->read_only = old_read_only;
5492 SET_PT_BOTH (opoint, opoint_byte); 5493 SET_PT_BOTH (opoint, opoint_byte);
5493 set_buffer_internal (old); 5494 unbind_to (count, Qnil);
5494 } 5495 }
5495 return nbytes; 5496 return nbytes;
5496 } 5497 }
5497 5498
5498 DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p, 5499 DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, Swaiting_for_user_input_p,