diff options
| author | Jim Blandy | 1993-05-10 00:15:02 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-05-10 00:15:02 +0000 |
| commit | b61982dd6ef7f636ea3670cb44c08fbbca6bc1ad (patch) | |
| tree | efd45425e6f90d3a476b2cf0954628eeb570dab5 /src/buffer.c | |
| parent | 40a4095a69a5b10047d17fdb0af77123fdcde10f (diff) | |
| download | emacs-b61982dd6ef7f636ea3670cb44c08fbbca6bc1ad.tar.gz emacs-b61982dd6ef7f636ea3670cb44c08fbbca6bc1ad.zip | |
Arrange to tell redisplay about changes in overlays.
* xdisp.c (redisplay_region): New function.
* buffer.c (Fmove_overlay): Call redisplay_region on the areas the
overlay has enclosed or left.
(Fdelete_overlay): Call redisplay_region on the area the overlay
used to occupy.
(Foverlay_put): Call redisplay_region on the area the overlay now
occupies; we may have put a face property on it.
* buffer.c (Fmove_overlay): Doc fix.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index d21acd7f278..3c7a4db577f 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1476,12 +1476,15 @@ BEG and END may be integers or markers.") | |||
| 1476 | /* This puts it in the right list, and in the right order. */ | 1476 | /* This puts it in the right list, and in the right order. */ |
| 1477 | recenter_overlay_lists (b, XINT (b->overlay_center)); | 1477 | recenter_overlay_lists (b, XINT (b->overlay_center)); |
| 1478 | 1478 | ||
| 1479 | /* We don't need to redisplay the region covered by the overlay, because | ||
| 1480 | the overlay has no properties at the moment. */ | ||
| 1481 | |||
| 1479 | return overlay; | 1482 | return overlay; |
| 1480 | } | 1483 | } |
| 1481 | 1484 | ||
| 1482 | DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0, | 1485 | DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0, |
| 1483 | "Set the endpoints of OVERLAY to BEG and END in BUFFER.\n\ | 1486 | "Set the endpoints of OVERLAY to BEG and END in BUFFER.\n\ |
| 1484 | If omitted, don't change OVERLAY's buffer.") | 1487 | If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.") |
| 1485 | (overlay, beg, end, buffer) | 1488 | (overlay, beg, end, buffer) |
| 1486 | Lisp_Object overlay, beg, end, buffer; | 1489 | Lisp_Object overlay, beg, end, buffer; |
| 1487 | { | 1490 | { |
| @@ -1494,8 +1497,38 @@ If omitted, don't change OVERLAY's buffer.") | |||
| 1494 | buffer = Fmarker_buffer (OVERLAY_START (overlay)); | 1497 | buffer = Fmarker_buffer (OVERLAY_START (overlay)); |
| 1495 | CHECK_BUFFER (buffer, 3); | 1498 | CHECK_BUFFER (buffer, 3); |
| 1496 | 1499 | ||
| 1500 | CHECK_NUMBER_COERCE_MARKER (beg, 1); | ||
| 1501 | CHECK_NUMBER_COERCE_MARKER (end, 1); | ||
| 1502 | |||
| 1503 | if (XINT (beg) > XINT (end)) | ||
| 1504 | { | ||
| 1505 | Lisp_Object temp = beg; | ||
| 1506 | beg = end; end = temp; | ||
| 1507 | } | ||
| 1508 | |||
| 1497 | b = XBUFFER (buffer); | 1509 | b = XBUFFER (buffer); |
| 1498 | 1510 | ||
| 1511 | /* Redisplay the area the overlay has just left, or just enclosed. */ | ||
| 1512 | { | ||
| 1513 | Lisp_Object o_beg = OVERLAY_START (overlay); | ||
| 1514 | Lisp_Object o_end = OVERLAY_END (overlay); | ||
| 1515 | int change_beg, change_end; | ||
| 1516 | |||
| 1517 | o_beg = OVERLAY_POSITION (o_beg); | ||
| 1518 | o_end = OVERLAY_POSITION (o_end); | ||
| 1519 | |||
| 1520 | if (XINT (o_beg) == XINT (beg)) | ||
| 1521 | redisplay_region (b, XINT (o_end), XINT (end)); | ||
| 1522 | else if (XINT (o_end) == XINT (end)) | ||
| 1523 | redisplay_region (b, XINT (o_beg), XINT (beg)); | ||
| 1524 | else | ||
| 1525 | { | ||
| 1526 | if (XINT (beg) < XINT (o_beg)) o_beg = beg; | ||
| 1527 | if (XINT (end) > XINT (o_end)) o_end = end; | ||
| 1528 | redisplay_region (b, XINT (o_beg), XINT (o_end)); | ||
| 1529 | } | ||
| 1530 | } | ||
| 1531 | |||
| 1499 | b->overlays_before = Fdelq (overlay, b->overlays_before); | 1532 | b->overlays_before = Fdelq (overlay, b->overlays_before); |
| 1500 | b->overlays_after = Fdelq (overlay, b->overlays_after); | 1533 | b->overlays_after = Fdelq (overlay, b->overlays_after); |
| 1501 | 1534 | ||
| @@ -1531,6 +1564,10 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, | |||
| 1531 | b->overlays_before = Fdelq (overlay, b->overlays_before); | 1564 | b->overlays_before = Fdelq (overlay, b->overlays_before); |
| 1532 | b->overlays_after = Fdelq (overlay, b->overlays_after); | 1565 | b->overlays_after = Fdelq (overlay, b->overlays_after); |
| 1533 | 1566 | ||
| 1567 | redisplay_region (b, | ||
| 1568 | OVERLAY_POSITION (OVERLAY_START (overlay)), | ||
| 1569 | OVERLAY_POSITION (OVERLAY_END (overlay))); | ||
| 1570 | |||
| 1534 | return Qnil; | 1571 | return Qnil; |
| 1535 | } | 1572 | } |
| 1536 | 1573 | ||
| @@ -1656,6 +1693,13 @@ DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0, | |||
| 1656 | { | 1693 | { |
| 1657 | Lisp_Object plist, tail; | 1694 | Lisp_Object plist, tail; |
| 1658 | 1695 | ||
| 1696 | if (!OVERLAY_VALID (overlay)) | ||
| 1697 | error ("Invalid overlay object"); | ||
| 1698 | |||
| 1699 | redisplay_region (XMARKER (OVERLAY_START (overlay))->buffer, | ||
| 1700 | OVERLAY_POSITION (OVERLAY_START (overlay)), | ||
| 1701 | OVERLAY_POSITION (OVERLAY_END (overlay))); | ||
| 1702 | |||
| 1659 | plist = Fcdr_safe (Fcdr_safe (overlay)); | 1703 | plist = Fcdr_safe (Fcdr_safe (overlay)); |
| 1660 | 1704 | ||
| 1661 | for (tail = plist; | 1705 | for (tail = plist; |