unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Unknown <unknown@unknown.invalid>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 44905@debbugs.gnu.org
Subject: bug#44905: 27.1; Packages that customize xref-show-xrefs-function can break Dired's dired-do-find-regexp-and-replace
Date: Sun, 29 Nov 2020 13:57:14 +0100	[thread overview]
Message-ID: <m14kl8z5g5.fsf@yahoo.es> (raw)
In-Reply-To: <7ab2afb1-33ec-bca0-4014-131130e71a04@yandex.ru> (Dmitry Gutov's message of "Sat, 28 Nov 2020 21:04:53 +0200")

Dmitry Gutov <dgutov@yandex.ru> writes:
>
> While this change in the Right Thing(tm), I have to question the
> wisdom of setting xref-show-xrefs-function to an Ivy or Helm-based
> function, though. Those UIs serve to help you choose one item, whereas
> commands like dired-do-find-regexp and project-find-regexp show the
> user a list of matches, to interact with (usually) several of them.

I agree with you, Ivy/Helm may not be the best UX for Xref, but this
particular problem can still happen even if the user returns a buffer
that represents the Xref data in a different way.  I think that
xref-query-replace-in-results assumes certain invariants from the
original *xref* buffer that are not documented.

>
> 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.





  reply	other threads:[~2020-11-29 12:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m1zh32imkw.fsf.ref@yahoo.es>
2020-11-27 20:14 ` bug#44905: 27.1; Packages that customize xref-show-xrefs-function can break Dired's dired-do-find-regexp-and-replace Unknown
2020-11-28 19:04   ` Dmitry Gutov
2020-11-29 12:57     ` Unknown [this message]
2020-11-30  1:00       ` Dmitry Gutov
2020-11-30 15:26         ` Eli Zaretskii
2020-12-01  1:50           ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m14kl8z5g5.fsf@yahoo.es \
    --to=unknown@unknown.invalid \
    --cc=44905@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).