You can use overlays to alter the appearance of a buffer's text on the screen. An overlay is an object which belongs to a particular buffer, and has a specified beginning and end. It also has properties which you can examine and set; these affect the display of the text within the overlay.
Overlay properties are like text properties in some respects, but the differences are more important than the similarities. Text properties are considered a part of the text; overlays are specifically considered not to be part of the text. Thus, copying text between various buffers and strings preserves text properties, but does not try to preserve overlays. Changing a buffer's text properties marks the buffer as modified, while moving an overlay or changing its properties does not.
face
priority
priority
value is larger takes priority over the
other, and its face attributes override the face attributes of the lower
priority overlay.
Currently, all overlays take priority over text properties. Please
avoid using negative priority values, as we have not yet decided just
what they should mean.
window
window
property is non-nil
, then the overlay
applies only on that window.
Use the functions overlay-get
and overlay-put
to access and set the properties of an overlay.
They take arguments like get
and put
, except
that the first argument is an overlay rather than a symbol.
To create an overlay, call (make-overlay start end)
.
You can specify the buffer as the third argument if you wish.
To delete one, use delete-overlay
.
Use overlay-start
, overlay-end
and overlay-buffer
to examine the location and range of an overlay. Use move-overlay
to change them; its arguments are overlay, start, end
and (optionally) the buffer.
There are two functions to search for overlays: overlays-at
and
next-overlay-change
. overlays-at
returns a list of all
the overlays containing a particular position.
(next-overlay-change pos)
returns the position of the next
overlay beginning or end following pos.