summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2016-04-02 14:51:33 -0700
committerJohn Wiegley <johnw@newartisans.com>2016-04-02 14:51:33 -0700
commit3d889773617a882fbee5992960cfe18866cddc34 (patch)
tree97ab033364dc4e00f789b5826a5880a2661e3caa /lisp/replace.el
parentf82248004d0f5ef84bbe03d83467bb3c43afa765 (diff)
parent7c1802f6ffc2704ba8042c7c1c6faa73dfa210d1 (diff)
downloademacs-3d889773617a882fbee5992960cfe18866cddc34.tar.gz
Merge from origin/emacs-25
7c1802f * doc/lispref/text.texi (Columns): Remove a nonexistent refer... 9034c50 * doc/man/emacsclient.1: Document +line:column option. 06495c9 Fix rare problems with echo-area display and multiple frames f99b512 In M-%, avoid making buffer-local binding of text-property-de...
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 2c6a23ae618..91e5db818f9 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -167,8 +167,6 @@ wants to replace FROM with TO."
;; 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"
@@ -193,11 +191,18 @@ wants to replace FROM with TO."
;; 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)