diff options
| author | Martin Rudalics | 2008-03-15 09:14:40 +0000 |
|---|---|---|
| committer | Martin Rudalics | 2008-03-15 09:14:40 +0000 |
| commit | 7723e095a73686826f1f28d86f22420355790629 (patch) | |
| tree | fbeab2278dc2bd1ee35d1f193299673cf3e78bd5 /src/buffer.c | |
| parent | 4e11bcc210ba6a50eeda79aa3324b8944bfe76e8 (diff) | |
| download | emacs-7723e095a73686826f1f28d86f22420355790629.tar.gz emacs-7723e095a73686826f1f28d86f22420355790629.zip | |
(overlays_in, Foverlays_in): Include empty overlays
at end of range when it coincides with the end of the buffer.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/buffer.c b/src/buffer.c index 1ccb2f70e7d..5fc72d90bef 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1634,7 +1634,7 @@ record_buffer (buf) | |||
| 1634 | Vbuffer_alist = link; | 1634 | Vbuffer_alist = link; |
| 1635 | 1635 | ||
| 1636 | /* Effectively do a delq on buried_buffer_list. */ | 1636 | /* Effectively do a delq on buried_buffer_list. */ |
| 1637 | 1637 | ||
| 1638 | prev = Qnil; | 1638 | prev = Qnil; |
| 1639 | for (link = XFRAME (frame)->buried_buffer_list; CONSP (link); | 1639 | for (link = XFRAME (frame)->buried_buffer_list; CONSP (link); |
| 1640 | link = XCDR (link)) | 1640 | link = XCDR (link)) |
| @@ -2813,8 +2813,9 @@ overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr, change_req) | |||
| 2813 | return idx; | 2813 | return idx; |
| 2814 | } | 2814 | } |
| 2815 | 2815 | ||
| 2816 | /* Find all the overlays in the current buffer that overlap the range BEG-END | 2816 | /* Find all the overlays in the current buffer that overlap the range |
| 2817 | or are empty at BEG. | 2817 | BEG-END, or are empty at BEG, or are empty at END provided END |
| 2818 | denotes the position at the end of the current buffer. | ||
| 2818 | 2819 | ||
| 2819 | Return the number found, and store them in a vector in *VEC_PTR. | 2820 | Return the number found, and store them in a vector in *VEC_PTR. |
| 2820 | Store in *LEN_PTR the size allocated for the vector. | 2821 | Store in *LEN_PTR the size allocated for the vector. |
| @@ -2849,6 +2850,7 @@ overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr) | |||
| 2849 | int next = ZV; | 2850 | int next = ZV; |
| 2850 | int prev = BEGV; | 2851 | int prev = BEGV; |
| 2851 | int inhibit_storing = 0; | 2852 | int inhibit_storing = 0; |
| 2853 | int end_is_Z = end == Z; | ||
| 2852 | 2854 | ||
| 2853 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 2855 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 2854 | { | 2856 | { |
| @@ -2866,10 +2868,12 @@ overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr) | |||
| 2866 | break; | 2868 | break; |
| 2867 | } | 2869 | } |
| 2868 | startpos = OVERLAY_POSITION (ostart); | 2870 | startpos = OVERLAY_POSITION (ostart); |
| 2869 | /* Count an interval if it either overlaps the range | 2871 | /* Count an interval if it overlaps the range, is empty at the |
| 2870 | or is empty at the start of the range. */ | 2872 | start of the range, or is empty at END provided END denotes the |
| 2873 | end of the buffer. */ | ||
| 2871 | if ((beg < endpos && startpos < end) | 2874 | if ((beg < endpos && startpos < end) |
| 2872 | || (startpos == endpos && beg == endpos)) | 2875 | || (startpos == endpos |
| 2876 | && (beg == endpos || (end_is_Z && endpos == end)))) | ||
| 2873 | { | 2877 | { |
| 2874 | if (idx == len) | 2878 | if (idx == len) |
| 2875 | { | 2879 | { |
| @@ -2914,10 +2918,12 @@ overlays_in (beg, end, extend, vec_ptr, len_ptr, next_ptr, prev_ptr) | |||
| 2914 | break; | 2918 | break; |
| 2915 | } | 2919 | } |
| 2916 | endpos = OVERLAY_POSITION (oend); | 2920 | endpos = OVERLAY_POSITION (oend); |
| 2917 | /* Count an interval if it either overlaps the range | 2921 | /* Count an interval if it overlaps the range, is empty at the |
| 2918 | or is empty at the start of the range. */ | 2922 | start of the range, or is empty at END provided END denotes the |
| 2923 | end of the buffer. */ | ||
| 2919 | if ((beg < endpos && startpos < end) | 2924 | if ((beg < endpos && startpos < end) |
| 2920 | || (startpos == endpos && beg == endpos)) | 2925 | || (startpos == endpos |
| 2926 | && (beg == endpos || (end_is_Z && endpos == end)))) | ||
| 2921 | { | 2927 | { |
| 2922 | if (idx == len) | 2928 | if (idx == len) |
| 2923 | { | 2929 | { |
| @@ -4113,8 +4119,9 @@ DEFUN ("overlays-in", Foverlays_in, Soverlays_in, 2, 2, 0, | |||
| 4113 | doc: /* Return a list of the overlays that overlap the region BEG ... END. | 4119 | doc: /* Return a list of the overlays that overlap the region BEG ... END. |
| 4114 | Overlap means that at least one character is contained within the overlay | 4120 | Overlap means that at least one character is contained within the overlay |
| 4115 | and also contained within the specified region. | 4121 | and also contained within the specified region. |
| 4116 | Empty overlays are included in the result if they are located at BEG | 4122 | Empty overlays are included in the result if they are located at BEG, |
| 4117 | or between BEG and END. */) | 4123 | between BEG and END, or at END provided END denotes the position at the |
| 4124 | end of the buffer. */) | ||
| 4118 | (beg, end) | 4125 | (beg, end) |
| 4119 | Lisp_Object beg, end; | 4126 | Lisp_Object beg, end; |
| 4120 | { | 4127 | { |