Function: overlays-in
overlays-in is a function defined in buffer.c.
Signature
(overlays-in BEG END)
Documentation
Return a list of the overlays that overlap the region BEG ... END.
Overlap means that at least one character between BEG and END is contained within the overlay. Note that this excludes the character at (i.e., after) END.
Empty overlays do not contain any characters, so they 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. (If BEG and END are the same buffer position, an empty overlay at BEG will also be at END, but it still qualifies because it's at BEG.)
The resulting list of overlays is in an arbitrary unpredictable order.
This function can return overlays outside of the current narrowing of the buffer if BEG and/or END are outside of the narrowing.
Other relevant functions are documented in the overlay group.
Probably introduced at or before Emacs version 19.30.
Shortdoc
;; overlay
(overlays-in 1 30)
e.g. => (#<overlay from 1 to 10 in *foo*>)
Aliases
semantic-overlays-in (obsolete since 27.1)
Source Code
// Defined in /usr/src/emacs/src/buffer.c
{
ptrdiff_t len, noverlays;
Lisp_Object *overlay_vec;
Lisp_Object result;
CHECK_FIXNUM_COERCE_MARKER (beg);
CHECK_FIXNUM_COERCE_MARKER (end);
if (!buffer_has_overlays ())
return Qnil;
len = 10;
overlay_vec = xmalloc (len * sizeof *overlay_vec);
/* Put all the overlays we want in a vector in overlay_vec.
Store the length in len. */
noverlays = overlays_in (XFIXNUM (beg), XFIXNUM (end), 1, &overlay_vec, &len,
true, false, NULL);
/* Make a list of them all. */
result = Flist (noverlays, overlay_vec);
xfree (overlay_vec);
return result;
}