aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorJuri Linkov2012-10-04 22:28:11 +0300
committerJuri Linkov2012-10-04 22:28:11 +0300
commit0e2ae83d4be1b7c54546125baf9357bd423fc776 (patch)
treed352dada8644699a9d8b094c9d09ea5e1482b267 /lisp/replace.el
parent93cacb6d08689703ff59d4bf720ce5ec21a62062 (diff)
downloademacs-0e2ae83d4be1b7c54546125baf9357bd423fc776.tar.gz
emacs-0e2ae83d4be1b7c54546125baf9357bd423fc776.zip
* 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.el53
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.")
62(defvar query-replace-interactive nil 62(defvar query-replace-interactive nil
63 "Non-nil means `query-replace' uses the last search string. 63 "Non-nil means `query-replace' uses the last search string.
64That becomes the \"string to replace\".") 64That becomes the \"string to replace\".")
65(make-obsolete-variable 'query-replace-interactive
66 "use `M-n' to pull the last incremental search string
67to the minibuffer that reads the string to replace, or invoke replacements
68from Isearch by using a key sequence like `C-s C-s M-%'." "24.3")
65 69
66(defcustom query-replace-from-history-variable 'query-replace-history 70(defcustom query-replace-from-history-variable 'query-replace-history
67 "History list to use for the FROM argument of `query-replace' commands. 71 "History list to use for the FROM argument of `query-replace' commands.
@@ -142,7 +146,8 @@ wants to replace FROM with TO."
142 (if regexp-flag 146 (if regexp-flag
143 (read-regexp prompt nil query-replace-from-history-variable) 147 (read-regexp prompt nil query-replace-from-history-variable)
144 (read-from-minibuffer 148 (read-from-minibuffer
145 prompt nil nil nil query-replace-from-history-variable nil t))))) 149 prompt nil nil nil query-replace-from-history-variable
150 (car (if regexp-flag regexp-search-ring search-ring)) t)))))
146 (if (and (zerop (length from)) query-replace-defaults) 151 (if (and (zerop (length from)) query-replace-defaults)
147 (cons (car query-replace-defaults) 152 (cons (car query-replace-defaults)
148 (query-replace-compile-replacement 153 (query-replace-compile-replacement
@@ -231,9 +236,11 @@ what to do with it. For directions, type \\[help-command] at that time.
231In Transient Mark mode, if the mark is active, operate on the contents 236In Transient Mark mode, if the mark is active, operate on the contents
232of the region. Otherwise, operate from point to the end of the buffer. 237of the region. Otherwise, operate from point to the end of the buffer.
233 238
234If `query-replace-interactive' is non-nil, the last incremental search 239Use \\<minibuffer-local-map>\\[next-history-element] \
235string is used as FROM-STRING--you don't have to specify it with the 240to pull the last incremental search string to the minibuffer
236minibuffer. 241that reads FROM-STRING, or invoke replacements from
242incremental search with a key sequence like `C-s C-s M-%'
243to use its current search string as the string to replace.
237 244
238Matching is independent of case if `case-fold-search' is non-nil and 245Matching is independent of case if `case-fold-search' is non-nil and
239FROM-STRING has no uppercase letters. Replacement transfers the case 246FROM-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.
279In Transient Mark mode, if the mark is active, operate on the contents 286In Transient Mark mode, if the mark is active, operate on the contents
280of the region. Otherwise, operate from point to the end of the buffer. 287of the region. Otherwise, operate from point to the end of the buffer.
281 288
282If `query-replace-interactive' is non-nil, the last incremental search 289Use \\<minibuffer-local-map>\\[next-history-element] \
283regexp is used as REGEXP--you don't have to specify it with the 290to pull the last incremental search regexp to the minibuffer
284minibuffer. 291that reads REGEXP, or invoke replacements from
292incremental search with a key sequence like `C-M-s C-M-s C-M-%'
293to use its current search regexp as the regexp to replace.
285 294
286Matching is independent of case if `case-fold-search' is non-nil and 295Matching is independent of case if `case-fold-search' is non-nil and
287REGEXP has no uppercase letters. Replacement transfers the case 296REGEXP has no uppercase letters. Replacement transfers the case
@@ -364,9 +373,9 @@ In interactive use, `\\#' in itself stands for `replace-count'.
364In Transient Mark mode, if the mark is active, operate on the contents 373In Transient Mark mode, if the mark is active, operate on the contents
365of the region. Otherwise, operate from point to the end of the buffer. 374of the region. Otherwise, operate from point to the end of the buffer.
366 375
367If `query-replace-interactive' is non-nil, the last incremental search 376Use \\<minibuffer-local-map>\\[next-history-element] \
368regexp is used as REGEXP--you don't have to specify it with the 377to pull the last incremental search regexp to the minibuffer
369minibuffer. 378that reads REGEXP.
370 379
371Preserves case in each replacement if `case-replace' and `case-fold-search' 380Preserves case in each replacement if `case-replace' and `case-fold-search'
372are non-nil and REGEXP has no uppercase letters. 381are 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.
417 426
418Non-interactively, TO-STRINGS may be a list of replacement strings. 427Non-interactively, TO-STRINGS may be a list of replacement strings.
419 428
420If `query-replace-interactive' is non-nil, the last incremental search 429Use \\<minibuffer-local-map>\\[next-history-element] \
421regexp is used as REGEXP--you don't have to specify it with the minibuffer. 430to pull the last incremental search regexp to the minibuffer
431that reads REGEXP.
422 432
423A prefix argument N says to use each replacement string N times 433A prefix argument N says to use each replacement string N times
424before rotating to the next. 434before rotating to the next.
425Fourth and fifth arg START and END specify the region to operate on." 435Fourth and fifth arg START and END specify the region to operate on."
426 (interactive 436 (interactive
427 (let* ((from (if query-replace-interactive 437 (let* ((from (read-regexp "Map query replace (regexp): " nil
428 (car regexp-search-ring) 438 query-replace-from-history-variable))
429 (read-from-minibuffer "Map query replace (regexp): "
430 nil nil nil
431 query-replace-from-history-variable
432 nil t)))
433 (to (read-from-minibuffer 439 (to (read-from-minibuffer
434 (format "Query replace %s with (space-separated strings): " 440 (format "Query replace %s with (space-separated strings): "
435 (query-replace-descr from)) 441 (query-replace-descr from))
@@ -475,9 +481,9 @@ Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
475only matches surrounded by word boundaries. 481only matches surrounded by word boundaries.
476Fourth and fifth arg START and END specify the region to operate on. 482Fourth and fifth arg START and END specify the region to operate on.
477 483
478If `query-replace-interactive' is non-nil, the last incremental search 484Use \\<minibuffer-local-map>\\[next-history-element] \
479string is used as FROM-STRING--you don't have to specify it with the 485to pull the last incremental search string to the minibuffer
480minibuffer. 486that reads FROM-STRING.
481 487
482This function is usually the wrong thing to use in a Lisp program. 488This function is usually the wrong thing to use in a Lisp program.
483What you probably want is a loop like this: 489What you probably want is a loop like this:
@@ -540,8 +546,9 @@ When using those Lisp features interactively in the replacement
540text, TO-STRING is actually made a list instead of a string. 546text, TO-STRING is actually made a list instead of a string.
541Use \\[repeat-complex-command] after this command for details. 547Use \\[repeat-complex-command] after this command for details.
542 548
543If `query-replace-interactive' is non-nil, the last incremental search 549Use \\<minibuffer-local-map>\\[next-history-element] \
544regexp is used as REGEXP--you don't have to specify it with the minibuffer. 550to pull the last incremental search regexp to the minibuffer
551that reads REGEXP.
545 552
546This function is usually the wrong thing to use in a Lisp program. 553This function is usually the wrong thing to use in a Lisp program.
547What you probably want is a loop like this: 554What you probably want is a loop like this: