Subject: bug#60399: 30.0.50; Usage of `isearch-open-invisible-temporary' is not documented

From: Stefan Monnier <[email-masked]>
Date: Mon, 02 Jan 2023 10:34:27 -0500

> The 'isearch-open-invisible-temporary takes care about proper saving and
> restoring the necessary overlays. However, isearch gets broken.
>
> In this setup, it is not that obvious that isearch will still try to do
> something with overlays that got deleted during the call to
> 'isearch-open-invisible-temporary.

FWIW, I never fully understood Richard's design (installed in commit
0352b205714e1c7ab97c1b6dc7678f6b51ebe089), indeed.  E.g. I don't
understand why there need to be both
a `isearch-open-invisible-temporary` and a `isearch-open-invisible` property.

But it's very natural that the caller of that
`isearch-open-invisible-temporary` may still want to know the boundaries
of this overlay after its content is made visible, so as to know when to
make it invisible again.

The caller could store that information on its own (with a pair of
markers or another overlay), but it's very natural for the caller to
just use that overlay.

> I am not even sure how to achieve the desired custom behavior using the
> current isearch implementation.

`reveal-toggle-invisible` works basically the same way as
`isearch-open-invisible-temporary` and in
`outline-reveal-toggle-invisible` I had the same problem as you do,
which I solved with:

      (let ((o1 (copy-overlay o)))
        (overlay-put o 'invisible nil)  ;Show (most of) the text.

-- Stefan