comparison src/buffer.c @ 12488:71aa23be0228

(overlays_in): Don't count empty overlays at END. (Foverlays_in): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Fri, 07 Jul 1995 13:31:48 +0000
parents 63c03173db06
children 5920994b14c2
comparison
equal deleted inserted replaced
12487:b657158dd5c9 12488:71aa23be0228
1693 *prev_ptr = prev; 1693 *prev_ptr = prev;
1694 return idx; 1694 return idx;
1695 } 1695 }
1696 1696
1697 /* Find all the overlays in the current buffer that overlap the range BEG-END 1697 /* Find all the overlays in the current buffer that overlap the range BEG-END
1698 plus empty overlays anywhere from BEG to END. 1698 or are empty at BEG.
1699
1699 Return the number found, and store them in a vector in *VEC_PTR. 1700 Return the number found, and store them in a vector in *VEC_PTR.
1700 Store in *LEN_PTR the size allocated for the vector. 1701 Store in *LEN_PTR the size allocated for the vector.
1701 Store in *NEXT_PTR the next position after POS where an overlay starts, 1702 Store in *NEXT_PTR the next position after POS where an overlay starts,
1702 or ZV if there are no more overlays. 1703 or ZV if there are no more overlays.
1703 Store in *PREV_PTR the previous position before POS where an overlay ends, 1704 Store in *PREV_PTR the previous position before POS where an overlay ends,
1746 prev = endpos; 1747 prev = endpos;
1747 break; 1748 break;
1748 } 1749 }
1749 startpos = OVERLAY_POSITION (ostart); 1750 startpos = OVERLAY_POSITION (ostart);
1750 /* Count an interval if it either overlaps the range 1751 /* Count an interval if it either overlaps the range
1751 or is empty at either end of the range. */ 1752 or is empty at the start of the range. */
1752 if ((beg < endpos && startpos < end) 1753 if ((beg < endpos && startpos < end)
1753 || (startpos == endpos && beg == startpos) 1754 || (startpos == endpos && beg == endpos))
1754 || (startpos == endpos && end == startpos))
1755 { 1755 {
1756 if (idx == len) 1756 if (idx == len)
1757 { 1757 {
1758 /* The supplied vector is full. 1758 /* The supplied vector is full.
1759 Either make it bigger, or don't store any more in it. */ 1759 Either make it bigger, or don't store any more in it. */
1792 if (startpos < next) 1792 if (startpos < next)
1793 next = startpos; 1793 next = startpos;
1794 break; 1794 break;
1795 } 1795 }
1796 endpos = OVERLAY_POSITION (oend); 1796 endpos = OVERLAY_POSITION (oend);
1797 /* Count an interval if it either overlaps the range
1798 or is empty at the start of the range. */
1797 if ((beg < endpos && startpos < end) 1799 if ((beg < endpos && startpos < end)
1798 || (startpos == endpos && beg == startpos) 1800 || (startpos == endpos && beg == endpos))
1799 || (startpos == endpos && end == startpos))
1800 { 1801 {
1801 if (idx == len) 1802 if (idx == len)
1802 { 1803 {
1803 if (extend) 1804 if (extend)
1804 { 1805 {
2753 xfree (overlay_vec); 2754 xfree (overlay_vec);
2754 return result; 2755 return result;
2755 } 2756 }
2756 2757
2757 DEFUN ("overlays-in", Foverlays_in, Soverlays_in, 2, 2, 0, 2758 DEFUN ("overlays-in", Foverlays_in, Soverlays_in, 2, 2, 0,
2758 "Return a list of the overlays that overlap region BEG ... END.\n\ 2759 "Return a list of the overlays that overlap the region BEG ... END.\n\
2759 This includes empty overlays at BEG or END (as well as empty overlays\n\ 2760 Overlap means that at least one character is contained within the overlay\n\
2760 within the range.") 2761 and also contained within the specified region.\n\
2762 Empty overlays are included in the result if they are located at BEG\n\
2763 or between BEG and END.")
2761 (beg, end) 2764 (beg, end)
2762 Lisp_Object beg, end; 2765 Lisp_Object beg, end;
2763 { 2766 {
2764 int noverlays; 2767 int noverlays;
2765 Lisp_Object *overlay_vec; 2768 Lisp_Object *overlay_vec;