Subject: Re: bug#78520: 31.0.50; Performance issue in dired+isearch with dired-isearch-filenames

From: Juri Linkov <[email-masked]>
Date: Thu, 19 Jun 2025 09:59:09 +0300

>> `wdired-search-replace-filenames` is required anyway
>> since it also sets `replace-search-function`.
>
> Hmm - but we could also try to do this when query-replace is invoked.
> Similar to what we do when invoking isearch.
>
> Do we handle wdired differently only because of this problem?
>
> |  ;; Original dired hook removes dired-isearch-search-filenames that
> |  ;; is needed outside isearch for lazy-highlighting in query-replace.
> |  (remove-hook 'isearch-mode-hook #'dired-isearch-filenames-setup t)
>
> Maybe we could solve this in some other way?  Then, isearch and
> query-replace would just look whether filename only matching is enabled
> or not, and do the according setup when any of them is called by the
> user.

Could you try to remove all isearch-related code from wdired.el
and see how it reuses dired setup?  I tried, but query-replace
proposes to replace matches outside of filenames.  This is because
query-replace uses isearch functions, but dired-isearch-filenames-setup
is not called.