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


Managing Overlays

This section describes the functions to create, delete and move overlays, and to examine their contents.

Function: make-overlay start end &optional buffer front-advance rear-advance
This function creates and returns an overlay that belongs to buffer and ranges from start to end. Both start and end must specify buffer positions; they may be integers or markers. If buffer is omitted, the overlay is created in the current buffer.

The arguments front-advance and rear-advance specify the insertion type for the start of the overlay and for the end of the overlay. See section Marker Insertion Types.

Function: overlay-start overlay
This function returns the position at which overlay starts, as an integer.

Function: overlay-end overlay
This function returns the position at which overlay ends, as an integer.

Function: overlay-buffer overlay
This function returns the buffer that overlay belongs to.

Function: delete-overlay overlay
This function deletes overlay. The overlay continues to exist as a Lisp object, but ceases to be attached to the buffer it belonged to, and ceases to have any effect on display.

A deleted overlay is not permanently useless. You can give it a new buffer position by calling move-overlay.

Function: move-overlay overlay start end &optional buffer
This function moves overlay to buffer, and places its bounds at start and end. Both arguments start and end must specify buffer positions; they may be integers or markers. If buffer is omitted, the overlay stays in the same buffer.

The return value is overlay.

This is the only valid way to change the endpoints of an overlay. Do not try modifying the markers in the overlay by hand, as that fails to update other vital data structures and can cause some overlays to be "lost".

Function: overlays-at pos
This function returns a list of all the overlays that contain position pos in the current buffer. The list is in no particular order. An overlay contains position pos if it begins at or before pos, and ends after pos.

Function: overlays-in beg end
This function returns a list of the overlays that overlap the region beg through end. "Overlap" means that at least one character is contained within the overlay and also contained within the specified region; however, empty overlays are included in the result if they are located at beg or between beg and end.

Function: next-overlay-change pos
This function returns the buffer position of the next beginning or end of an overlay, after pos.

Function: previous-overlay-change pos
This function returns the buffer position of the previous beginning or end of an overlay, before pos.


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