Subject: Re: bug#14542: 24.3.50; Simultaneous use of display and invisible properties

From: Eli Zaretskii <[email-masked]>
Date: Mon, 03 Jun 2013 18:49:30 +0300

> From: Jambunathan K <[email-masked]>
> Date: Mon, 03 Jun 2013 10:04:51 +0530
> 
> 
> I have a piece of text that has both invisible and display property set.
> The underlying buffer text is invisible but the display engine displays
> the overlay string. i.e., In the example below, I can see {org-defkey}
> in my monitor.  The underlying character "1..." etc is hidden.
> 
> This bug is merely to check whether the above behaviour is as intended
> or a "unknown" side-effect.

It's undefined behavior.  What you see is a consequence of how the
display engine implements application of text properties.  When the
same buffer or string position has more than one property change, the
display engine applies them in this order:

 . 'fontified'
 . 'face'
 . 'display'
 . 'invisible'
 . 'composition'

When 2 properties remove text from display in different ways, the
result depends on the order.

> I have looked at (info "(elisp) Replacing Specs").  I am not sure
> whether the 'invisible property counts as a display spec.

It doesn't.  Display specs are limited to 'display' properties (and
not all of them are "replacing").  The 'invisible' property just makes
the text invisible on display.

> I think it is worth clarifying the desgin or implementation detail
> in the Elisp manual.

Not sure we should leak the implementation into the documentation.
This code is unaltered since it was written 13 years ago, and I don't
think I ever heard any questions about this particular situation.  I
guess it's sufficiently rare.