emacs-devel
[Top][All Lists]

## Re: Should invisible imply intangible?

 From: David Kastrup Subject: Re: Should invisible imply intangible? Date: 13 Mar 2002 12:19:15 +0100

Richard Stallman <address@hidden> writes:

>     That much I know, but the problem is when there's some other property
>     like a display' property that ends up displaying something.
>
> If the text is invisible, it should not display *anything* no matter
> what other properties it has (including display', after-string' and
> before-string').  An invisible piece of text should not contribute to
> the screen contents (except for the ellipsis, if any).

Actually, I am using overlays here.  The overlay I use has the
display property set (to an image), and it has the invisible property
set.  This makes the original text invisible (in my book), and
displays some graphic.  Since the display property is that of the
overlay and not of the text, I find this more or less acceptable.

>     It seems not since David uses display+invisible when replacing
>     TeX source code with an image of the output in his preview-latex
>     package (the invisible' property seems useless at first, but he
>     uses it so he can use the isearch-open-invisible hook).
>
> Isn't it the case that specifying an image with a property on some
> text replaces the text with the image?  I think so.

Yes.

> If that is so, I don't understand what purpose this invisible
> property is supposed to serve.  Can you explain?  I cannot figure
> out, from the mere reference to isearch-open-invisible, what he is
> trying to do.

When somebody uses isearch in order to look for strings in the buffer,
I want to have the original text displayed where appropriate.
isearch-open-invisible will call a user-supplied hook in order to make
invisible texts appear when searching.  Those images I use in my
buffer effectively make the original text invisible (for example, I
replace $\frac{\pi}{3}$ by an image for the formula), so I want
isearch to "open" them while going through the buffer.  isearch will,
however, only call isearch-open-invisible if the text/overlay is
marked as invisible, so that is what I do.

> Anyway, it is clearly a bug if invisible fails to completely
> suppress the display of the text it covers.

The text is not displayed.  I presume that if a display property was
present as a text property of the text, that the text would still be
invisible.  The display property of the *overlay*, however, is not
really connected with the text.  For example, you can have empty
overlays (not covering any text) with a display property.  Those
effectively are "visible markers": you cannot change or delete them,
but they move around like markers when inserting and deleting things.
Since the display property of an overlay is not a property of the
text, I find it quite acceptable that it gets not masked out by the
invisible property.  Things would be different if we were talking
about a display property placed on text marked as invisible.

> The text should be intangible when it is invisible, and not when it
> is not.  And none of that should require changing actual text
> properties.

Intangibility in its current implementation is *much* too
heavy-handed for getting automatically activated.  It has lots of bad
side-effects, like making count-lines act differently and stuff.

I _strongly_ suggest that you refrain from making invisible text
intangible automatically.  It is ok to have point-adjustment (namely,
use the cursor out of invisible areas after a user command
completes), but the semantics of "intangible" disturb all buffer
manipulations.  Lots of packages will break if you apply it
automatically.

--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
`