Dernière modification
Résumé : Shortened manual link.
Modifié(e) :
< See the Emacs Lisp Reference Manual: http://www.gnu.org/software/emacs/elisp/html_node/Overlays.html#Overlays .
à
> See also: Manual:Overlays.
An overlay acts similar to a text property, but it is attached to buffer or string positions, not to the characters at those positions.
Overlay start and end positions can be markers, which move around as text is inserted before/between/after them. Since overlays are not attached to the text itself, they are lost when you kill text and then yank it somewhere else.
Overlays were introduced to GnuEmacs following the development of extents in XEmacs. Recently XEmacs introduced a compatibility layer that translates overlays to extents.
See also: Overlays.
Here is a command to list the overlays at point:
(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.