[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: |
Fri, 02 Jun 2023 09:07:04 +0000 |
Michael Heerdegen <michael_heerdegen@web.de> writes:
>> Surely not. `post-command-hook' is triggered after each
>> `self-insert-command' during isearch/query-replace.
>
> Of course the idea is not to so something blindly. One could check
> whether isearch is still active and which overlays need to be kept.
This may work for isearch, but not in query-replace, evil, swiper and
other places where isearch machinery is used. Or I will have to keep
things up-to-date against every new user of isearch machinery. Not good
idea, IMHO.
>> I had to advice `isearch-clean-overlays', which appears to be called by
>> all the users of `isearch-filter-predicate' (replace-regexp, evil-mode,
>> and swipet). Still a workaround. Ugly.
>
> Hmm. Maybe the optimum.
>
> BTW, did you consider to :before advice the local variable
> `isearch-filter-predicate' instead of overwriting it? That would be a
> bit nicer for users and other modes that also need to change it.
Do you refer to
(add-function :before (local 'isearch-filter-predicate) #'foo)
?
Two reasons:
1. I only vaguely understand how this works
2. It feels against the interface. If advising this predicate is
expected, why not convert it into an abnormal hook?
--
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>
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Eli Zaretskii, 2023/06/01
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Juri Linkov, 2023/06/01
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Ihor Radchenko, 2023/06/01
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Juri Linkov, 2023/06/01
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Michael Heerdegen, 2023/06/01
- Re: Is it valid to call isearch-filter-predicate outside isearch?,
Ihor Radchenko <=
- RE: [External] : Re: Is it valid to call isearch-filter-predicate outside isearch?, Drew Adams, 2023/06/02
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Michael Heerdegen, 2023/06/02
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Ihor Radchenko, 2023/06/03
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Michael Heerdegen, 2023/06/03
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Ihor Radchenko, 2023/06/17
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Michael Heerdegen, 2023/06/17
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Ihor Radchenko, 2023/06/18
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Michael Heerdegen, 2023/06/03
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Ihor Radchenko, 2023/06/18
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Michael Heerdegen, 2023/06/18