;; unavailable while preparing to dump.
(custom-reevaluate-setting 'query-replace-from-to-separator)
(let* ((history-add-new-input nil)
- (text-property-default-nonsticky
- (cons '(separator . t) text-property-default-nonsticky))
(separator
(when query-replace-from-to-separator
(propertize "\0"
;; a region in order to specify the minibuffer input.
;; That should not clobber the region for the query-replace itself.
(save-excursion
- (if regexp-flag
- (read-regexp prompt nil 'query-replace-from-to-history)
- (read-from-minibuffer
- prompt nil nil nil 'query-replace-from-to-history
- (car (if regexp-flag regexp-search-ring search-ring)) t))))
+ ;; The `with-current-buffer' ensures that the binding
+ ;; for `text-property-default-nonsticky' isn't a buffer
+ ;; local binding in the current buffer, which
+ ;; `read-from-minibuffer' wouldn't see.
+ (with-current-buffer (window-buffer (minibuffer-window))
+ (let ((text-property-default-nonsticky
+ (cons '(separator . t) text-property-default-nonsticky)))
+ (if regexp-flag
+ (read-regexp prompt nil 'query-replace-from-to-history)
+ (read-from-minibuffer
+ prompt nil nil nil 'query-replace-from-to-history
+ (car (if regexp-flag regexp-search-ring search-ring)) t))))))
(to))
(if (and (zerop (length from)) query-replace-defaults)
(cons (caar query-replace-defaults)
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.
+of the region. Otherwise, operate from point to the end of the buffer's
+accessible portion.
Use \\<minibuffer-local-map>\\[next-history-element] \
to pull the last incremental search string to the minibuffer
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.
+of the region. Otherwise, operate from point to the end of the buffer's
+accessible portion.
Use \\<minibuffer-local-map>\\[next-history-element] \
to pull the last incremental search regexp to the minibuffer
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.
+of the region. Otherwise, operate from point to the end of the buffer's
+accessible portion.
Use \\<minibuffer-local-map>\\[next-history-element] \
to pull the last incremental search regexp to the minibuffer
wrapping around from the last such string to the first.
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.
+of the region. Otherwise, operate from point to the end of the buffer's
+accessible portion.
Non-interactively, TO-STRINGS may be a list of replacement strings.
Operates on the region between START and END (if both are nil, from point
to the end of the buffer). Interactively, if Transient Mark mode is
enabled and the mark is active, operates on the contents of the region;
-otherwise from point to the end of the buffer.
+otherwise from point to the end of the buffer's accessible portion.
Use \\<minibuffer-local-map>\\[next-history-element] \
to pull the last incremental search string to the minibuffer
This function is not affected by `replace-character-fold'
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.
+of the region. Otherwise, operate from point to the end of the buffer's
+accessible portion.
Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
only matches surrounded by word boundaries. A negative prefix arg means
(t :background "gray"))
"Face used to highlight matches permanently."
:group 'matching
+ :group 'basic-faces
:version "22.1")
(defcustom list-matching-lines-default-context-lines 0
new)))
(match-data integers reuse t)))
-(defun replace-match-maybe-edit (newtext fixedcase literal noedit match-data backward)
+(defun replace-match-maybe-edit (newtext fixedcase literal noedit match-data
+ &optional backward)
"Make a replacement with `replace-match', editing `\\?'.
FIXEDCASE, LITERAL are passed to `replace-match' (which see).
After possibly editing it (if `\\?' is present), NEWTEXT is also
passed to `replace-match'. If NOEDIT is true, no check for `\\?'
is made (to save time). MATCH-DATA is used for the replacement.
-In case editing is done, it is changed to use markers.
+In case editing is done, it is changed to use markers. BACKWARD is
+used to reverse the replacement direction.
The return value is non-nil if there has been no `\\?' or NOEDIT was
passed in. If LITERAL is set, no checking is done, anyway."
`re-search-forward'.")
(defun replace-search (search-string limit regexp-flag delimited-flag
- case-fold-search backward)
+ case-fold-search &optional backward)
"Search for the next occurrence of SEARCH-STRING to replace."
;; Let-bind global isearch-* variables to values used
;; to search the next replacement. These let-bindings
(defun replace-highlight (match-beg match-end range-beg range-end
search-string regexp-flag delimited-flag
- case-fold-search backward)
+ case-fold-search &optional backward)
(if query-replace-highlight
(if replace-overlay
(move-overlay replace-overlay match-beg match-end (current-buffer))