[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question concerning overlay before-strings and property inheritance
From: |
az |
Subject: |
Re: question concerning overlay before-strings and property inheritance |
Date: |
Mon, 25 Apr 2011 22:42:14 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
> Why should the before-string "inherit" from o2?
Apologies if my question was asinine, or if I appeared to be
suggesting that the existing behavior was incorrect. I wasn't--I
was asking if there was, currently, a way to get something like
the behavior I described.
As to motivation: Consider a case in which one is using
before-strings to temporarily annotate bits of code, and using
another set of overlays to highlight stretches of code, where the
intent of the highlighting is such that it meaningfully applies
to the annotation as well as to the code itself.
> If we were to introduce such "inheritance", how would Emacs
> determine from which overlay to "inherit"?
This has already been decided and implemented for mouse-face
properties:
(save-excursion
(goto-char 1)
(insert ";; String\n")
(let ((o (make-overlay 6 7))
(o2 (make-overlay 4 8)))
(overlay-put o 'before-string "FOO")
(overlay-put o2 'mouse-face 'highlight)))