Previous: Managing Overlays, Up: Overlays
This function returns a list of all the overlays that cover the character at 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.
To illustrate usage, here is a Lisp function that returns a list of the overlays that specify property prop for the character at point:
(defun find-overlays-specifying (prop) (let ((overlays (overlays-at (point))) found) (while overlays (let ((overlay (car overlays))) (if (overlay-get overlay prop) (setq found (cons overlay found)))) (setq overlays (cdr overlays))) found))
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 strictly between beg and end.
This function returns the buffer position of the next beginning or end of an overlay, after pos.
This function returns the buffer position of the previous beginning or end of an overlay, before pos.
Here's an easy way to use next-overlay-change
to search for the
next character which gets a non-nil
happy
property from
either its overlays or its text properties (see Property Search):
(defun find-overlay-prop (prop) (save-excursion (while (and (not (eobp)) (not (get-char-property (point) 'happy))) (goto-char (min (next-overlay-change (point)) (next-single-property-change (point) 'happy)))) (point)))