From ba6df554755e1989670e23220d2d14bc8e389274 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 6 Sep 2021 17:07:25 +0300 Subject: [PATCH] Fixup dired-do-find-regexp-and-replace * lisp/dired-aux.el (dired-do-find-regexp-and-replace): Disregard the customized value of xref-auto-jump-to-first-xref (it breaks the xref-query-replace-in-results invocation). * lisp/progmodes/xref.el (xref-auto-jump-to-first-xref): Mention the caveat for users or xref distributed through ELPA. --- lisp/dired-aux.el | 5 ++++- lisp/progmodes/xref.el | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 8e00af8f96b..c7286429179 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3245,10 +3245,13 @@ REGEXP should use constructs supported by your local `grep' command." (list (nth 0 common) (nth 1 common)))) (require 'xref) (defvar xref-show-xrefs-function) + (defvar xref-auto-jump-to-first-xref) (with-current-buffer (let ((xref-show-xrefs-function ;; Some future-proofing (bug#44905). - (custom--standard-value 'xref-show-xrefs-function))) + (custom--standard-value 'xref-show-xrefs-function)) + ;; Disable auto-jumping, it will mess up replacement logic. + xref-auto-jump-to-first-xref) (dired-do-find-regexp from)) (xref-query-replace-in-results from to))) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index ec8b05d2943..d022baaf04c 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -432,7 +432,10 @@ focus on the Xref buffer's window. "If t, xref commands always jump to the first result. `show' means to show the first result's location, but keep the focus on the Xref buffer's window. -`move' means to only move point to the first result." +`move' means to only move point to the first result. + +Please be careful changing this value if you are using Emacs 27 +or earlier: it can break dired-do-find-regexp-and-replace." :type '(choice (const :tag "Jump" t) (const :tag "Show" show) (const :tag "Move point only" move) -- 2.39.2