all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* question concerning overlay before-strings and property inheritance
@ 2011-04-25 20:34 az
  2011-04-25 21:31 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: az @ 2011-04-25 20:34 UTC (permalink / raw)
  To: help-gnu-emacs

Is there any way to arrange for an overlay before-string to inherit 
face properties from other overlays?  

Evaluation of the following form provides a test case of my problem: 

(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 'face 'highlight)))

As you can see, the before-string "FOO" doesn't inherit any
highlighting from the second overlay.  Is it possible to set up
the overlays up so that the before-string inherits the face
property from the second overlay?  (I know I can manually
propertize the before-string with the relevant face, but I'd
like, if possible, to arrange for the face inheritance to happen
automatically.)







^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: question concerning overlay before-strings and property inheritance
  2011-04-25 20:34 question concerning overlay before-strings and property inheritance az
@ 2011-04-25 21:31 ` Eli Zaretskii
  2011-04-25 22:42   ` az
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2011-04-25 21:31 UTC (permalink / raw)
  To: help-gnu-emacs

> From: az <ujfubvur@gmail.com>
> Date: Mon, 25 Apr 2011 20:34:54 +0000 (UTC)
> 
> (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 'face 'highlight)))
> 
> As you can see, the before-string "FOO" doesn't inherit any
> highlighting from the second overlay.  Is it possible to set up
> the overlays up so that the before-string inherits the face
> property from the second overlay?

Why should the before-string "inherit" from o2?  If we were to
introduce such "inheritance", how would Emacs determine from which
overlay to "inherit"?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: question concerning overlay before-strings and property inheritance
  2011-04-25 21:31 ` Eli Zaretskii
@ 2011-04-25 22:42   ` az
  0 siblings, 0 replies; 3+ messages in thread
From: az @ 2011-04-25 22:42 UTC (permalink / raw)
  To: help-gnu-emacs

> 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)))





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-25 22:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-25 20:34 question concerning overlay before-strings and property inheritance az
2011-04-25 21:31 ` Eli Zaretskii
2011-04-25 22:42   ` az

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.