bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Ihor Radchenko
Subject: bug#64178: replace-regexp ignoring value of org-search-invisible
Date: Fri, 23 Jun 2023 10:46:09 +0000

Juri Linkov <juri@linkov.net> writes:

>> It is natural to expect that zero-width matches are considered invisible
>> when the surrounding text is invisible.
>>
>> Also, is this documented anywhere?
>
> This corner case doesn't seem to be documented.  Probably not for
> emacs-29, but something like this would require more testing:
>
> ...
>  (defun isearch-range-invisible (beg end)
>    "Return t if all the text from BEG to END is invisible."
> -  (when (/= beg end)
> +  (when t

`when' becomes redundant here.
The rest of the patch looks reasonable.

The patch makes sense in general, although the patch will not solve the
particular scenario we have here.

In my reproducer, we have

(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?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]