emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44905: closed (27.1; Packages that customize xref-show-xrefs-functio


From: GNU bug Tracking System
Subject: bug#44905: closed (27.1; Packages that customize xref-show-xrefs-function can break Dired's dired-do-find-regexp-and-replace)
Date: Tue, 01 Dec 2020 01:51:02 +0000

Your message dated Tue, 1 Dec 2020 03:50:17 +0200
with message-id <30fac4c6-be23-aab5-503f-77a750dd8044@yandex.ru>
and subject line Re: bug#44905: 27.1; Packages that customize 
xref-show-xrefs-function can break Dired's dired-do-find-regexp-and-replace
has caused the debbugs.gnu.org bug report #44905,
regarding 27.1; Packages that customize xref-show-xrefs-function can break 
Dired's dired-do-find-regexp-and-replace
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
44905: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=44905
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 27.1; Packages that customize xref-show-xrefs-function can break Dired's dired-do-find-regexp-and-replace Date: Fri, 27 Nov 2020 21:14:39 +0100
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?



--- End Message ---
--- Begin Message --- Subject: Re: bug#44905: 27.1; Packages that customize xref-show-xrefs-function can break Dired's dired-do-find-regexp-and-replace Date: Tue, 1 Dec 2020 03:50:17 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0
Version: 27.2

On 30.11.2020 17:26, Eli Zaretskii wrote:
Cc: 44905@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
From: Dmitry Gutov <dgutov@yandex.ru>
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.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]