all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: 60399-done@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
	60399@debbugs.gnu.org, juri@linkov.net
Subject: bug#60399: 30.0.50; Usage of `isearch-open-invisible-temporary' is not documented
Date: Tue, 03 Jan 2023 09:14:20 -0500	[thread overview]
Message-ID: <jwvbknflo8o.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87mt70kn3d.fsf@localhost> (Ihor Radchenko's message of "Tue, 03 Jan 2023 09:02:14 +0000")

>> 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.
>
> I am not sure why isearch should decide this instead of letting
> `isearch-open-invisible-temporary' decide what to close.

The question is not just what to close but *when*.

Isearch need to tell your code when it thinks you can close.
It's natural to use the overlay's boundaries to decide when to do that,
and it's natural to use that overlay as "the info about what to close"
when i calls you back.

I'm not claiming it's perfect or ideal.  It's just a fairly natural
choice.  Note that in `reveal.el` I use a similar API but with a twist:
after calling `reveal-toggle-invisible`, `reveal.el` checks whether the
points we're interested in have been made visible and if not, we take
the (new) overlays and repeat.  This way, to get the behavior you say
you want for Org (which we get in `outline-mode` with `reveal-mode`) we
just arrange for `reveal-toggle-invisible` to show the headings "one
level down" (and re-hide everything else): if that's not enough,
`reveal.el` then calls `reveal-toggle-invisible` inside one of the
subheadings until we're at the actual leaf.

This addresses a major shortcoming of the
`isearch-open-invisible-temporary' which is that the function is not
told which part of the overlay needs to be opened.  The best the
function can do is presume that `point` is the thing of interest, but
it's not specified anywhere (and in the case of `reveal.el` it's not
sufficient because we may have several points to reveal at the same
time).

>> `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.
>
> This is a nice trick, which is unfortunately not very useful in my
> situation. Some text should still remain invisible in Org even when
> opening is requested. Your code reveals everything unconditionally.

There's a misunderstanding here: `outline-reveal-toggle-invisible`
reveals only the immediate children.  All it reveals is basically:

                 (outline-show-entry)
                 (outline-show-children)


-- Stefan






      reply	other threads:[~2023-01-03 14:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29 10:10 bug#60399: 30.0.50; Usage of `isearch-open-invisible-temporary' is not documented Ihor Radchenko
2022-12-29 17:33 ` Juri Linkov
2022-12-31 13:03   ` Ihor Radchenko
2023-01-01  9:05     ` Eli Zaretskii
2023-01-01  9:09       ` Ihor Radchenko
2023-01-01 11:00         ` Eli Zaretskii
2023-01-01 12:51           ` Ihor Radchenko
2023-01-01 13:55             ` Eli Zaretskii
2023-01-02  8:57               ` Ihor Radchenko
2023-01-02 12:29                 ` Eli Zaretskii
2023-01-02 15:34             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-03  9:02               ` Ihor Radchenko
2023-01-03 14:14                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvbknflo8o.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=60399-done@debbugs.gnu.org \
    --cc=60399@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=monnier@iro.umontreal.ca \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.