Function: overlays-at
overlays-at is a function defined in buffer.c.
Signature
(overlays-at POS &optional SORTED)
Documentation
Return a list of the overlays that contain the character at POS.
If SORTED is non-nil, then sort them by decreasing priority.
Zero-length overlays that start and stop at POS are not included in
the return value. Instead use overlays-in if those overlays are of
interest.
Other relevant functions are documented in the overlay group.
Probably introduced at or before Emacs version 24.4.
Shortdoc
;; overlay
(overlays-at 15)
e.g. => (#<overlay from 1 to 10 in *foo*>)
Aliases
semantic-overlays-at (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 (pos);
if (!buffer_has_overlays ())
return Qnil;
len = 10;
/* We can't use alloca here because overlays_at can call xrealloc. */
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_at (XFIXNUM (pos), true, &overlay_vec, &len, NULL);
if (!NILP (sorted))
noverlays = sort_overlays (overlay_vec, noverlays,
WINDOWP (sorted) ? XWINDOW (sorted) : NULL);
/* Make a list of them all. */
result = Flist (noverlays, overlay_vec);
/* The doc string says the list should be in decreasing order of
priority, so we reverse the list, because sort_overlays sorts in
the increasing order of priority. */
if (!NILP (sorted))
result = Fnreverse (result);
xfree (overlay_vec);
return result;
}