aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el36
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
293what to do with it. For directions, type \\[help-command] at that time. 298what to do with it. For directions, type \\[help-command] at that time.
294 299
295In Transient Mark mode, if the mark is active, operate on the contents 300In Transient Mark mode, if the mark is active, operate on the contents
296of the region. Otherwise, operate from point to the end of the buffer. 301of the region. Otherwise, operate from point to the end of the buffer's
302accessible portion.
297 303
298Use \\<minibuffer-local-map>\\[next-history-element] \ 304Use \\<minibuffer-local-map>\\[next-history-element] \
299to pull the last incremental search string to the minibuffer 305to 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
355what to do with it. For directions, type \\[help-command] at that time. 361what to do with it. For directions, type \\[help-command] at that time.
356 362
357In Transient Mark mode, if the mark is active, operate on the contents 363In Transient Mark mode, if the mark is active, operate on the contents
358of the region. Otherwise, operate from point to the end of the buffer. 364of the region. Otherwise, operate from point to the end of the buffer's
365accessible portion.
359 366
360Use \\<minibuffer-local-map>\\[next-history-element] \ 367Use \\<minibuffer-local-map>\\[next-history-element] \
361to pull the last incremental search regexp to the minibuffer 368to 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.
452In interactive use, `\\#' in itself stands for `replace-count'. 459In interactive use, `\\#' in itself stands for `replace-count'.
453 460
454In Transient Mark mode, if the mark is active, operate on the contents 461In Transient Mark mode, if the mark is active, operate on the contents
455of the region. Otherwise, operate from point to the end of the buffer. 462of the region. Otherwise, operate from point to the end of the buffer's
463accessible portion.
456 464
457Use \\<minibuffer-local-map>\\[next-history-element] \ 465Use \\<minibuffer-local-map>\\[next-history-element] \
458to pull the last incremental search regexp to the minibuffer 466to pull the last incremental search regexp to the minibuffer
@@ -507,7 +515,8 @@ each successive replacement uses the next successive replacement string,
507wrapping around from the last such string to the first. 515wrapping around from the last such string to the first.
508 516
509In Transient Mark mode, if the mark is active, operate on the contents 517In Transient Mark mode, if the mark is active, operate on the contents
510of the region. Otherwise, operate from point to the end of the buffer. 518of the region. Otherwise, operate from point to the end of the buffer's
519accessible portion.
511 520
512Non-interactively, TO-STRINGS may be a list of replacement strings. 521Non-interactively, TO-STRINGS may be a list of replacement strings.
513 522
@@ -573,7 +582,7 @@ replace backward.
573Operates on the region between START and END (if both are nil, from point 582Operates on the region between START and END (if both are nil, from point
574to the end of the buffer). Interactively, if Transient Mark mode is 583to the end of the buffer). Interactively, if Transient Mark mode is
575enabled and the mark is active, operates on the contents of the region; 584enabled and the mark is active, operates on the contents of the region;
576otherwise from point to the end of the buffer. 585otherwise from point to the end of the buffer's accessible portion.
577 586
578Use \\<minibuffer-local-map>\\[next-history-element] \ 587Use \\<minibuffer-local-map>\\[next-history-element] \
579to pull the last incremental search string to the minibuffer 588to pull the last incremental search string to the minibuffer
@@ -620,7 +629,8 @@ regexp in `search-whitespace-regexp'.
620This function is not affected by `replace-character-fold' 629This function is not affected by `replace-character-fold'
621 630
622In Transient Mark mode, if the mark is active, operate on the contents 631In Transient Mark mode, if the mark is active, operate on the contents
623of the region. Otherwise, operate from point to the end of the buffer. 632of the region. Otherwise, operate from point to the end of the buffer's
633accessible portion.
624 634
625Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace 635Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
626only matches surrounded by word boundaries. A negative prefix arg means 636only matches surrounded by word boundaries. A negative prefix arg means