Subject: 30.1; evaluating isearch-forward to invisible text in org-mode breaks folding

From: Brett <[email-masked]>
Date: Fri, 16 May 2025 17:23:47 +0200

Create a 3-line file named foobar.org containing exactly this:

* foo
** bar
baz

(So the first character of the file is *.)  Type

emacs -Q foobar.org

and type

TAB M-: (isearch-forward) RET b RET

(this folds everything, then calls the isearch-forward function, searches
for b which will unfold everything and position the point on the second
line).  Now type TAB: this should fold the second heading only, but it will
fold everything.  And in fact you can try moving around and pressing TAB
again as many times as you want: you will never be able to fold only the
second heading again.

Note that replacing

M-: (isearch-forward)

in the above sequence with

M-x isearch-forward

does NOT trigger the bug, instead it does produce the desired behaviour.

In GNU Emacs 30.1 (build 1, x86_64-redhat-linux-gnu, X toolkit, cairo
version 1.18.2, Xaw3d scroll bars) of 2025-04-08 built on
801fee700660491d8dc8419bf4a7391e