diff options
| author | Alan Mackenzie | 2016-03-29 09:53:12 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2016-03-29 09:53:12 +0000 |
| commit | f99b51295b86770e4b16d4717c0e73049191c4c5 (patch) | |
| tree | dee440ec9cdc88d58bbec2425e323b0381976596 /lisp | |
| parent | 124c48619e2c68c497d9075e6e940142c174c77b (diff) | |
| download | emacs-f99b51295b86770e4b16d4717c0e73049191c4c5.tar.gz emacs-f99b51295b86770e4b16d4717c0e73049191c4c5.zip | |
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')
| -rw-r--r-- | lisp/replace.el | 19 |
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." | |||
| 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) |