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.
This commit is contained in:
Dmitry Gutov 2021-09-06 17:07:25 +03:00
parent 9ff425d16f
commit ba6df55475
2 changed files with 8 additions and 2 deletions

View file

@ -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)))

View file

@ -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)