comparison src/buffer.c @ 11097:e1b4b0d66bf3

(overlay_touches_p): New function.
author Karl Heuer <kwzh@gnu.org>
date Wed, 22 Mar 1995 21:23:10 +0000
parents 35664a2851e7
children 20ff2eaa8bf8
comparison
equal deleted inserted replaced
11096:cac0367b1794 11097:e1b4b0d66bf3
1628 if (next_ptr) 1628 if (next_ptr)
1629 *next_ptr = next; 1629 *next_ptr = next;
1630 if (prev_ptr) 1630 if (prev_ptr)
1631 *prev_ptr = prev; 1631 *prev_ptr = prev;
1632 return idx; 1632 return idx;
1633 }
1634
1635 /* Fast function to just test if we're at an overlay boundary. */
1636 int
1637 overlay_touches_p (pos)
1638 int pos;
1639 {
1640 Lisp_Object tail, overlay;
1641
1642 for (tail = current_buffer->overlays_before; GC_CONSP (tail);
1643 tail = XCONS (tail)->cdr)
1644 {
1645 int endpos;
1646
1647 overlay = XCONS (tail)->car;
1648 if (!GC_OVERLAYP (overlay))
1649 abort ();
1650
1651 endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
1652 if (endpos < pos)
1653 break;
1654 if (endpos == pos || OVERLAY_POSITION (OVERLAY_START (overlay)) == pos)
1655 return 1;
1656 }
1657
1658 for (tail = current_buffer->overlays_after; GC_CONSP (tail);
1659 tail = XCONS (tail)->cdr)
1660 {
1661 int startpos;
1662
1663 overlay = XCONS (tail)->car;
1664 if (!GC_OVERLAYP (overlay))
1665 abort ();
1666
1667 startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
1668 if (pos < startpos)
1669 break;
1670 if (startpos == pos || OVERLAY_POSITION (OVERLAY_END (overlay)) == pos)
1671 return 1;
1672 }
1673 return 0;
1633 } 1674 }
1634 1675
1635 struct sortvec 1676 struct sortvec
1636 { 1677 {
1637 Lisp_Object overlay; 1678 Lisp_Object overlay;