diff options
| author | Juri Linkov | 2012-10-04 22:28:11 +0300 |
|---|---|---|
| committer | Juri Linkov | 2012-10-04 22:28:11 +0300 |
| commit | 0e2ae83d4be1b7c54546125baf9357bd423fc776 (patch) | |
| tree | d352dada8644699a9d8b094c9d09ea5e1482b267 /lisp/replace.el | |
| parent | 93cacb6d08689703ff59d4bf720ce5ec21a62062 (diff) | |
| download | emacs-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.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.") | |||
| 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. |
| 64 | That becomes the \"string to replace\".") | 64 | That becomes the \"string to replace\".") |
| 65 | (make-obsolete-variable 'query-replace-interactive | ||
| 66 | "use `M-n' to pull the last incremental search string | ||
| 67 | to the minibuffer that reads the string to replace, or invoke replacements | ||
| 68 | from 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. | |||
| 231 | In Transient Mark mode, if the mark is active, operate on the contents | 236 | In Transient Mark mode, if the mark is active, operate on the contents |
| 232 | of the region. Otherwise, operate from point to the end of the buffer. | 237 | of the region. Otherwise, operate from point to the end of the buffer. |
| 233 | 238 | ||
| 234 | If `query-replace-interactive' is non-nil, the last incremental search | 239 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 235 | string is used as FROM-STRING--you don't have to specify it with the | 240 | to pull the last incremental search string to the minibuffer |
| 236 | minibuffer. | 241 | that reads FROM-STRING, or invoke replacements from |
| 242 | incremental search with a key sequence like `C-s C-s M-%' | ||
| 243 | to use its current search string as the string to replace. | ||
| 237 | 244 | ||
| 238 | Matching is independent of case if `case-fold-search' is non-nil and | 245 | Matching is independent of case if `case-fold-search' is non-nil and |
| 239 | FROM-STRING has no uppercase letters. Replacement transfers the case | 246 | 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. | |||
| 279 | In Transient Mark mode, if the mark is active, operate on the contents | 286 | In Transient Mark mode, if the mark is active, operate on the contents |
| 280 | of the region. Otherwise, operate from point to the end of the buffer. | 287 | of the region. Otherwise, operate from point to the end of the buffer. |
| 281 | 288 | ||
| 282 | If `query-replace-interactive' is non-nil, the last incremental search | 289 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 283 | regexp is used as REGEXP--you don't have to specify it with the | 290 | to pull the last incremental search regexp to the minibuffer |
| 284 | minibuffer. | 291 | that reads REGEXP, or invoke replacements from |
| 292 | incremental search with a key sequence like `C-M-s C-M-s C-M-%' | ||
| 293 | to use its current search regexp as the regexp to replace. | ||
| 285 | 294 | ||
| 286 | Matching is independent of case if `case-fold-search' is non-nil and | 295 | Matching is independent of case if `case-fold-search' is non-nil and |
| 287 | REGEXP has no uppercase letters. Replacement transfers the case | 296 | REGEXP has no uppercase letters. Replacement transfers the case |
| @@ -364,9 +373,9 @@ In interactive use, `\\#' in itself stands for `replace-count'. | |||
| 364 | In Transient Mark mode, if the mark is active, operate on the contents | 373 | In Transient Mark mode, if the mark is active, operate on the contents |
| 365 | of the region. Otherwise, operate from point to the end of the buffer. | 374 | of the region. Otherwise, operate from point to the end of the buffer. |
| 366 | 375 | ||
| 367 | If `query-replace-interactive' is non-nil, the last incremental search | 376 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 368 | regexp is used as REGEXP--you don't have to specify it with the | 377 | to pull the last incremental search regexp to the minibuffer |
| 369 | minibuffer. | 378 | that reads REGEXP. |
| 370 | 379 | ||
| 371 | Preserves case in each replacement if `case-replace' and `case-fold-search' | 380 | Preserves case in each replacement if `case-replace' and `case-fold-search' |
| 372 | are non-nil and REGEXP has no uppercase letters. | 381 | 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. | |||
| 417 | 426 | ||
| 418 | Non-interactively, TO-STRINGS may be a list of replacement strings. | 427 | Non-interactively, TO-STRINGS may be a list of replacement strings. |
| 419 | 428 | ||
| 420 | If `query-replace-interactive' is non-nil, the last incremental search | 429 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 421 | regexp is used as REGEXP--you don't have to specify it with the minibuffer. | 430 | to pull the last incremental search regexp to the minibuffer |
| 431 | that reads REGEXP. | ||
| 422 | 432 | ||
| 423 | A prefix argument N says to use each replacement string N times | 433 | A prefix argument N says to use each replacement string N times |
| 424 | before rotating to the next. | 434 | before rotating to the next. |
| 425 | Fourth and fifth arg START and END specify the region to operate on." | 435 | Fourth 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 | |||
| 475 | only matches surrounded by word boundaries. | 481 | only matches surrounded by word boundaries. |
| 476 | Fourth and fifth arg START and END specify the region to operate on. | 482 | Fourth and fifth arg START and END specify the region to operate on. |
| 477 | 483 | ||
| 478 | If `query-replace-interactive' is non-nil, the last incremental search | 484 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 479 | string is used as FROM-STRING--you don't have to specify it with the | 485 | to pull the last incremental search string to the minibuffer |
| 480 | minibuffer. | 486 | that reads FROM-STRING. |
| 481 | 487 | ||
| 482 | This function is usually the wrong thing to use in a Lisp program. | 488 | This function is usually the wrong thing to use in a Lisp program. |
| 483 | What you probably want is a loop like this: | 489 | What you probably want is a loop like this: |
| @@ -540,8 +546,9 @@ When using those Lisp features interactively in the replacement | |||
| 540 | text, TO-STRING is actually made a list instead of a string. | 546 | text, TO-STRING is actually made a list instead of a string. |
| 541 | Use \\[repeat-complex-command] after this command for details. | 547 | Use \\[repeat-complex-command] after this command for details. |
| 542 | 548 | ||
| 543 | If `query-replace-interactive' is non-nil, the last incremental search | 549 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 544 | regexp is used as REGEXP--you don't have to specify it with the minibuffer. | 550 | to pull the last incremental search regexp to the minibuffer |
| 551 | that reads REGEXP. | ||
| 545 | 552 | ||
| 546 | This function is usually the wrong thing to use in a Lisp program. | 553 | This function is usually the wrong thing to use in a Lisp program. |
| 547 | What you probably want is a loop like this: | 554 | What you probably want is a loop like this: |