emacs-devel
[Top][All Lists]
Advanced

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

Re: Is it valid to call isearch-filter-predicate outside isearch?


From: Ihor Radchenko
Subject: Re: Is it valid to call isearch-filter-predicate outside isearch?
Date: Wed, 31 May 2023 14:38:33 +0000

Eli Zaretskii <eliz@gnu.org> writes:

>> I expected `isearch-filter-predicate' to be only used by isearch in
>> isearch-mode. And thus I expected `isearch-mode-end-hook' to be called
>> later.
>> 
>> Isn't it a natural expectation?
>
> Evidently, that ship sailed a long time ago: "grep isearch-" yields
> more than 60 hits in replace.el.  And then there are many hits in
> comint.el, dired-aux.el, info.el, and even in simple.el.

Sure. I have no issue with this. That's why I asked to add a word of
warning about the state of affairs to the docstring. It is not normal
that major mode-specific predicates are used elsewhere.

>> > (I also don't understand what does isearch-range-invisible have to do
>> > with this.)
>> 
>> `isearch-range-invisible' can modify `isearch-opened-overlays' and
>> `isearch-hidden' by side effect.
>
> Yes, but why it is relevant to your problem?

This was one of the reasons I thought that side effects are ok.

Also, the fact that `isearch-hidden' can be modified outside isearch
might yield edge cases when something like M-x query-replace calls
`isearch-range-invisible' that happens to set `isearch-hidden' to t.
Later, if there is a followup M-x isearch call, `isearch-hidden' will
remain t.

Modifying `isearch-opened-overlays' should not cause such interaction,
AFAIU. It is initialized to nil at the beginning of isearch.

-- 
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]