diff options
author | Juri Linkov <juri@jurta.org> | 2012-10-04 22:28:11 +0300 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2012-10-04 22:28:11 +0300 |
commit | 0e2ae83d4be1b7c54546125baf9357bd423fc776 (patch) | |
tree | d352dada8644699a9d8b094c9d09ea5e1482b267 /lisp/replace.el | |
parent | 93cacb6d08689703ff59d4bf720ce5ec21a62062 (diff) | |
download | emacs-0e2ae83d4be1b7c54546125baf9357bd423fc776.tar.gz |
* lisp/replace.el (query-replace-interactive): Declare obsolete.
(query-replace-read-from): Add the last incremental search string
to the list of default values accessible via M-n.
(map-query-replace-regexp): Use `read-regexp'.
(query-replace, query-replace-regexp, query-replace-regexp-eval)
(map-query-replace-regexp, replace-string, replace-regexp):
Fix docstrings to replace mentions of `query-replace-interactive'
with alternatives.
Fixes: debbugs:12526
Diffstat (limited to 'lisp/replace.el')
-rw-r--r-- | lisp/replace.el | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 82edb0037fb..e714015fccf 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -62,6 +62,10 @@ no default value.") (defvar query-replace-interactive nil "Non-nil means `query-replace' uses the last search string. That becomes the \"string to replace\".") +(make-obsolete-variable 'query-replace-interactive + "use `M-n' to pull the last incremental search string +to the minibuffer that reads the string to replace, or invoke replacements +from Isearch by using a key sequence like `C-s C-s M-%'." "24.3") (defcustom query-replace-from-history-variable 'query-replace-history "History list to use for the FROM argument of `query-replace' commands. @@ -142,7 +146,8 @@ wants to replace FROM with TO." (if regexp-flag (read-regexp prompt nil query-replace-from-history-variable) (read-from-minibuffer - prompt nil nil nil query-replace-from-history-variable nil t))))) + prompt nil nil nil query-replace-from-history-variable + (car (if regexp-flag regexp-search-ring search-ring)) t))))) (if (and (zerop (length from)) query-replace-defaults) (cons (car query-replace-defaults) (query-replace-compile-replacement @@ -231,9 +236,11 @@ what to do with it. For directions, type \\[help-command] at that time. In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer. -If `query-replace-interactive' is non-nil, the last incremental search -string is used as FROM-STRING--you don't have to specify it with the -minibuffer. +Use \\<minibuffer-local-map>\\[next-history-element] \ +to pull the last incremental search string to the minibuffer +that reads FROM-STRING, or invoke replacements from +incremental search with a key sequence like `C-s C-s M-%' +to use its current search string as the string to replace. Matching is independent of case if `case-fold-search' is non-nil and FROM-STRING has no uppercase letters. Replacement transfers the case @@ -279,9 +286,11 @@ what to do with it. For directions, type \\[help-command] at that time. In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer. -If `query-replace-interactive' is non-nil, the last incremental search -regexp is used as REGEXP--you don't have to specify it with the -minibuffer. +Use \\<minibuffer-local-map>\\[next-history-element] \ +to pull the last incremental search regexp to the minibuffer +that reads REGEXP, or invoke replacements from +incremental search with a key sequence like `C-M-s C-M-s C-M-%' +to use its current search regexp as the regexp to replace. Matching is independent of case if `case-fold-search' is non-nil and REGEXP has no uppercase letters. Replacement transfers the case @@ -364,9 +373,9 @@ In interactive use, `\\#' in itself stands for `replace-count'. In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer. -If `query-replace-interactive' is non-nil, the last incremental search -regexp is used as REGEXP--you don't have to specify it with the -minibuffer. +Use \\<minibuffer-local-map>\\[next-history-element] \ +to pull the last incremental search regexp to the minibuffer +that reads REGEXP. Preserves case in each replacement if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. @@ -417,19 +426,16 @@ of the region. Otherwise, operate from point to the end of the buffer. Non-interactively, TO-STRINGS may be a list of replacement strings. -If `query-replace-interactive' is non-nil, the last incremental search -regexp is used as REGEXP--you don't have to specify it with the minibuffer. +Use \\<minibuffer-local-map>\\[next-history-element] \ +to pull the last incremental search regexp to the minibuffer +that reads REGEXP. A prefix argument N says to use each replacement string N times before rotating to the next. Fourth and fifth arg START and END specify the region to operate on." (interactive - (let* ((from (if query-replace-interactive - (car regexp-search-ring) - (read-from-minibuffer "Map query replace (regexp): " - nil nil nil - query-replace-from-history-variable - nil t))) + (let* ((from (read-regexp "Map query replace (regexp): " nil + query-replace-from-history-variable)) (to (read-from-minibuffer (format "Query replace %s with (space-separated strings): " (query-replace-descr from)) @@ -475,9 +481,9 @@ Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. Fourth and fifth arg START and END specify the region to operate on. -If `query-replace-interactive' is non-nil, the last incremental search -string is used as FROM-STRING--you don't have to specify it with the -minibuffer. +Use \\<minibuffer-local-map>\\[next-history-element] \ +to pull the last incremental search string to the minibuffer +that reads FROM-STRING. This function is usually the wrong thing to use in a Lisp program. What you probably want is a loop like this: @@ -540,8 +546,9 @@ When using those Lisp features interactively in the replacement text, TO-STRING is actually made a list instead of a string. Use \\[repeat-complex-command] after this command for details. -If `query-replace-interactive' is non-nil, the last incremental search -regexp is used as REGEXP--you don't have to specify it with the minibuffer. +Use \\<minibuffer-local-map>\\[next-history-element] \ +to pull the last incremental search regexp to the minibuffer +that reads REGEXP. This function is usually the wrong thing to use in a Lisp program. What you probably want is a loop like this: |