Subject: Re: bug#44905: 27.1; Packages that customize xref-show-xrefs-function can break Dired's dired-do-find-regexp-and-replace
From: Dmitry Gutov <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Tue, 1 Dec 2020 03:50:17 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 27.2

On 30.11.2020 17:26, Eli Zaretskii wrote:
>> Cc: [email-masked], Eli Zaretskii <[email-masked]>
>> From: Dmitry Gutov <[email-masked]>
>> Date: Mon, 30 Nov 2020 03:00:17 +0200
>>
>>>> diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
>>>> index 94a2bbf1f3..4caafc8df6 100644
>>>> --- a/lisp/dired-aux.el
>>>> +++ b/lisp/dired-aux.el
>>>> @@ -3140,7 +3140,10 @@ dired-do-find-regexp-and-replace
>>>>              (query-replace-read-args
>>>>               "Query replace regexp in marked files" t t)))
>>>>         (list (nth 0 common) (nth 1 common))))
>>>> -  (with-current-buffer (dired-do-find-regexp from)
>>>> +  (defvar xref-show-xrefs-function)
>>>> +  (with-current-buffer
>>>> +      (let ((xref-show-xrefs-function 'xref--show-xref-buffer))
>>>> +        (dired-do-find-regexp from))
>>>>        (xref-query-replace-in-results from to)))
>>>>
>>>>    (defun dired-nondirectory-p (file)
>>>
>>> LGTM, thanks.
>>
>> Eli, is this OK for Emacs 27.2?
> 
> Yes, thanks.
> 
>> Here's also a slightly more future-proofed version that avoids
>> referencing the function we might want to rename/change later:
> 
> That, too.

Thanks.

Pushed to the release branch (will get merged to master in due time), 
commit 749e4b7e0b.