diff options
Diffstat (limited to 'lisp/replace.el')
| -rw-r--r-- | lisp/replace.el | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 2c3aa9b0885..a2344d9f7e7 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -167,8 +167,6 @@ wants to replace FROM with TO." | |||
| 167 | ;; unavailable while preparing to dump. | 167 | ;; unavailable while preparing to dump. |
| 168 | (custom-reevaluate-setting 'query-replace-from-to-separator) | 168 | (custom-reevaluate-setting 'query-replace-from-to-separator) |
| 169 | (let* ((history-add-new-input nil) | 169 | (let* ((history-add-new-input nil) |
| 170 | (text-property-default-nonsticky | ||
| 171 | (cons '(separator . t) text-property-default-nonsticky)) | ||
| 172 | (separator | 170 | (separator |
| 173 | (when query-replace-from-to-separator | 171 | (when query-replace-from-to-separator |
| 174 | (propertize "\0" | 172 | (propertize "\0" |
| @@ -193,11 +191,18 @@ wants to replace FROM with TO." | |||
| 193 | ;; a region in order to specify the minibuffer input. | 191 | ;; a region in order to specify the minibuffer input. |
| 194 | ;; That should not clobber the region for the query-replace itself. | 192 | ;; That should not clobber the region for the query-replace itself. |
| 195 | (save-excursion | 193 | (save-excursion |
| 196 | (if regexp-flag | 194 | ;; The `with-current-buffer' ensures that the binding |
| 197 | (read-regexp prompt nil 'query-replace-from-to-history) | 195 | ;; for `text-property-default-nonsticky' isn't a buffer |
| 198 | (read-from-minibuffer | 196 | ;; local binding in the current buffer, which |
| 199 | prompt nil nil nil 'query-replace-from-to-history | 197 | ;; `read-from-minibuffer' wouldn't see. |
| 200 | (car (if regexp-flag regexp-search-ring search-ring)) t)))) | 198 | (with-current-buffer (window-buffer (minibuffer-window)) |
| 199 | (let ((text-property-default-nonsticky | ||
| 200 | (cons '(separator . t) text-property-default-nonsticky))) | ||
| 201 | (if regexp-flag | ||
| 202 | (read-regexp prompt nil 'query-replace-from-to-history) | ||
| 203 | (read-from-minibuffer | ||
| 204 | prompt nil nil nil 'query-replace-from-to-history | ||
| 205 | (car (if regexp-flag regexp-search-ring search-ring)) t)))))) | ||
| 201 | (to)) | 206 | (to)) |
| 202 | (if (and (zerop (length from)) query-replace-defaults) | 207 | (if (and (zerop (length from)) query-replace-defaults) |
| 203 | (cons (caar query-replace-defaults) | 208 | (cons (caar query-replace-defaults) |
| @@ -293,7 +298,8 @@ As each match is found, the user must type a character saying | |||
| 293 | what to do with it. For directions, type \\[help-command] at that time. | 298 | what to do with it. For directions, type \\[help-command] at that time. |
| 294 | 299 | ||
| 295 | In Transient Mark mode, if the mark is active, operate on the contents | 300 | In Transient Mark mode, if the mark is active, operate on the contents |
| 296 | of the region. Otherwise, operate from point to the end of the buffer. | 301 | of the region. Otherwise, operate from point to the end of the buffer's |
| 302 | accessible portion. | ||
| 297 | 303 | ||
| 298 | Use \\<minibuffer-local-map>\\[next-history-element] \ | 304 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 299 | to pull the last incremental search string to the minibuffer | 305 | to pull the last incremental search string to the minibuffer |
| @@ -355,7 +361,8 @@ As each match is found, the user must type a character saying | |||
| 355 | what to do with it. For directions, type \\[help-command] at that time. | 361 | what to do with it. For directions, type \\[help-command] at that time. |
| 356 | 362 | ||
| 357 | In Transient Mark mode, if the mark is active, operate on the contents | 363 | In Transient Mark mode, if the mark is active, operate on the contents |
| 358 | of the region. Otherwise, operate from point to the end of the buffer. | 364 | of the region. Otherwise, operate from point to the end of the buffer's |
| 365 | accessible portion. | ||
| 359 | 366 | ||
| 360 | Use \\<minibuffer-local-map>\\[next-history-element] \ | 367 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 361 | to pull the last incremental search regexp to the minibuffer | 368 | to pull the last incremental search regexp to the minibuffer |
| @@ -452,7 +459,8 @@ Use `\\#&' or `\\#N' if you want a number instead of a string. | |||
| 452 | In interactive use, `\\#' in itself stands for `replace-count'. | 459 | In interactive use, `\\#' in itself stands for `replace-count'. |
| 453 | 460 | ||
| 454 | In Transient Mark mode, if the mark is active, operate on the contents | 461 | In Transient Mark mode, if the mark is active, operate on the contents |
| 455 | of the region. Otherwise, operate from point to the end of the buffer. | 462 | of the region. Otherwise, operate from point to the end of the buffer's |
| 463 | accessible portion. | ||
| 456 | 464 | ||
| 457 | Use \\<minibuffer-local-map>\\[next-history-element] \ | 465 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 458 | to pull the last incremental search regexp to the minibuffer | 466 | to pull the last incremental search regexp to the minibuffer |
| @@ -507,7 +515,8 @@ each successive replacement uses the next successive replacement string, | |||
| 507 | wrapping around from the last such string to the first. | 515 | wrapping around from the last such string to the first. |
| 508 | 516 | ||
| 509 | In Transient Mark mode, if the mark is active, operate on the contents | 517 | In Transient Mark mode, if the mark is active, operate on the contents |
| 510 | of the region. Otherwise, operate from point to the end of the buffer. | 518 | of the region. Otherwise, operate from point to the end of the buffer's |
| 519 | accessible portion. | ||
| 511 | 520 | ||
| 512 | Non-interactively, TO-STRINGS may be a list of replacement strings. | 521 | Non-interactively, TO-STRINGS may be a list of replacement strings. |
| 513 | 522 | ||
| @@ -573,7 +582,7 @@ replace backward. | |||
| 573 | Operates on the region between START and END (if both are nil, from point | 582 | Operates on the region between START and END (if both are nil, from point |
| 574 | to the end of the buffer). Interactively, if Transient Mark mode is | 583 | to the end of the buffer). Interactively, if Transient Mark mode is |
| 575 | enabled and the mark is active, operates on the contents of the region; | 584 | enabled and the mark is active, operates on the contents of the region; |
| 576 | otherwise from point to the end of the buffer. | 585 | otherwise from point to the end of the buffer's accessible portion. |
| 577 | 586 | ||
| 578 | Use \\<minibuffer-local-map>\\[next-history-element] \ | 587 | Use \\<minibuffer-local-map>\\[next-history-element] \ |
| 579 | to pull the last incremental search string to the minibuffer | 588 | to pull the last incremental search string to the minibuffer |
| @@ -620,7 +629,8 @@ regexp in `search-whitespace-regexp'. | |||
| 620 | This function is not affected by `replace-character-fold' | 629 | This function is not affected by `replace-character-fold' |
| 621 | 630 | ||
| 622 | In Transient Mark mode, if the mark is active, operate on the contents | 631 | In Transient Mark mode, if the mark is active, operate on the contents |
| 623 | of the region. Otherwise, operate from point to the end of the buffer. | 632 | of the region. Otherwise, operate from point to the end of the buffer's |
| 633 | accessible portion. | ||
| 624 | 634 | ||
| 625 | Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace | 635 | Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace |
| 626 | only matches surrounded by word boundaries. A negative prefix arg means | 636 | only matches surrounded by word boundaries. A negative prefix arg means |