Function: make-overlay
make-overlay is a function defined in buffer.c.
Signature
(make-overlay BEG END &optional BUFFER FRONT-ADVANCE REAR-ADVANCE)
Documentation
Create a new overlay with range BEG to END in BUFFER and return it.
If omitted, BUFFER defaults to the current buffer.
BEG and END may be integers or markers.
The fourth arg FRONT-ADVANCE, if non-nil, makes the marker
for the front of the overlay advance when text is inserted there
(which means the text *is not* included in the overlay).
The fifth arg REAR-ADVANCE, if non-nil, makes the marker
for the rear of the overlay advance when text is inserted there
(which means the text *is* included in the overlay).
Other relevant functions are documented in the overlay group.
Probably introduced at or before Emacs version 19.30.
Shortdoc
;; overlay
(make-overlay 1 10)
e.g. => #<overlay from 1 to 10 in *foo*>
Aliases
viper-make-overlay (obsolete since 27.1)
ediff-make-overlay (obsolete since 27.1)
speedbar-make-overlay (obsolete since 27.1)
semantic-make-overlay (obsolete since 27.1)
reftex-make-overlay (obsolete since 28.1)
Source Code
// Defined in /usr/src/emacs/src/buffer.c
{
Lisp_Object ov;
struct buffer *b;
if (NILP (buffer))
XSETBUFFER (buffer, current_buffer);
else
CHECK_BUFFER (buffer);
b = XBUFFER (buffer);
if (! BUFFER_LIVE_P (b))
error ("Attempt to create overlay in a dead buffer");
if (MARKERP (beg) && !BASE_EQ (Fmarker_buffer (beg), buffer))
signal_error ("Marker points into wrong buffer", beg);
if (MARKERP (end) && !BASE_EQ (Fmarker_buffer (end), buffer))
signal_error ("Marker points into wrong buffer", end);
CHECK_FIXNUM_COERCE_MARKER (beg);
CHECK_FIXNUM_COERCE_MARKER (end);
if (XFIXNUM (beg) > XFIXNUM (end))
{
Lisp_Object temp;
temp = beg; beg = end; end = temp;
}
ptrdiff_t obeg = clip_to_bounds (BUF_BEG (b), XFIXNUM (beg), BUF_Z (b));
ptrdiff_t oend = clip_to_bounds (obeg, XFIXNUM (end), BUF_Z (b));
ov = build_overlay (! NILP (front_advance),
! NILP (rear_advance), Qnil);
add_buffer_overlay (b, XOVERLAY (ov), obeg, oend);
/* We don't need to redisplay the region covered by the overlay, because
the overlay has no properties at the moment. */
return ov;
}