[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nested display strings

From: Stefan Monnier
Subject: Re: Nested display strings
Date: Mon, 25 Apr 2011 11:57:44 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> The main issue is that a single overlays with a `display' property
>> normally means "display that thing *once*".  So while we can argue of
>> the case where the two overlays share the start or end position, in the
>> case where the inner overlays is really "in the middle", there's no
>> clearly correct way to render it.

> I see.  So in this modified use case, where the overlays start at the
> same position:

> (defvar myov1 (make-overlay 16 51))
> (defvar myov2 (make-overlay 16 43))
> (overlay-put myov1 'display "STRING1")
> (overlay-put myov2 'display "STRING2")
> (overlay-put myov1 'priority 1)
> (overlay-put myov2 'priority 2)

> you think it's okay to display

> ;; This buffer STRING2STRING1, and for Lisp evaluation.

> ?

I'm not sure if it's OK, but at least there's an argument that it
doesn't break the "display once per overlay" rule.

> And in the opposite case, where the overlays end at the same position:

> (defvar myov1 (make-overlay 16 51))
> (defvar myov2 (make-overlay 29 51))
> (overlay-put myov1 'display "STRING1")
> (overlay-put myov2 'display "STRING2")
> (overlay-put myov1 'priority 1)
> (overlay-put myov2 'priority 2)

> it is okay to display

> ;; This buffer STRING1, and for Lisp evaluation.

> ?

It seems inconsistent, but I think we should consider both cases
unsupported, so the inconsistency is not too serious.

> If the modified display is deemed okay, I will install that change
> (and probably add something to the docs to mention these caveats).

I think it's OK.

>> So I think the best behavior is to detect the situation and signal
>> some kind of warning/error

> Hmm.. how do you signal an error during redisplay?  I can do something
> like this:

>     add_to_log ("Warning: overlapping `display' strings at pos %d",
>                 make_number (pos));

> Would that be sufficient?

There was recently a discussion of how to signal warnings/errors in
a delayed fashion.  We don't have a good mechanism for it currently, but
it would be good to add one.
In the mean time, the above is better than nothing.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]