Summary: clearer relation between overlay and marker
< Overlay start and end positions can be markers, which move around as
< text is inserted before/between/after them.
> An overlay uses markers to record its beginning and end, thus it moves around as
> text is inserted before/in/after it.
An overlay uses markers to record its beginning and end, thus it moves around as text is inserted before/in/after it. Since overlays are not attached to the text itself, they are lost when you kill text and then yank it somewhere else.
See also: Overlays.
(defun list-overlays-at (&optional pos) "Describe overlays at POS or point." (interactive) (setq pos (or pos (point))) (let ((overlays (overlays-at pos)) (obuf (current-buffer)) (buf (get-buffer-create "*Overlays*")) (props '(priority window category face mouse-face display help-echo modification-hooks insert-in-front-hooks insert-behind-hooks invisible intangible isearch-open-invisible isearch-open-invisible-temporary before-string after-string evaporate local-map keymap field)) start end text) (if (not overlays) (message "None.") (set-buffer buf) (erase-buffer) (dolist (o overlays) (setq start (overlay-start o) end (overlay-end o) text (with-current-buffer obuf (buffer-substring start end))) (when (> (- end start) 13) (setq text (concat (substring text 1 10) "..."))) (insert (format "From %d to %d: \"%s\":\n" start end text)) (dolist (p props) (when (overlay-get o p) (insert (format " %15S: %S\n" p (overlay-get o p)))))) (pop-to-buffer buf))))
Package AutoOverlays lets you define overlays that are created (and updated and destroyed) automatically when text in a buffer matches a regular expression.