Mercurial > emacs
changeset 92975:ca18807830f1
(overlays_in, Foverlays_in): Include empty overlays
at end of range when it coincides with the end of the buffer.
author | Martin Rudalics <rudalics@gmx.at> |
---|---|
date | Sat, 15 Mar 2008 09:13:59 +0000 |
parents | ea61d2529bd4 |
children | 166265ab1522 |
files | src/buffer.c |
diffstat | 1 files changed, 18 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buffer.c Sat Mar 15 03:03:08 2008 +0000 +++ b/src/buffer.c Sat Mar 15 09:13:59 2008 +0000 @@ -1634,7 +1634,7 @@ Vbuffer_alist = link; /* Effectively do a delq on buried_buffer_list. */ - + prev = Qnil; for (link = XFRAME (frame)->buried_buffer_list; CONSP (link); link = XCDR (link)) @@ -2813,8 +2813,9 @@ return idx; } -/* Find all the overlays in the current buffer that overlap the range BEG-END - or are empty at BEG. +/* Find all the overlays in the current buffer that overlap the range + BEG-END, or are empty at BEG, or are empty at END provided END + denotes the position at the end of the current buffer. Return the number found, and store them in a vector in *VEC_PTR. Store in *LEN_PTR the size allocated for the vector. @@ -2849,6 +2850,7 @@ int next = ZV; int prev = BEGV; int inhibit_storing = 0; + int end_is_Z = end == Z; for (tail = current_buffer->overlays_before; tail; tail = tail->next) { @@ -2866,10 +2868,12 @@ break; } startpos = OVERLAY_POSITION (ostart); - /* Count an interval if it either overlaps the range - or is empty at the start of the range. */ + /* Count an interval if it overlaps the range, is empty at the + start of the range, or is empty at END provided END denotes the + end of the buffer. */ if ((beg < endpos && startpos < end) - || (startpos == endpos && beg == endpos)) + || (startpos == endpos + && (beg == endpos || (end_is_Z && endpos == end)))) { if (idx == len) { @@ -2914,10 +2918,12 @@ break; } endpos = OVERLAY_POSITION (oend); - /* Count an interval if it either overlaps the range - or is empty at the start of the range. */ + /* Count an interval if it overlaps the range, is empty at the + start of the range, or is empty at END provided END denotes the + end of the buffer. */ if ((beg < endpos && startpos < end) - || (startpos == endpos && beg == endpos)) + || (startpos == endpos + && (beg == endpos || (end_is_Z && endpos == end)))) { if (idx == len) { @@ -4113,8 +4119,9 @@ doc: /* Return a list of the overlays that overlap the region BEG ... END. Overlap means that at least one character is contained within the overlay and also contained within the specified region. -Empty overlays are included in the result if they are located at BEG -or between BEG and END. */) +Empty overlays are included in the result if they are located at BEG, +between BEG and END, or at END provided END denotes the position at the +end of the buffer. */) (beg, end) Lisp_Object beg, end; {