[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: |
Sat, 17 Jun 2023 13:05:52 +0000 |
Michael Heerdegen <michael_heerdegen@web.de> writes:
>> May you please elaborate? I am not sure what `kill-variable' calls you
>> are referring to here.
>
> To those in `wdired-change-to-dired-mode:
>
> #+begin_src emacs-lisp
> (when wdired-search-replace-filenames
> (remove-function (local 'isearch-search-fun-function)
> #'dired-isearch-search-filenames)
> (kill-local-variable 'replace-search-function)
> (kill-local-variable 'replace-re-search-function)
> ;; Restore dired hook
> (add-hook 'isearch-mode-hook #'dired-isearch-filenames-setup nil t))
> #+end_src
>
> This demonstrates a problem when not using an advice: to get rid of the
> temporary new binding you simply kill the local variable, but this can
> be problematic, especially when we did not create it (but maybe someone
> third).
The code above is indeed slightly problematic.
I'd store the old value somewhere in such situations and restore later.
May `define-advice' be modified to work on variable values? That way,
one can override the variable value and later restore the old one using
the existing machinery.
--
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?, (continued)
- 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, 2023/06/02
- 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 <=
- 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
- Re: Is it valid to call isearch-filter-predicate outside isearch?, Ihor Radchenko, 2023/06/19
Re: Is it valid to call isearch-filter-predicate outside isearch?, Ihor Radchenko, 2023/06/01