aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2022-04-21 14:54:45 +0300
committerEli Zaretskii2022-04-21 14:54:45 +0300
commit16d1ab02af3335db38e596cfe8ff9c3d1db157ed (patch)
tree855958a6450285613851cc20d7607b0f42771c59
parent4d4f5640ef0f1501bab174ae8d1b3759ba2b6ccc (diff)
downloademacs-16d1ab02af3335db38e596cfe8ff9c3d1db157ed.tar.gz
emacs-16d1ab02af3335db38e596cfe8ff9c3d1db157ed.zip
Add minimum instructions to 'query-replace' commands
* lisp/vc/vc-dir.el (vc-dir-query-replace-regexp): * lisp/textmodes/reftex-global.el (reftex-query-replace-document): * lisp/progmodes/project.el (project-query-replace-regexp): * lisp/progmodes/etags.el (tags-query-replace): * lisp/progmodes/ebrowse.el (ebrowse-tags-query-replace): * lisp/isearch.el (isearch-query-replace, isearch-occur): * lisp/emulation/viper-cmd.el (viper-query-replace): * lisp/dired-aux.el (dired-do-query-replace-regexp) (dired-do-find-regexp-and-replace): * lisp/progmodes/xref.el (xref-query-replace-in-results): * lisp/replace.el (query-replace, query-replace-regexp) (query-replace-regexp-eval, map-query-replace-regexp): Add minimal instructions for dealing with matches, with a link to the command that shows the full instructions. (Bug#55050)
-rw-r--r--lisp/dired-aux.el14
-rw-r--r--lisp/emulation/viper-cmd.el7
-rw-r--r--lisp/isearch.el14
-rw-r--r--lisp/progmodes/ebrowse.el7
-rw-r--r--lisp/progmodes/etags.el8
-rw-r--r--lisp/progmodes/project.el4
-rw-r--r--lisp/progmodes/xref.el8
-rw-r--r--lisp/replace.el17
-rw-r--r--lisp/textmodes/reftex-global.el6
-rw-r--r--lisp/vc/vc-dir.el6
10 files changed, 80 insertions, 11 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 57155ec26dc..f16568f9190 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -3171,9 +3171,14 @@ To continue searching for next match, use command \\[fileloop-continue]."
3171;;;###autoload 3171;;;###autoload
3172(defun dired-do-query-replace-regexp (from to &optional delimited) 3172(defun dired-do-query-replace-regexp (from to &optional delimited)
3173 "Do `query-replace-regexp' of FROM with TO, on all marked files. 3173 "Do `query-replace-regexp' of FROM with TO, on all marked files.
3174As each match is found, the user must type a character saying
3175what to do with it. Type SPC or `y' to replace the match,
3176DEL or `n' to skip and go to the next match. For more directions,
3177type \\[help-command] at that time.
3178
3174Third arg DELIMITED (prefix arg) means replace only word-delimited matches. 3179Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
3175If you exit (\\[keyboard-quit], RET or q), you can resume the query replace 3180If you exit the query-replace loop (\\[keyboard-quit], RET or q), you can
3176with the command \\[tags-loop-continue]." 3181resume the query replace with the command \\[tags-loop-continue]."
3177 (interactive 3182 (interactive
3178 (let ((common 3183 (let ((common
3179 (query-replace-read-args 3184 (query-replace-read-args
@@ -3240,6 +3245,11 @@ REGEXP should use constructs supported by your local `grep' command."
3240(defun dired-do-find-regexp-and-replace (from to) 3245(defun dired-do-find-regexp-and-replace (from to)
3241 "Replace matches of FROM with TO, in all marked files. 3246 "Replace matches of FROM with TO, in all marked files.
3242 3247
3248As each match is found, the user must type a character saying
3249what to do with it. Type SPC or `y' to replace the match,
3250DEL or `n' to skip and go to the next match. For more directions,
3251type \\[help-command] at that time.
3252
3243If no files are marked, use the file under point. 3253If no files are marked, use the file under point.
3244 3254
3245For any marked directory, matches in all of its files are replaced, 3255For any marked directory, matches in all of its files are replaced,
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 1f2f3ecfc38..e08d19c6115 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -4168,7 +4168,12 @@ cursor move past the beginning of line."
4168 "Query replace. 4168 "Query replace.
4169If a null string is supplied as the string to be replaced, 4169If a null string is supplied as the string to be replaced,
4170the query replace mode will toggle between string replace 4170the query replace mode will toggle between string replace
4171and regexp replace." 4171and regexp replace.
4172
4173As each match is found, the user must type a character saying
4174what to do with it. Type SPC or `y' to replace the match,
4175DEL or `n' to skip and go to the next match. For more directions,
4176type \\[help-command] at that time."
4172 (interactive) 4177 (interactive)
4173 (let (str) 4178 (let (str)
4174 (setq str (viper-read-string-with-history 4179 (setq str (viper-read-string-with-history
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 34e3b694754..d829744c3a4 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2324,7 +2324,12 @@ arg means replace backward. Note that using the prefix arg
2324is possible only when `isearch-allow-scroll' is non-nil or 2324is possible only when `isearch-allow-scroll' is non-nil or
2325`isearch-allow-prefix' is non-nil, and it doesn't always provide the 2325`isearch-allow-prefix' is non-nil, and it doesn't always provide the
2326correct matches for `query-replace', so the preferred way to run word 2326correct matches for `query-replace', so the preferred way to run word
2327replacements from Isearch is `M-s w ... M-%'." 2327replacements from Isearch is `M-s w ... M-%'.
2328
2329As each match is found, the user must type a character saying
2330what to do with it. Type SPC or `y' to replace the match,
2331DEL or `n' to skip and go to the next match. For more directions,
2332type \\[help-command] at that time."
2328 (interactive 2333 (interactive
2329 (list current-prefix-arg)) 2334 (list current-prefix-arg))
2330 (barf-if-buffer-read-only) 2335 (barf-if-buffer-read-only)
@@ -2393,7 +2398,12 @@ the search words, ignoring punctuation. If the last search
2393command was a regular expression search, REGEXP is the regular 2398command was a regular expression search, REGEXP is the regular
2394expression used in that search. If the last search command searched 2399expression used in that search. If the last search command searched
2395for a literal string, REGEXP is constructed by quoting all the special 2400for a literal string, REGEXP is constructed by quoting all the special
2396characters in that string." 2401characters in that string.
2402
2403As each match is found, the user must type a character saying
2404what to do with it. Type SPC or `y' to replace the match,
2405DEL or `n' to skip and go to the next match. For more directions,
2406type \\[help-command] at that time."
2397 (interactive 2407 (interactive
2398 (let* ((perform-collect (consp current-prefix-arg)) 2408 (let* ((perform-collect (consp current-prefix-arg))
2399 (regexp (cond 2409 (regexp (cond
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index 047d43a922b..dacb2a5f011 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -3633,7 +3633,12 @@ If regular expression is nil, repeat last search."
3633;;;###autoload 3633;;;###autoload
3634(defun ebrowse-tags-query-replace (from to) 3634(defun ebrowse-tags-query-replace (from to)
3635 "Query replace FROM with TO in all files of a class tree. 3635 "Query replace FROM with TO in all files of a class tree.
3636With prefix arg, process files of marked classes only." 3636With prefix arg, process files of marked classes only.
3637
3638As each match is found, the user must type a character saying
3639what to do with it. Type SPC or `y' to replace the match,
3640DEL or `n' to skip and go to the next match. For more directions,
3641type \\[help-command] at that time."
3637 (interactive 3642 (interactive
3638 "sTree query replace (regexp): \nsTree query replace %s by: ") 3643 "sTree query replace (regexp): \nsTree query replace %s by: ")
3639 (setq ebrowse-tags-loop-call 3644 (setq ebrowse-tags-loop-call
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 3826c1888d8..124817ffda4 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1836,7 +1836,13 @@ Also see the documentation of the `tags-file-name' variable."
1836Third arg DELIMITED (prefix arg) means replace only word-delimited matches. 1836Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
1837If you exit (\\[keyboard-quit], RET or q), you can resume the query replace 1837If you exit (\\[keyboard-quit], RET or q), you can resume the query replace
1838with the command \\[fileloop-continue]. 1838with the command \\[fileloop-continue].
1839For non-interactive use, superseded by `fileloop-initialize-replace'." 1839
1840As each match is found, the user must type a character saying
1841what to do with it. Type SPC or `y' to replace the match,
1842DEL or `n' to skip and go to the next match. For more directions,
1843type \\[help-command] at that time.
1844
1845For non-interactive use, this is superseded by `fileloop-initialize-replace'."
1840 (declare (advertised-calling-convention (from to &optional delimited) "27.1")) 1846 (declare (advertised-calling-convention (from to &optional delimited) "27.1"))
1841 (interactive (query-replace-read-args "Tags query replace (regexp)" t t)) 1847 (interactive (query-replace-read-args "Tags query replace (regexp)" t t))
1842 (fileloop-initialize-replace 1848 (fileloop-initialize-replace
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 1000e8c87f4..07093d61474 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1040,6 +1040,10 @@ command \\[fileloop-continue]."
1040(defun project-query-replace-regexp (from to) 1040(defun project-query-replace-regexp (from to)
1041 "Query-replace REGEXP in all the files of the project. 1041 "Query-replace REGEXP in all the files of the project.
1042Stops when a match is found and prompts for whether to replace it. 1042Stops when a match is found and prompts for whether to replace it.
1043At that prompt, the user must type a character saying what to do
1044with the match. Type SPC or `y' to replace the match,
1045DEL or `n' to skip and go to the next match. For more directions,
1046type \\[help-command] at that time.
1043If you exit the `query-replace', you can later continue the 1047If you exit the `query-replace', you can later continue the
1044`query-replace' loop using the command \\[fileloop-continue]." 1048`query-replace' loop using the command \\[fileloop-continue]."
1045 (interactive 1049 (interactive
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 2fd5e192376..c4b439f587c 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -701,7 +701,13 @@ quit the *xref* buffer."
701 "Perform interactive replacement of FROM with TO in all displayed xrefs. 701 "Perform interactive replacement of FROM with TO in all displayed xrefs.
702 702
703This command interactively replaces FROM with TO in the names of the 703This command interactively replaces FROM with TO in the names of the
704references displayed in the current *xref* buffer." 704references displayed in the current *xref* buffer.
705
706As each match is found, the user must type a character saying
707what to do with it. Type SPC or `y' to replace the match,
708DEL or `n' to skip and go to the next match. For more directions,
709type \\[help-command] at that time.
710"
705 (interactive 711 (interactive
706 (let ((fr (read-regexp "Xref query-replace (regexp)" ".*"))) 712 (let ((fr (read-regexp "Xref query-replace (regexp)" ".*")))
707 (list fr 713 (list fr
diff --git a/lisp/replace.el b/lisp/replace.el
index b1cfd7e3f42..dd1bdae4c54 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -357,7 +357,9 @@ should a regexp."
357(defun query-replace (from-string to-string &optional delimited start end backward region-noncontiguous-p) 357(defun query-replace (from-string to-string &optional delimited start end backward region-noncontiguous-p)
358 "Replace some occurrences of FROM-STRING with TO-STRING. 358 "Replace some occurrences of FROM-STRING with TO-STRING.
359As each match is found, the user must type a character saying 359As each match is found, the user must type a character saying
360what to do with it. For directions, type \\[help-command] at that time. 360what to do with it. Type SPC or `y' to replace the match,
361DEL or `n' to skip and go to the next match. For more directions,
362type \\[help-command] at that time.
361 363
362In Transient Mark mode, if the mark is active, operate on the contents 364In Transient Mark mode, if the mark is active, operate on the contents
363of the region. Otherwise, operate from point to the end of the buffer's 365of the region. Otherwise, operate from point to the end of the buffer's
@@ -427,7 +429,9 @@ To customize possible responses, change the bindings in `query-replace-map'."
427(defun query-replace-regexp (regexp to-string &optional delimited start end backward region-noncontiguous-p) 429(defun query-replace-regexp (regexp to-string &optional delimited start end backward region-noncontiguous-p)
428 "Replace some things after point matching REGEXP with TO-STRING. 430 "Replace some things after point matching REGEXP with TO-STRING.
429As each match is found, the user must type a character saying 431As each match is found, the user must type a character saying
430what to do with it. For directions, type \\[help-command] at that time. 432what to do with it. Type SPC or `y' to replace the match,
433DEL or `n' to skip and go to the next match. For more directions,
434type \\[help-command] at that time.
431 435
432In Transient Mark mode, if the mark is active, operate on the contents 436In Transient Mark mode, if the mark is active, operate on the contents
433of the region. Otherwise, operate from point to the end of the buffer's 437of the region. Otherwise, operate from point to the end of the buffer's
@@ -524,7 +528,9 @@ Interactive use of this function is deprecated in favor of the
524using `search-forward-regexp' and `replace-match' is preferred. 528using `search-forward-regexp' and `replace-match' is preferred.
525 529
526As each match is found, the user must type a character saying 530As each match is found, the user must type a character saying
527what to do with it. For directions, type \\[help-command] at that time. 531what to do with it. Type SPC or `y' to replace the match,
532DEL or `n' to skip and go to the next match. For more directions,
533type \\[help-command] at that time.
528 534
529TO-EXPR is a Lisp expression evaluated to compute each replacement. It may 535TO-EXPR is a Lisp expression evaluated to compute each replacement. It may
530reference `replace-count' to get the number of replacements already made. 536reference `replace-count' to get the number of replacements already made.
@@ -610,6 +616,11 @@ Use \\<minibuffer-local-map>\\[next-history-element] \
610to pull the last incremental search regexp to the minibuffer 616to pull the last incremental search regexp to the minibuffer
611that reads REGEXP. 617that reads REGEXP.
612 618
619As each match is found, the user must type a character saying
620what to do with it. Type SPC or `y' to replace the match,
621DEL or `n' to skip and go to the next match. For more directions,
622type \\[help-command] at that time.
623
613A prefix argument N says to use each replacement string N times 624A prefix argument N says to use each replacement string N times
614before rotating to the next. 625before rotating to the next.
615Fourth and fifth arg START and END specify the region to operate on. 626Fourth and fifth arg START and END specify the region to operate on.
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index a1aa368f609..c7e34b4b90a 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -88,6 +88,12 @@ No active TAGS table is required."
88(defun reftex-query-replace-document (&optional from to delimited) 88(defun reftex-query-replace-document (&optional from to delimited)
89 "Do `query-replace-regexp' of FROM with TO over the entire document. 89 "Do `query-replace-regexp' of FROM with TO over the entire document.
90Third arg DELIMITED (prefix arg) means replace only word-delimited matches. 90Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
91
92As each match is found, the user must type a character saying
93what to do with it. Type SPC or `y' to replace the match,
94DEL or `n' to skip and go to the next match. For more directions,
95type \\[help-command] at that time.
96
91If you exit (\\[keyboard-quit], RET or q), you can resume the query replace 97If you exit (\\[keyboard-quit], RET or q), you can resume the query replace
92with the command \\[tags-loop-continue]. 98with the command \\[tags-loop-continue].
93No active TAGS table is required." 99No active TAGS table is required."
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index b7315cfed54..18f5b07a7f4 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -933,6 +933,12 @@ To continue searching for next match, use command \\[tags-loop-continue]."
933 "Do `query-replace-regexp' of FROM with TO, on all marked files. 933 "Do `query-replace-regexp' of FROM with TO, on all marked files.
934If a directory is marked, then use the files displayed for that directory. 934If a directory is marked, then use the files displayed for that directory.
935Third arg DELIMITED (prefix arg) means replace only word-delimited matches. 935Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
936
937As each match is found, the user must type a character saying
938what to do with it. Type SPC or `y' to replace the match,
939DEL or `n' to skip and go to the next match. For more directions,
940type \\[help-command] at that time.
941
936If you exit (\\[keyboard-quit], RET or q), you can resume the query replace 942If you exit (\\[keyboard-quit], RET or q), you can resume the query replace
937with the command \\[tags-loop-continue]." 943with the command \\[tags-loop-continue]."
938 ;; FIXME: this is almost a copy of `dired-do-query-replace-regexp'. This 944 ;; FIXME: this is almost a copy of `dired-do-query-replace-regexp'. This