comparison src/process.c @ 159:3bb7ccffb0c0 r20-3b6

Import from CVS: tag r20-3b6
author cvs
date Mon, 13 Aug 2007 09:41:43 +0200
parents 43dd3413c7c7
children 28f395d8dc7a
comparison
equal deleted inserted replaced
158:558dfa75ffb3 159:3bb7ccffb0c0
2598 exec_sentinel (proc, msg); 2598 exec_sentinel (proc, msg);
2599 /* Don't bother with a message in the buffer 2599 /* Don't bother with a message in the buffer
2600 when a process becomes runnable. */ 2600 when a process becomes runnable. */
2601 else if (!EQ (symbol, Qrun) && !NILP (p->buffer)) 2601 else if (!EQ (symbol, Qrun) && !NILP (p->buffer))
2602 { 2602 {
2603 Lisp_Object old_read_only = Qnil; 2603 int speccount = specpdl_depth ();
2604 Lisp_Object old = Fcurrent_buffer ();
2605 Bufpos opoint;
2606 struct gcpro ngcpro1, ngcpro2;
2607 2604
2608 /* Avoid error if buffer is deleted 2605 /* Avoid error if buffer is deleted
2609 (probably that's why the process is dead, too) */ 2606 (probably that's why the process is dead, too) */
2610 if (!BUFFER_LIVE_P (XBUFFER (p->buffer))) 2607 if (!BUFFER_LIVE_P (XBUFFER (p->buffer)))
2611 continue; 2608 continue;
2612 2609
2613 NGCPRO2 (old, old_read_only); 2610 record_unwind_protect (save_excursion_restore,
2611 save_excursion_save ());
2614 Fset_buffer (p->buffer); 2612 Fset_buffer (p->buffer);
2615 opoint = BUF_PT (current_buffer); 2613 record_unwind_protect (save_excursion_restore,
2614 save_excursion_save ());
2615 specbind(Qbuffer_read_only, Qnil);
2616 /* Insert new output into buffer 2616 /* Insert new output into buffer
2617 at the current end-of-output marker, 2617 at the current end-of-output marker,
2618 thus preserving logical ordering of input and output. */ 2618 thus preserving logical ordering of input and output. */
2619 if (XMARKER (p->mark)->buffer) 2619 if (XMARKER (p->mark)->buffer)
2620 BUF_SET_PT (current_buffer, marker_position (p->mark)); 2620 BUF_SET_PT (current_buffer, marker_position (p->mark));
2621 else 2621 else
2622 BUF_SET_PT (current_buffer, BUF_ZV (current_buffer)); 2622 BUF_SET_PT (current_buffer, BUF_ZV (current_buffer));
2623 if (BUF_PT (current_buffer) <= opoint)
2624 opoint += (string_char_length (XSTRING (msg))
2625 + string_char_length (XSTRING (p->name))
2626 + 10);
2627
2628 old_read_only = current_buffer->read_only;
2629 current_buffer->read_only = Qnil;
2630 buffer_insert_c_string (current_buffer, "\nProcess "); 2623 buffer_insert_c_string (current_buffer, "\nProcess ");
2631 Finsert (1, &p->name); 2624 Finsert (1, &p->name);
2632 buffer_insert_c_string (current_buffer, " "); 2625 buffer_insert_c_string (current_buffer, " ");
2633 Finsert (1, &msg); 2626 Finsert (1, &msg);
2634 current_buffer->read_only = old_read_only;
2635 Fset_marker (p->mark, make_int (BUF_PT (current_buffer)), 2627 Fset_marker (p->mark, make_int (BUF_PT (current_buffer)),
2636 p->buffer); 2628 p->buffer);
2637 2629 unbind_to(speccount, Qnil);
2638 BUF_SET_PT (current_buffer, opoint);
2639 Fset_buffer (old);
2640 NUNGCPRO;
2641 } 2630 }
2642 } 2631 }
2643 } /* end for */ 2632 } /* end for */
2644 2633
2645 /* in case buffers use %s in modeline-format */ 2634 /* in case buffers use %s in modeline-format */