diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/buffer.c b/src/buffer.c index 4c3d2496e52..8a611fc7409 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1551,7 +1551,9 @@ buffer.") | |||
| 1551 | (overlay, beg, end, buffer) | 1551 | (overlay, beg, end, buffer) |
| 1552 | Lisp_Object overlay, beg, end, buffer; | 1552 | Lisp_Object overlay, beg, end, buffer; |
| 1553 | { | 1553 | { |
| 1554 | struct buffer *b; | 1554 | struct buffer *b, *ob; |
| 1555 | Lisp_Object obuffer; | ||
| 1556 | int count = specpdl_ptr - specpdl; | ||
| 1555 | 1557 | ||
| 1556 | CHECK_OVERLAY (overlay, 0); | 1558 | CHECK_OVERLAY (overlay, 0); |
| 1557 | if (NILP (buffer)) | 1559 | if (NILP (buffer)) |
| @@ -1570,16 +1572,20 @@ buffer.") | |||
| 1570 | CHECK_NUMBER_COERCE_MARKER (beg, 1); | 1572 | CHECK_NUMBER_COERCE_MARKER (beg, 1); |
| 1571 | CHECK_NUMBER_COERCE_MARKER (end, 1); | 1573 | CHECK_NUMBER_COERCE_MARKER (end, 1); |
| 1572 | 1574 | ||
| 1575 | specbind (Qinhibit_quit, Qt); | ||
| 1576 | |||
| 1573 | if (XINT (beg) > XINT (end)) | 1577 | if (XINT (beg) > XINT (end)) |
| 1574 | { | 1578 | { |
| 1575 | Lisp_Object temp = beg; | 1579 | Lisp_Object temp = beg; |
| 1576 | beg = end; end = temp; | 1580 | beg = end; end = temp; |
| 1577 | } | 1581 | } |
| 1578 | 1582 | ||
| 1583 | obuffer = Fmarker_buffer (OVERLAY_START (overlay)); | ||
| 1579 | b = XBUFFER (buffer); | 1584 | b = XBUFFER (buffer); |
| 1585 | ob = XBUFFER (obuffer); | ||
| 1580 | 1586 | ||
| 1581 | /* If the overlay has changed buffers, do a thorough redisplay. */ | 1587 | /* If the overlay has changed buffers, do a thorough redisplay. */ |
| 1582 | if (b != XMARKER (OVERLAY_START (overlay))->buffer) | 1588 | if (!EQ (buffer, obuffer)) |
| 1583 | windows_or_buffers_changed = 1; | 1589 | windows_or_buffers_changed = 1; |
| 1584 | else | 1590 | else |
| 1585 | /* Redisplay the area the overlay has just left, or just enclosed. */ | 1591 | /* Redisplay the area the overlay has just left, or just enclosed. */ |
| @@ -1603,8 +1609,11 @@ buffer.") | |||
| 1603 | } | 1609 | } |
| 1604 | } | 1610 | } |
| 1605 | 1611 | ||
| 1606 | b->overlays_before = Fdelq (overlay, b->overlays_before); | 1612 | if (!NILP (obuffer)) |
| 1607 | b->overlays_after = Fdelq (overlay, b->overlays_after); | 1613 | { |
| 1614 | ob->overlays_before = Fdelq (overlay, ob->overlays_before); | ||
| 1615 | ob->overlays_after = Fdelq (overlay, ob->overlays_after); | ||
| 1616 | } | ||
| 1608 | 1617 | ||
| 1609 | Fset_marker (OVERLAY_START (overlay), beg, buffer); | 1618 | Fset_marker (OVERLAY_START (overlay), beg, buffer); |
| 1610 | Fset_marker (OVERLAY_END (overlay), end, buffer); | 1619 | Fset_marker (OVERLAY_END (overlay), end, buffer); |
| @@ -1619,7 +1628,7 @@ buffer.") | |||
| 1619 | /* This puts it in the right list, and in the right order. */ | 1628 | /* This puts it in the right list, and in the right order. */ |
| 1620 | recenter_overlay_lists (b, XINT (b->overlay_center)); | 1629 | recenter_overlay_lists (b, XINT (b->overlay_center)); |
| 1621 | 1630 | ||
| 1622 | return overlay; | 1631 | return unbind_to (count, overlay); |
| 1623 | } | 1632 | } |
| 1624 | 1633 | ||
| 1625 | DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, | 1634 | DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, |
| @@ -1627,11 +1636,19 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, | |||
| 1627 | (overlay) | 1636 | (overlay) |
| 1628 | Lisp_Object overlay; | 1637 | Lisp_Object overlay; |
| 1629 | { | 1638 | { |
| 1639 | Lisp_Object buffer; | ||
| 1630 | struct buffer *b; | 1640 | struct buffer *b; |
| 1641 | int count = specpdl_ptr - specpdl; | ||
| 1631 | 1642 | ||
| 1632 | CHECK_OVERLAY (overlay, 0); | 1643 | CHECK_OVERLAY (overlay, 0); |
| 1633 | 1644 | ||
| 1634 | b = XBUFFER (Fmarker_buffer (OVERLAY_START (overlay))); | 1645 | buffer = Fmarker_buffer (OVERLAY_START (overlay)); |
| 1646 | if (NILP (buffer)) | ||
| 1647 | return Qnil; | ||
| 1648 | |||
| 1649 | b = XBUFFER (buffer); | ||
| 1650 | |||
| 1651 | specbind (Qinhibit_quit, Qt); | ||
| 1635 | 1652 | ||
| 1636 | b->overlays_before = Fdelq (overlay, b->overlays_before); | 1653 | b->overlays_before = Fdelq (overlay, b->overlays_before); |
| 1637 | b->overlays_after = Fdelq (overlay, b->overlays_after); | 1654 | b->overlays_after = Fdelq (overlay, b->overlays_after); |
| @@ -1643,7 +1660,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, | |||
| 1643 | Fset_marker (OVERLAY_START (overlay), Qnil, Qnil); | 1660 | Fset_marker (OVERLAY_START (overlay), Qnil, Qnil); |
| 1644 | Fset_marker (OVERLAY_END (overlay), Qnil, Qnil); | 1661 | Fset_marker (OVERLAY_END (overlay), Qnil, Qnil); |
| 1645 | 1662 | ||
| 1646 | return Qnil; | 1663 | return unbind_to (count, Qnil); |
| 1647 | } | 1664 | } |
| 1648 | 1665 | ||
| 1649 | /* Overlay dissection functions. */ | 1666 | /* Overlay dissection functions. */ |
| @@ -2319,7 +2336,7 @@ Automatically local in all buffers."); | |||
| 2319 | "*Non-nil means deactivate the mark when the buffer contents change."); | 2336 | "*Non-nil means deactivate the mark when the buffer contents change."); |
| 2320 | Vtransient_mark_mode = Qnil; | 2337 | Vtransient_mark_mode = Qnil; |
| 2321 | 2338 | ||
| 2322 | DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only | 2339 | DEFVAR_LISP ("inhibit-read-only", &Vinhibit_read_only, |
| 2323 | "*Non-nil means disregard read-only status of buffers or characters.\n\ | 2340 | "*Non-nil means disregard read-only status of buffers or characters.\n\ |
| 2324 | If the value is t, disregard `buffer-read-only' and all `read-only'\n\ | 2341 | If the value is t, disregard `buffer-read-only' and all `read-only'\n\ |
| 2325 | text properties. If the value is a list, disregard `buffer-read-only'\n\ | 2342 | text properties. If the value is a list, disregard `buffer-read-only'\n\ |