Subject: 27.1; Packages that customize xref-show-xrefs-function can break Dired's dired-do-find-regexp-and-replace
From: Daniel Martín <[email-masked]>
To: [email-masked]
Date: Fri, 27 Nov 2020 21:14:39 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Scenario: A package customizes xref-show-refs-function to use a
different UI to show xref results.  If that function does not return a
valid xref buffer, then Dired's dired-do-find-regexp-and-replace (bound
to Q by default) won't work anymore because it calls
xref-query-replace-in-results on the buffer returned by
xref--show-xrefs.

A workaround is that the package explicitly calls
xref--show-xref-buffer, which is done for example at
https://github.com/alexmurray/ivy-xref/commit/aa97103ea8ce6ab8891e34deff7d43aa83fe36dd,
but it doesn't feel like an ideal solution because of the duplicated
work.

Is there a way dired-do-find-regexp-and-replace could not depend on an
actual xref buffer to perform the replacement?