summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2016-03-29 09:53:12 +0000
committerAlan Mackenzie <acm@muc.de>2016-03-29 09:53:12 +0000
commitf99b51295b86770e4b16d4717c0e73049191c4c5 (patch)
treedee440ec9cdc88d58bbec2425e323b0381976596 /lisp/replace.el
parent124c48619e2c68c497d9075e6e940142c174c77b (diff)
downloademacs-f99b51295b86770e4b16d4717c0e73049191c4c5.tar.gz
In M-%, avoid making buffer-local binding of text-property-default-nonsticky
This would happen when that variable already has a buffer local binding. Such a binding would not be seen by read-from-minibuffer. This fixes bug #23127. * lisp/replace.el (query-replace-read-from): Move the binding of text-property-default-nonsticky to inside of a new with-current-buffer buffer form with the minibuffer as argument.
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 428be3c3b65..a2344d9f7e7 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)