emacs-devel
[Top][All Lists]
Advanced

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

Re: Nested display strings


From: Eli Zaretskii
Subject: Re: Nested display strings
Date: Mon, 25 Apr 2011 16:29:31 +0300

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden
> Date: Mon, 25 Apr 2011 09:47:23 -0300
> 
> 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.

?

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.

?

This is what happens with the change I showed in my previous message.
(With the current code, we display STRING2STRING1 in the first case
and STRING1STRING2 in the second.)

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

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



reply via email to

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