Steamline xref-query-replace-in-results
* lisp/progmodes/xref.el (xref-query-replace-in-results): Steamline the most common scenario (https://lists.gnu.org/archive/html/emacs-devel/2022-01/msg00864.html).
This commit is contained in:
parent
4e1bf9bf48
commit
b2cc03d572
2 changed files with 17 additions and 4 deletions
4
etc/NEWS
4
etc/NEWS
|
@ -594,6 +594,10 @@ to enable the display of the buffer list.
|
|||
It is bound to 'C-M-,' and jumps to the location where 'xref-go-back'
|
||||
('M-,', also known as 'xref-pop-marker-stack') was invoked previously.
|
||||
|
||||
*** 'xref-query-replace-in-results' only prompts for TO when called
|
||||
without prefix argument, to make the most common case faster:
|
||||
replacing all matches entirely.
|
||||
|
||||
** File notifications
|
||||
|
||||
+++
|
||||
|
|
|
@ -738,11 +738,20 @@ quit the *xref* buffer."
|
|||
"Perform interactive replacement of FROM with TO in all displayed xrefs.
|
||||
|
||||
This command interactively replaces FROM with TO in the names of the
|
||||
references displayed in the current *xref* buffer."
|
||||
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."
|
||||
(interactive
|
||||
(let ((fr (read-regexp "Xref query-replace (regexp)" ".*")))
|
||||
(list fr
|
||||
(read-regexp (format "Xref query-replace (regexp) %s with: " fr)))))
|
||||
(let* ((fr
|
||||
(if prefix-arg
|
||||
(read-regexp "Query-replace (regexp)" ".*")
|
||||
".*"))
|
||||
(prompt (if prefix-arg
|
||||
(format "Query-replace (regexp) %s with: " fr)
|
||||
"Query-replace all matches with: ")))
|
||||
(list fr (read-regexp prompt))))
|
||||
(let* (item xrefs iter)
|
||||
(save-excursion
|
||||
(while (setq item (xref--search-property 'xref-item))
|
||||
|
|
Loading…
Add table
Reference in a new issue