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.
This commit is contained in:
parent
124c48619e
commit
f99b51295b
1 changed files with 12 additions and 7 deletions
|
@ -167,8 +167,6 @@ wants to replace FROM with TO."
|
||||||
;; unavailable while preparing to dump.
|
;; unavailable while preparing to dump.
|
||||||
(custom-reevaluate-setting 'query-replace-from-to-separator)
|
(custom-reevaluate-setting 'query-replace-from-to-separator)
|
||||||
(let* ((history-add-new-input nil)
|
(let* ((history-add-new-input nil)
|
||||||
(text-property-default-nonsticky
|
|
||||||
(cons '(separator . t) text-property-default-nonsticky))
|
|
||||||
(separator
|
(separator
|
||||||
(when query-replace-from-to-separator
|
(when query-replace-from-to-separator
|
||||||
(propertize "\0"
|
(propertize "\0"
|
||||||
|
@ -193,11 +191,18 @@ wants to replace FROM with TO."
|
||||||
;; a region in order to specify the minibuffer input.
|
;; a region in order to specify the minibuffer input.
|
||||||
;; That should not clobber the region for the query-replace itself.
|
;; That should not clobber the region for the query-replace itself.
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
;; 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
|
(if regexp-flag
|
||||||
(read-regexp prompt nil 'query-replace-from-to-history)
|
(read-regexp prompt nil 'query-replace-from-to-history)
|
||||||
(read-from-minibuffer
|
(read-from-minibuffer
|
||||||
prompt nil nil nil 'query-replace-from-to-history
|
prompt nil nil nil 'query-replace-from-to-history
|
||||||
(car (if regexp-flag regexp-search-ring search-ring)) t))))
|
(car (if regexp-flag regexp-search-ring search-ring)) t))))))
|
||||||
(to))
|
(to))
|
||||||
(if (and (zerop (length from)) query-replace-defaults)
|
(if (and (zerop (length from)) query-replace-defaults)
|
||||||
(cons (caar query-replace-defaults)
|
(cons (caar query-replace-defaults)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue