I have one big org file. Sometimes I only want to search for a regular expression through the visible text, not the text that is folded; otherwise my search will take much longer.
How can I search for a regex match in only visible portion of a buffer?
I thought if a macro like with-visible-text
existed it would be ideal. So something like (with-visible-text (re-search-forward "some regexp" nil t))
would search through only visible text.
I have tried to get hints on how to do this with forward-visible-line
.
And I've seen I things like look promising like (next-single-property-change (point) 'invisible)
which gives the the position of the next point that's not invisible. So I'm thinking maybe the solution to this is using re-search-forward
with a boundaries which contain only visible regions.