Go to the first, previous, next, last section, table of contents.

Overlays

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

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
This property specifies a face for displaying the text within the overlay.
priority
This property's value (which should be a nonnegative number) determines the priority of the overlay. The priority matters when two or more overlays cover the same character and both specify a face for display; the one whose 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
If the window property is non-nil, then the overlay applies only on that window.

Overlay Functions

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.


Go to the first, previous, next, last section, table of contents.