comparison src/buffer.c @ 16193:6ff2ef91c618

(modify_overlay): Renamed from redisplay_region moved here from xdisp.c, and made static. Callers changed. Update OVERLAY_MODIFF instead of MODIFF.
author Richard M. Stallman <rms@gnu.org>
date Sun, 15 Sep 1996 01:57:03 +0000
parents 2ca3765fdc00
children 3b8851bebc76
comparison
equal deleted inserted replaced
16192:b67b2e8eacb3 16193:6ff2ef91c618
2581 /* We don't need to redisplay the region covered by the overlay, because 2581 /* We don't need to redisplay the region covered by the overlay, because
2582 the overlay has no properties at the moment. */ 2582 the overlay has no properties at the moment. */
2583 2583
2584 return overlay; 2584 return overlay;
2585 } 2585 }
2586 2586
2587 /* Mark a section of BUF as needing redisplay because of overlays changes. */
2588
2589 static void
2590 modify_overlay (buf, start, end)
2591 struct buffer *buf;
2592 int start, end;
2593 {
2594 if (start == end)
2595 return;
2596
2597 if (start > end)
2598 {
2599 int temp = start;
2600 start = end; end = temp;
2601 }
2602
2603 /* If this is a buffer not in the selected window,
2604 we must do other windows. */
2605 if (buf != XBUFFER (XWINDOW (selected_window)->buffer))
2606 windows_or_buffers_changed = 1;
2607 /* If it's not current, we can't use beg_unchanged, end_unchanged for it. */
2608 else if (buf != current_buffer)
2609 windows_or_buffers_changed = 1;
2610 /* If multiple windows show this buffer, we must do other windows. */
2611 else if (buffer_shared > 1)
2612 windows_or_buffers_changed = 1;
2613 else
2614 {
2615 if (unchanged_modified == MODIFF
2616 && overlay_unchanged_modified == OVERLAY_MODIFF)
2617 {
2618 beg_unchanged = start - BEG;
2619 end_unchanged = Z - end;
2620 }
2621 else
2622 {
2623 if (Z - end < end_unchanged)
2624 end_unchanged = Z - end;
2625 if (start - BEG < beg_unchanged)
2626 beg_unchanged = start - BEG;
2627 }
2628 }
2629
2630 ++OVERLAY_MODIFF;
2631 }
2632
2633
2587 DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0, 2634 DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0,
2588 "Set the endpoints of OVERLAY to BEG and END in BUFFER.\n\ 2635 "Set the endpoints of OVERLAY to BEG and END in BUFFER.\n\
2589 If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.\n\ 2636 If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.\n\
2590 If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current\n\ 2637 If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current\n\
2591 buffer.") 2638 buffer.")
2640 o_beg = OVERLAY_START (overlay); 2687 o_beg = OVERLAY_START (overlay);
2641 o_end = OVERLAY_END (overlay); 2688 o_end = OVERLAY_END (overlay);
2642 o_beg = OVERLAY_POSITION (o_beg); 2689 o_beg = OVERLAY_POSITION (o_beg);
2643 o_end = OVERLAY_POSITION (o_end); 2690 o_end = OVERLAY_POSITION (o_end);
2644 2691
2645 redisplay_region (ob, XINT (o_beg), XINT (o_end)); 2692 modify_overlay (ob, XINT (o_beg), XINT (o_end));
2646 } 2693 }
2647 2694
2648 /* Redisplay where the overlay is going to be. */ 2695 /* Redisplay where the overlay is going to be. */
2649 redisplay_region (b, XINT (beg), XINT (end)); 2696 modify_overlay (b, XINT (beg), XINT (end));
2650 } 2697 }
2651 else 2698 else
2652 /* Redisplay the area the overlay has just left, or just enclosed. */ 2699 /* Redisplay the area the overlay has just left, or just enclosed. */
2653 { 2700 {
2654 Lisp_Object o_beg; 2701 Lisp_Object o_beg;
2659 o_end = OVERLAY_END (overlay); 2706 o_end = OVERLAY_END (overlay);
2660 o_beg = OVERLAY_POSITION (o_beg); 2707 o_beg = OVERLAY_POSITION (o_beg);
2661 o_end = OVERLAY_POSITION (o_end); 2708 o_end = OVERLAY_POSITION (o_end);
2662 2709
2663 if (XINT (o_beg) == XINT (beg)) 2710 if (XINT (o_beg) == XINT (beg))
2664 redisplay_region (b, XINT (o_end), XINT (end)); 2711 modify_overlay (b, XINT (o_end), XINT (end));
2665 else if (XINT (o_end) == XINT (end)) 2712 else if (XINT (o_end) == XINT (end))
2666 redisplay_region (b, XINT (o_beg), XINT (beg)); 2713 modify_overlay (b, XINT (o_beg), XINT (beg));
2667 else 2714 else
2668 { 2715 {
2669 if (XINT (beg) < XINT (o_beg)) o_beg = beg; 2716 if (XINT (beg) < XINT (o_beg)) o_beg = beg;
2670 if (XINT (end) > XINT (o_end)) o_end = end; 2717 if (XINT (end) > XINT (o_end)) o_end = end;
2671 redisplay_region (b, XINT (o_beg), XINT (o_end)); 2718 modify_overlay (b, XINT (o_beg), XINT (o_end));
2672 } 2719 }
2673 } 2720 }
2674 2721
2675 if (!NILP (obuffer)) 2722 if (!NILP (obuffer))
2676 { 2723 {
2714 specbind (Qinhibit_quit, Qt); 2761 specbind (Qinhibit_quit, Qt);
2715 2762
2716 b->overlays_before = Fdelq (overlay, b->overlays_before); 2763 b->overlays_before = Fdelq (overlay, b->overlays_before);
2717 b->overlays_after = Fdelq (overlay, b->overlays_after); 2764 b->overlays_after = Fdelq (overlay, b->overlays_after);
2718 2765
2719 redisplay_region (b, 2766 modify_overlay (b,
2720 marker_position (OVERLAY_START (overlay)), 2767 marker_position (OVERLAY_START (overlay)),
2721 marker_position (OVERLAY_END (overlay))); 2768 marker_position (OVERLAY_END (overlay)));
2722 2769
2723 Fset_marker (OVERLAY_START (overlay), Qnil, Qnil); 2770 Fset_marker (OVERLAY_START (overlay), Qnil, Qnil);
2724 Fset_marker (OVERLAY_END (overlay), Qnil, Qnil); 2771 Fset_marker (OVERLAY_END (overlay), Qnil, Qnil);
3023 = Fcons (prop, Fcons (value, XOVERLAY (overlay)->plist)); 3070 = Fcons (prop, Fcons (value, XOVERLAY (overlay)->plist));
3024 found: 3071 found:
3025 if (! NILP (buffer)) 3072 if (! NILP (buffer))
3026 { 3073 {
3027 if (changed) 3074 if (changed)
3028 redisplay_region (XBUFFER (buffer), 3075 modify_overlay (XBUFFER (buffer),
3029 marker_position (OVERLAY_START (overlay)), 3076 marker_position (OVERLAY_START (overlay)),
3030 marker_position (OVERLAY_END (overlay))); 3077 marker_position (OVERLAY_END (overlay)));
3031 if (EQ (prop, Qevaporate) && ! NILP (value) 3078 if (EQ (prop, Qevaporate) && ! NILP (value)
3032 && (OVERLAY_POSITION (OVERLAY_START (overlay)) 3079 && (OVERLAY_POSITION (OVERLAY_START (overlay))
3033 == OVERLAY_POSITION (OVERLAY_END (overlay)))) 3080 == OVERLAY_POSITION (OVERLAY_END (overlay))))