# HG changeset patch # User Richard M. Stallman # Date 1046897470 0 # Node ID 1ec92786c9eb14044cfae5c6a6ff526554a5df64 # Parent 82685b3c615d81e021e4eb4fa7bb66c31fce04be (query-replace-read-args): Use save-excursion. (map-query-replace-regexp): Use prefix-numeric-value. diff -r 82685b3c615d -r 1ec92786c9eb lisp/replace.el --- a/lisp/replace.el Wed Mar 05 16:33:42 2003 +0000 +++ b/lisp/replace.el Wed Mar 05 20:51:10 2003 +0000 @@ -70,10 +70,14 @@ (let (from to) (if query-replace-interactive (setq from (car (if regexp-flag regexp-search-ring search-ring))) - (setq from (read-from-minibuffer (format "%s: " string) - nil nil nil - query-replace-from-history-variable - nil t)) + ;; The save-excursion here is in case the user marks and copies + ;; a region in order to specify the minibuffer input. + ;; That should not clobber the region for the query-replace itself. + (save-excursion + (setq from (read-from-minibuffer (format "%s: " string) + nil nil nil + query-replace-from-history-variable + nil t))) ;; Warn if user types \n or \t, but don't reject the input. (if (string-match "\\\\[nt]" from) (let ((match (match-string 0 from))) @@ -84,9 +88,10 @@ (message "Note: `\\t' here doesn't match a tab; to do that, just type TAB"))) (sit-for 2)))) - (setq to (read-from-minibuffer (format "%s %s with: " string from) - nil nil nil - query-replace-to-history-variable from t)) + (save-excursion + (setq to (read-from-minibuffer (format "%s %s with: " string from) + nil nil nil + query-replace-to-history-variable from t))) (list from to current-prefix-arg))) (defun query-replace (from-string to-string &optional delimited start end) @@ -252,7 +257,9 @@ from) nil nil nil 'query-replace-history from t)) - (list from to current-prefix-arg + (list from to + (and current-prefix-arg + (prefix-numeric-value current-prefix-arg)) (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active)