comparison src/process.c @ 161:28f395d8dc7a r20-3b7

Import from CVS: tag r20-3b7
author cvs
date Mon, 13 Aug 2007 09:42:26 +0200
parents 3bb7ccffb0c0
children 85ec50267440
comparison
equal deleted inserted replaced
160:1c55655d6702 161:28f395d8dc7a
1769 1769
1770 MARK_MODELINE_CHANGED; 1770 MARK_MODELINE_CHANGED;
1771 1771
1772 /* If the restriction isn't what it should be, set it. */ 1772 /* If the restriction isn't what it should be, set it. */
1773 if (old_begv != BUF_BEGV (buf) || old_zv != BUF_ZV (buf)) 1773 if (old_begv != BUF_BEGV (buf) || old_zv != BUF_ZV (buf))
1774 Fnarrow_to_region (make_int (old_begv), make_int (old_zv), 1774 {
1775 p->buffer); 1775 Fwiden(p->buffer);
1776 old_begv = bufpos_clip_to_bounds (BUF_BEG (buf),
1777 old_begv,
1778 BUF_Z (buf));
1779 old_zv = bufpos_clip_to_bounds (BUF_BEG (buf),
1780 old_zv,
1781 BUF_Z (buf));
1782 Fnarrow_to_region (make_int (old_begv), make_int (old_zv),
1783 p->buffer);
1784 }
1776 1785
1777 /* Handling the process output should not deactivate the mark. */ 1786 /* Handling the process output should not deactivate the mark. */
1778 zmacs_region_stays = old_zmacs_region_stays; 1787 zmacs_region_stays = old_zmacs_region_stays;
1779 buf->read_only = old_read_only; 1788 buf->read_only = old_read_only;
1789 old_point = bufpos_clip_to_bounds (BUF_BEGV (buf),
1790 old_point,
1791 BUF_ZV (buf));
1780 BUF_SET_PT (buf, old_point); 1792 BUF_SET_PT (buf, old_point);
1781 1793
1782 UNGCPRO; 1794 UNGCPRO;
1783 } 1795 }
1784 #ifdef VMS 1796 #ifdef VMS
2598 exec_sentinel (proc, msg); 2610 exec_sentinel (proc, msg);
2599 /* Don't bother with a message in the buffer 2611 /* Don't bother with a message in the buffer
2600 when a process becomes runnable. */ 2612 when a process becomes runnable. */
2601 else if (!EQ (symbol, Qrun) && !NILP (p->buffer)) 2613 else if (!EQ (symbol, Qrun) && !NILP (p->buffer))
2602 { 2614 {
2603 int speccount = specpdl_depth (); 2615 Lisp_Object old_read_only = Qnil;
2616 Lisp_Object old = Fcurrent_buffer ();
2617 Bufpos opoint;
2618 struct gcpro ngcpro1, ngcpro2;
2604 2619
2605 /* Avoid error if buffer is deleted 2620 /* Avoid error if buffer is deleted
2606 (probably that's why the process is dead, too) */ 2621 (probably that's why the process is dead, too) */
2607 if (!BUFFER_LIVE_P (XBUFFER (p->buffer))) 2622 if (!BUFFER_LIVE_P (XBUFFER (p->buffer)))
2608 continue; 2623 continue;
2609 2624
2610 record_unwind_protect (save_excursion_restore, 2625 NGCPRO2 (old, old_read_only);
2611 save_excursion_save ());
2612 Fset_buffer (p->buffer); 2626 Fset_buffer (p->buffer);
2613 record_unwind_protect (save_excursion_restore, 2627 opoint = BUF_PT (current_buffer);
2614 save_excursion_save ());
2615 specbind(Qbuffer_read_only, Qnil);
2616 /* Insert new output into buffer 2628 /* Insert new output into buffer
2617 at the current end-of-output marker, 2629 at the current end-of-output marker,
2618 thus preserving logical ordering of input and output. */ 2630 thus preserving logical ordering of input and output. */
2619 if (XMARKER (p->mark)->buffer) 2631 if (XMARKER (p->mark)->buffer)
2620 BUF_SET_PT (current_buffer, marker_position (p->mark)); 2632 BUF_SET_PT (current_buffer, marker_position (p->mark));
2621 else 2633 else
2622 BUF_SET_PT (current_buffer, BUF_ZV (current_buffer)); 2634 BUF_SET_PT (current_buffer, BUF_ZV (current_buffer));
2635 if (BUF_PT (current_buffer) <= opoint)
2636 opoint += (string_char_length (XSTRING (msg))
2637 + string_char_length (XSTRING (p->name))
2638 + 10);
2639
2640 old_read_only = current_buffer->read_only;
2641 current_buffer->read_only = Qnil;
2623 buffer_insert_c_string (current_buffer, "\nProcess "); 2642 buffer_insert_c_string (current_buffer, "\nProcess ");
2624 Finsert (1, &p->name); 2643 Finsert (1, &p->name);
2625 buffer_insert_c_string (current_buffer, " "); 2644 buffer_insert_c_string (current_buffer, " ");
2626 Finsert (1, &msg); 2645 Finsert (1, &msg);
2646 current_buffer->read_only = old_read_only;
2627 Fset_marker (p->mark, make_int (BUF_PT (current_buffer)), 2647 Fset_marker (p->mark, make_int (BUF_PT (current_buffer)),
2628 p->buffer); 2648 p->buffer);
2629 unbind_to(speccount, Qnil); 2649
2650 opoint = bufpos_clip_to_bounds(BUF_BEGV (XBUFFER (p->buffer)),
2651 opoint,
2652 BUF_ZV (XBUFFER (p->buffer)));
2653 BUF_SET_PT (current_buffer, opoint);
2654 Fset_buffer (old);
2655 NUNGCPRO;
2630 } 2656 }
2631 } 2657 }
2632 } /* end for */ 2658 } /* end for */
2633 2659
2634 /* in case buffers use %s in modeline-format */ 2660 /* in case buffers use %s in modeline-format */