diff options
| author | Eli Zaretskii | 2022-04-21 14:54:45 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2022-04-21 14:54:45 +0300 |
| commit | 16d1ab02af3335db38e596cfe8ff9c3d1db157ed (patch) | |
| tree | 855958a6450285613851cc20d7607b0f42771c59 | |
| parent | 4d4f5640ef0f1501bab174ae8d1b3759ba2b6ccc (diff) | |
| download | emacs-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.el | 14 | ||||
| -rw-r--r-- | lisp/emulation/viper-cmd.el | 7 | ||||
| -rw-r--r-- | lisp/isearch.el | 14 | ||||
| -rw-r--r-- | lisp/progmodes/ebrowse.el | 7 | ||||
| -rw-r--r-- | lisp/progmodes/etags.el | 8 | ||||
| -rw-r--r-- | lisp/progmodes/project.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/xref.el | 8 | ||||
| -rw-r--r-- | lisp/replace.el | 17 | ||||
| -rw-r--r-- | lisp/textmodes/reftex-global.el | 6 | ||||
| -rw-r--r-- | lisp/vc/vc-dir.el | 6 |
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. |
| 3174 | As each match is found, the user must type a character saying | ||
| 3175 | what to do with it. Type SPC or `y' to replace the match, | ||
| 3176 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 3177 | type \\[help-command] at that time. | ||
| 3178 | |||
| 3174 | Third arg DELIMITED (prefix arg) means replace only word-delimited matches. | 3179 | Third arg DELIMITED (prefix arg) means replace only word-delimited matches. |
| 3175 | If you exit (\\[keyboard-quit], RET or q), you can resume the query replace | 3180 | If you exit the query-replace loop (\\[keyboard-quit], RET or q), you can |
| 3176 | with the command \\[tags-loop-continue]." | 3181 | resume 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 | ||
| 3248 | As each match is found, the user must type a character saying | ||
| 3249 | what to do with it. Type SPC or `y' to replace the match, | ||
| 3250 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 3251 | type \\[help-command] at that time. | ||
| 3252 | |||
| 3243 | If no files are marked, use the file under point. | 3253 | If no files are marked, use the file under point. |
| 3244 | 3254 | ||
| 3245 | For any marked directory, matches in all of its files are replaced, | 3255 | For 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. |
| 4169 | If a null string is supplied as the string to be replaced, | 4169 | If a null string is supplied as the string to be replaced, |
| 4170 | the query replace mode will toggle between string replace | 4170 | the query replace mode will toggle between string replace |
| 4171 | and regexp replace." | 4171 | and regexp replace. |
| 4172 | |||
| 4173 | As each match is found, the user must type a character saying | ||
| 4174 | what to do with it. Type SPC or `y' to replace the match, | ||
| 4175 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 4176 | type \\[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 | |||
| 2324 | is possible only when `isearch-allow-scroll' is non-nil or | 2324 | is 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 |
| 2326 | correct matches for `query-replace', so the preferred way to run word | 2326 | correct matches for `query-replace', so the preferred way to run word |
| 2327 | replacements from Isearch is `M-s w ... M-%'." | 2327 | replacements from Isearch is `M-s w ... M-%'. |
| 2328 | |||
| 2329 | As each match is found, the user must type a character saying | ||
| 2330 | what to do with it. Type SPC or `y' to replace the match, | ||
| 2331 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 2332 | type \\[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 | |||
| 2393 | command was a regular expression search, REGEXP is the regular | 2398 | command was a regular expression search, REGEXP is the regular |
| 2394 | expression used in that search. If the last search command searched | 2399 | expression used in that search. If the last search command searched |
| 2395 | for a literal string, REGEXP is constructed by quoting all the special | 2400 | for a literal string, REGEXP is constructed by quoting all the special |
| 2396 | characters in that string." | 2401 | characters in that string. |
| 2402 | |||
| 2403 | As each match is found, the user must type a character saying | ||
| 2404 | what to do with it. Type SPC or `y' to replace the match, | ||
| 2405 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 2406 | type \\[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. |
| 3636 | With prefix arg, process files of marked classes only." | 3636 | With prefix arg, process files of marked classes only. |
| 3637 | |||
| 3638 | As each match is found, the user must type a character saying | ||
| 3639 | what to do with it. Type SPC or `y' to replace the match, | ||
| 3640 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 3641 | type \\[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." | |||
| 1836 | Third arg DELIMITED (prefix arg) means replace only word-delimited matches. | 1836 | Third arg DELIMITED (prefix arg) means replace only word-delimited matches. |
| 1837 | If you exit (\\[keyboard-quit], RET or q), you can resume the query replace | 1837 | If you exit (\\[keyboard-quit], RET or q), you can resume the query replace |
| 1838 | with the command \\[fileloop-continue]. | 1838 | with the command \\[fileloop-continue]. |
| 1839 | For non-interactive use, superseded by `fileloop-initialize-replace'." | 1839 | |
| 1840 | As each match is found, the user must type a character saying | ||
| 1841 | what to do with it. Type SPC or `y' to replace the match, | ||
| 1842 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 1843 | type \\[help-command] at that time. | ||
| 1844 | |||
| 1845 | For 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. |
| 1042 | Stops when a match is found and prompts for whether to replace it. | 1042 | Stops when a match is found and prompts for whether to replace it. |
| 1043 | At that prompt, the user must type a character saying what to do | ||
| 1044 | with the match. Type SPC or `y' to replace the match, | ||
| 1045 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 1046 | type \\[help-command] at that time. | ||
| 1043 | If you exit the `query-replace', you can later continue the | 1047 | If 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 | ||
| 703 | This command interactively replaces FROM with TO in the names of the | 703 | This command interactively replaces FROM with TO in the names of the |
| 704 | references displayed in the current *xref* buffer." | 704 | references displayed in the current *xref* buffer. |
| 705 | |||
| 706 | As each match is found, the user must type a character saying | ||
| 707 | what to do with it. Type SPC or `y' to replace the match, | ||
| 708 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 709 | type \\[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. |
| 359 | As each match is found, the user must type a character saying | 359 | As each match is found, the user must type a character saying |
| 360 | what to do with it. For directions, type \\[help-command] at that time. | 360 | what to do with it. Type SPC or `y' to replace the match, |
| 361 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 362 | type \\[help-command] at that time. | ||
| 361 | 363 | ||
| 362 | In Transient Mark mode, if the mark is active, operate on the contents | 364 | In Transient Mark mode, if the mark is active, operate on the contents |
| 363 | of the region. Otherwise, operate from point to the end of the buffer's | 365 | of 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. |
| 429 | As each match is found, the user must type a character saying | 431 | As each match is found, the user must type a character saying |
| 430 | what to do with it. For directions, type \\[help-command] at that time. | 432 | what to do with it. Type SPC or `y' to replace the match, |
| 433 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 434 | type \\[help-command] at that time. | ||
| 431 | 435 | ||
| 432 | In Transient Mark mode, if the mark is active, operate on the contents | 436 | In Transient Mark mode, if the mark is active, operate on the contents |
| 433 | of the region. Otherwise, operate from point to the end of the buffer's | 437 | of 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 | |||
| 524 | using `search-forward-regexp' and `replace-match' is preferred. | 528 | using `search-forward-regexp' and `replace-match' is preferred. |
| 525 | 529 | ||
| 526 | As each match is found, the user must type a character saying | 530 | As each match is found, the user must type a character saying |
| 527 | what to do with it. For directions, type \\[help-command] at that time. | 531 | what to do with it. Type SPC or `y' to replace the match, |
| 532 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 533 | type \\[help-command] at that time. | ||
| 528 | 534 | ||
| 529 | TO-EXPR is a Lisp expression evaluated to compute each replacement. It may | 535 | TO-EXPR is a Lisp expression evaluated to compute each replacement. It may |
| 530 | reference `replace-count' to get the number of replacements already made. | 536 | reference `replace-count' to get the number of replacements already made. |
| @@ -610,6 +616,11 @@ Use \\<minibuffer-local-map>\\[next-history-element] \ | |||
| 610 | to pull the last incremental search regexp to the minibuffer | 616 | to pull the last incremental search regexp to the minibuffer |
| 611 | that reads REGEXP. | 617 | that reads REGEXP. |
| 612 | 618 | ||
| 619 | As each match is found, the user must type a character saying | ||
| 620 | what to do with it. Type SPC or `y' to replace the match, | ||
| 621 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 622 | type \\[help-command] at that time. | ||
| 623 | |||
| 613 | A prefix argument N says to use each replacement string N times | 624 | A prefix argument N says to use each replacement string N times |
| 614 | before rotating to the next. | 625 | before rotating to the next. |
| 615 | Fourth and fifth arg START and END specify the region to operate on. | 626 | Fourth 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. |
| 90 | Third arg DELIMITED (prefix arg) means replace only word-delimited matches. | 90 | Third arg DELIMITED (prefix arg) means replace only word-delimited matches. |
| 91 | |||
| 92 | As each match is found, the user must type a character saying | ||
| 93 | what to do with it. Type SPC or `y' to replace the match, | ||
| 94 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 95 | type \\[help-command] at that time. | ||
| 96 | |||
| 91 | If you exit (\\[keyboard-quit], RET or q), you can resume the query replace | 97 | If you exit (\\[keyboard-quit], RET or q), you can resume the query replace |
| 92 | with the command \\[tags-loop-continue]. | 98 | with the command \\[tags-loop-continue]. |
| 93 | No active TAGS table is required." | 99 | No 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. |
| 934 | If a directory is marked, then use the files displayed for that directory. | 934 | If a directory is marked, then use the files displayed for that directory. |
| 935 | Third arg DELIMITED (prefix arg) means replace only word-delimited matches. | 935 | Third arg DELIMITED (prefix arg) means replace only word-delimited matches. |
| 936 | |||
| 937 | As each match is found, the user must type a character saying | ||
| 938 | what to do with it. Type SPC or `y' to replace the match, | ||
| 939 | DEL or `n' to skip and go to the next match. For more directions, | ||
| 940 | type \\[help-command] at that time. | ||
| 941 | |||
| 936 | If you exit (\\[keyboard-quit], RET or q), you can resume the query replace | 942 | If you exit (\\[keyboard-quit], RET or q), you can resume the query replace |
| 937 | with the command \\[tags-loop-continue]." | 943 | with 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 |