1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 11:00:45 -08:00

; Clarify correct use of 'xref-query-replace-in-results'

* lisp/progmodes/xref.el (xref--query-replace-1): Improve the
user-error message.
(xref-query-replace-in-results): Clarify restrictions in the doc
string.

* doc/emacs/maintaining.texi (Xref Commands, Identifier Search):
Clarify the correct usage of 'xref-query-replace-in-results'.
This commit is contained in:
Eli Zaretskii 2022-10-10 11:05:18 +03:00
parent f91ae94790
commit e016e60a04
2 changed files with 24 additions and 13 deletions

View file

@ -751,17 +751,22 @@ quit the *xref* buffer."
(defun xref-query-replace-in-results (from to)
"Perform interactive replacement of FROM with TO in all displayed xrefs.
This command interactively replaces FROM with TO in the names of the
This function interactively replaces FROM with TO in the names of the
references displayed in the current *xref* buffer.
When called interactively, it uses '.*' as FROM, which means
replace the whole name. Unless called with prefix argument, in
which case the user is prompted for both FROM and TO.
When called interactively, it uses '.*' as FROM, which means replace
the whole name, and prompts the user for TO.
If invoked with prefix argument, it prompts the user for both FROM and TO.
As each match is found, the user must type a character saying
what to do with it. Type SPC or `y' to replace the match,
DEL or `n' to skip and go to the next match. For more directions,
type \\[help-command] at that time."
type \\[help-command] at that time.
Note that this function cannot be used in *xref* buffers that show
a partial list of all references, such as the *xref* buffer created
by \\[xref-find-definitions] and its variants, since those list only
some of the references to the identifiers."
(interactive
(let* ((fr
(if current-prefix-arg
@ -891,7 +896,8 @@ ITEMS is an xref item which " ; FIXME: Expand documentation.
(setq pairs (cdr buf-pairs))
(setq continue
(perform-replace from to t t nil nil multi-query-replace-map)))
(unless did-it-once (user-error "No suitable matches here"))
(unless did-it-once
(user-error "Cannot use subset of matches for global renaming"))
(when (and continue (not buf-pairs))
(message "All results processed"))))