comparison src/buffer.c @ 2791:4f234fbfb02c

* buffer.c (Fmove_overlay): If the overlay is in no buffer and the BUFFER argument has been omitted, put it in the current buffer, for symmetry with move-marker. * buffer.c (Fdelete_overlay): Make the overlay's markers point nowhere, not at 1. Do this after calling redisplay_region, so that code knows what section has changed.
author Jim Blandy <jimb@redhat.com>
date Fri, 14 May 1993 22:57:10 +0000
parents 995c6e665599
children 8c43cc245dd2
comparison
equal deleted inserted replaced
2790:cf431814ce6a 2791:4f234fbfb02c
1504 return overlay; 1504 return overlay;
1505 } 1505 }
1506 1506
1507 DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0, 1507 DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0,
1508 "Set the endpoints of OVERLAY to BEG and END in BUFFER.\n\ 1508 "Set the endpoints of OVERLAY to BEG and END in BUFFER.\n\
1509 If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.") 1509 If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.\n\
1510 If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current\n\
1511 buffer.")
1510 (overlay, beg, end, buffer) 1512 (overlay, beg, end, buffer)
1511 Lisp_Object overlay, beg, end, buffer; 1513 Lisp_Object overlay, beg, end, buffer;
1512 { 1514 {
1513 struct buffer *b; 1515 struct buffer *b;
1514 1516
1515 CHECK_OVERLAY (overlay, 0); 1517 CHECK_OVERLAY (overlay, 0);
1516 if (NILP (buffer)) 1518 if (NILP (buffer))
1517 buffer = Fmarker_buffer (OVERLAY_START (overlay)); 1519 buffer = Fmarker_buffer (OVERLAY_START (overlay));
1520 if (NILP (buffer))
1521 XSET (buffer, Lisp_Buffer, current_buffer);
1518 CHECK_BUFFER (buffer, 3); 1522 CHECK_BUFFER (buffer, 3);
1519 CHECK_NUMBER_COERCE_MARKER (beg, 1); 1523 CHECK_NUMBER_COERCE_MARKER (beg, 1);
1520 CHECK_NUMBER_COERCE_MARKER (end, 1); 1524 CHECK_NUMBER_COERCE_MARKER (end, 1);
1521 1525
1522 if (XINT (beg) > XINT (end)) 1526 if (XINT (beg) > XINT (end))
1579 b = XBUFFER (Fmarker_buffer (OVERLAY_START (overlay))); 1583 b = XBUFFER (Fmarker_buffer (OVERLAY_START (overlay)));
1580 1584
1581 b->overlays_before = Fdelq (overlay, b->overlays_before); 1585 b->overlays_before = Fdelq (overlay, b->overlays_before);
1582 b->overlays_after = Fdelq (overlay, b->overlays_after); 1586 b->overlays_after = Fdelq (overlay, b->overlays_after);
1583 1587
1584 Fset_marker (OVERLAY_START (overlay), 1, Qnil);
1585 Fset_marker (OVERLAY_END (overlay), 1, Qnil);
1586
1587 redisplay_region (b, 1588 redisplay_region (b,
1588 OVERLAY_POSITION (OVERLAY_START (overlay)), 1589 OVERLAY_POSITION (OVERLAY_START (overlay)),
1589 OVERLAY_POSITION (OVERLAY_END (overlay))); 1590 OVERLAY_POSITION (OVERLAY_END (overlay)));
1591
1592 Fset_marker (OVERLAY_START (overlay), Qnil, Qnil);
1593 Fset_marker (OVERLAY_END (overlay), Qnil, Qnil);
1590 1594
1591 return Qnil; 1595 return Qnil;
1592 } 1596 }
1593 1597
1594 /* Overlay dissection functions. */ 1598 /* Overlay dissection functions. */