Subject: bug#64178: replace-regexp ignoring value of org-search-invisible

From: Juri Linkov <[email-masked]>
Date: Thu, 29 May 2025 09:22:57 +0300

> (defun test()<invisible begin>\n\t"This is test")\n<invisible end>\n
>
> Note how the first newline after test() is hidden.
>
> With the patch, Emacs will perform replacement at the final "\n" only,
> while users will expect that "$" belongs to the previous visible line.
> Similarly, "^"/"\<" are expected to match the next visible line/symbol.
>
> While I do understand that the way Emacs will treat the above is
> logical (albeit not intuitive), but may it be possible to make
> interactive isearch use closer to what users expect?

This is a reminder that this old bug report still can't be fixed
as long as outlines make the newline of the heading line invisible
instead of hiding the last newline of the last line.

The same problem was discussed in bug#59141 and bug#65896.
And a possible solution is to add a variable that shifts the
overlay by 1 character.  When this change has no problems,
later it could be enabled by default.