Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reveal invisible text while moving through swiper matches #1312

Closed
tarsius opened this Issue Nov 23, 2017 · 8 comments

Comments

Projects
None yet
2 participants
@tarsius
Copy link
Contributor

commented Nov 23, 2017

When I move through swiper matches I would like hidden text to be revealed so that I can actually see the context of the current match. It appears only the final match is ever revealed once the search is exited.

I dug around a bit and found swiper--ensure-visible, called in swiper--action. As a quick hack I added (with-ivy-window (swiper--ensure-visible)) to ivy-set-index, so that this would be done on every ivy-{next,prevous}-line. Of course that should only be done when actually using swiper, and probably not here, but as a temporary solution it might have worked. However while some revealing did happen once I had done that I ended up having to move down two matches and then one match up again to reveal that first match.

I was actually kinda surprised that automatic revealing doesn't work out of the box. And maybe I am just overlooking something, but searching the source for the relevant terms such as "reveal" and "invisible" didn't, uhm, reveal much.

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Nov 23, 2017

Just checked in org-mode with everything hidden. Reveals still work correctly for me. It's a basic feature that's been around for a very long time.

See also swiper--update-input-ivy - this function is called each time a candidate changes. It calls isearch-range-invisible in turn.

@tarsius

This comment has been minimized.

Copy link
Contributor Author

commented Nov 23, 2017

It calls isearch-range-invisible in turn.

You don't do anything with its value and according to its doc-string returning a value is all it does. (It does "merge" overlays, so that's a side-effect, but I don't think it makes invisible text visible.)

See also swiper--update-input-ivy - this function is called each time a candidate changes.

Using swiper--ensure-visible here (instead of isearch-range-invisible) reveals the current match (but obviously doesn't hide it again).

@tarsius

This comment has been minimized.

Copy link
Contributor Author

commented Nov 23, 2017

But this appears to be a configuration issue on my end, with emacs -Q things seem to work. Let the init.el bisecting begin. Sorry for the noise. I'll let you know if I find anything relevant.

@tarsius

This comment has been minimized.

Copy link
Contributor Author

commented Nov 23, 2017

I can reproduce this with just:

  1. emacs -Q -L . --load swiper.el swiper.el --funcall outline-minor-mode --funcall reveal-mode --funcall outline-hide-entry
  2. M-x swiper RET
  3. ;;
  4. C-n

It appears that reveal-mode has the opposite effect of the intended effect when using swiper.

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Nov 24, 2017

Suggestions for a fix? I'm thinking about toggling reveal-mode off for the duration of swiper.

@tarsius

This comment has been minimized.

Copy link
Contributor Author

commented Nov 24, 2017

Well, that's what I was considering as a work-around 😛 And as an official solution I think it would be fine in the short-run. I cannot offer any advice on a better method at this time, but I am working on a little outline related package myself, so maybe after I have studied the relevant code a bit more I can come up with something.

@abo-abo abo-abo closed this in 23de224 Nov 24, 2017

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Nov 24, 2017

Thanks.

@tarsius

This comment has been minimized.

Copy link
Contributor Author

commented Nov 24, 2017

Thank you!

(I should have reported this way earlier - it was driving me crazy.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.