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
Ensure that isearch can see through overlays added by magit-section #3999
Conversation
One thing I haven't figured out, however, is how to make the reveal persistent. After I complete a search that revealed a section, that section is immediately hidden again. |
Problems:
There's nothing we can do about (3). To address (1) and (2) isearch would have to be taught to call I am not gonna do that myself any time soon and if I do, then I would do so for swiper instead because that's what I use. |
Would you like me to merge this as-is? |
313f6fe
to
ef85630
Compare
Probably not; 2 should be fixed. I don't want to merge a partly broken feature in.
It's easy to do that, actually: (defun magit-section-open-invisible (overlay hide)
"Show or HIDE the section corresponding to OVERLAY."
(when-let ((section (overlay-get overlay 'magit-section)))
(if hide (magit-section-hide section) (magit-section-show section))))
…
(overlay-put o 'magit-section section)
(overlay-put o 'isearch-open-invisible-temporary #'magit-section-open-invisible) But the issue is that |
d2401a8
to
d58d520
Compare
I've just pushed my implementation. For Isearch this should work already. Swiper users have to wait until abo-abo/swiper#2689 is merged. |
👏 👍 🙇 |
Done; I think three weeks was long enough. |
Thanks a lot for all your hard work on magit.
I'd like to be able to use isearch in
magit-status
buffers. This feature would be useful when splitting a large change into multiple commits, to ensure that I haven't forgotten to commit part of a change.For example, in the course of working on a feature, I might rename an identifier throughout my project. When I'm done with the rename and the change, I'll use selective staging to create a commit including only the rename. To make sure I include all lines affected by the rename, I currently press
TAB
on all files in the "Unstaged changes" section, and then use isearch to look for the renamed symbol. If I don't reveal the diffs for all files, isearch can't search through them, it seems.Based on https://www.gnu.org/software/emacs/manual/html_node/elisp/Invisible-Text.html and looking at how org-mode handles this case (org-mode reveals hidden text when it contains an isearch match), I think the right implementation would be to set a non-nil
isearch-open-invisible
property on the overlays used to hide diffs in magit-status.I have done this in this PR.