diff options
| author | Juri Linkov | 2012-09-21 00:57:13 +0300 |
|---|---|---|
| committer | Juri Linkov | 2012-09-21 00:57:13 +0300 |
| commit | eb2deaffd17e760b3ec945c58d43080e8a44767a (patch) | |
| tree | 76bf1cbd8109f7975159bcec98bdaad2191a4547 /lisp/replace.el | |
| parent | 5825610b41a7cf18f52c3d891ffb8c2a8359b1a0 (diff) | |
| download | emacs-eb2deaffd17e760b3ec945c58d43080e8a44767a.tar.gz emacs-eb2deaffd17e760b3ec945c58d43080e8a44767a.zip | |
* lisp/replace.el (query-replace-read-from): Use `read-regexp' instead
of `read-from-minibuffer' when `regexp-flag' is non-nil.
(occur-read-primary-args): Use `read-regexp' instead of
`read-string'.
(multi-occur-in-matching-buffers): Use `read-regexp' instead of
`read-from-minibuffer'.
* lisp/isearch.el (isearch-occur): Use `read-regexp' instead of
`read-string'.
* lisp/dired.el (dired-read-regexp): Use `read-regexp' instead of
`read-from-minibuffer'.
* lisp/progmodes/grep.el (grep-read-regexp): Use `read-regexp' instead
of `read-string'.
Fixes: debbugs:7567
Diffstat (limited to 'lisp/replace.el')
| -rw-r--r-- | lisp/replace.el | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 435c6c2fb60..f192574a7e2 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -128,20 +128,21 @@ wants to replace FROM with TO." | |||
| 128 | (if query-replace-interactive | 128 | (if query-replace-interactive |
| 129 | (car (if regexp-flag regexp-search-ring search-ring)) | 129 | (car (if regexp-flag regexp-search-ring search-ring)) |
| 130 | (let* ((history-add-new-input nil) | 130 | (let* ((history-add-new-input nil) |
| 131 | (prompt | ||
| 132 | (if query-replace-defaults | ||
| 133 | (format "%s (default %s -> %s): " prompt | ||
| 134 | (query-replace-descr (car query-replace-defaults)) | ||
| 135 | (query-replace-descr (cdr query-replace-defaults))) | ||
| 136 | (format "%s: " prompt))) | ||
| 131 | (from | 137 | (from |
| 132 | ;; The save-excursion here is in case the user marks and copies | 138 | ;; The save-excursion here is in case the user marks and copies |
| 133 | ;; a region in order to specify the minibuffer input. | 139 | ;; a region in order to specify the minibuffer input. |
| 134 | ;; That should not clobber the region for the query-replace itself. | 140 | ;; That should not clobber the region for the query-replace itself. |
| 135 | (save-excursion | 141 | (save-excursion |
| 136 | (read-from-minibuffer | 142 | (if regexp-flag |
| 137 | (if query-replace-defaults | 143 | (read-regexp prompt nil query-replace-from-history-variable) |
| 138 | (format "%s (default %s -> %s): " prompt | 144 | (read-from-minibuffer |
| 139 | (query-replace-descr (car query-replace-defaults)) | 145 | prompt nil nil nil query-replace-from-history-variable nil t))))) |
| 140 | (query-replace-descr (cdr query-replace-defaults))) | ||
| 141 | (format "%s: " prompt)) | ||
| 142 | nil nil nil | ||
| 143 | query-replace-from-history-variable | ||
| 144 | nil t)))) | ||
| 145 | (if (and (zerop (length from)) query-replace-defaults) | 146 | (if (and (zerop (length from)) query-replace-defaults) |
| 146 | (cons (car query-replace-defaults) | 147 | (cons (car query-replace-defaults) |
| 147 | (query-replace-compile-replacement | 148 | (query-replace-compile-replacement |
| @@ -1139,9 +1140,9 @@ which means to discard all text properties." | |||
| 1139 | "\\&" | 1140 | "\\&" |
| 1140 | ;; Get the regexp for collection pattern. | 1141 | ;; Get the regexp for collection pattern. |
| 1141 | (let ((default (car occur-collect-regexp-history))) | 1142 | (let ((default (car occur-collect-regexp-history))) |
| 1142 | (read-string | 1143 | (read-regexp |
| 1143 | (format "Regexp to collect (default %s): " default) | 1144 | (format "Regexp to collect (default %s): " default) |
| 1144 | nil 'occur-collect-regexp-history default))) | 1145 | default 'occur-collect-regexp-history))) |
| 1145 | ;; Otherwise normal occur takes numerical prefix argument. | 1146 | ;; Otherwise normal occur takes numerical prefix argument. |
| 1146 | (when current-prefix-arg | 1147 | (when current-prefix-arg |
| 1147 | (prefix-numeric-value current-prefix-arg)))))) | 1148 | (prefix-numeric-value current-prefix-arg)))))) |
| @@ -1228,14 +1229,10 @@ See also `multi-occur'." | |||
| 1228 | (cons | 1229 | (cons |
| 1229 | (let* ((default (car regexp-history)) | 1230 | (let* ((default (car regexp-history)) |
| 1230 | (input | 1231 | (input |
| 1231 | (read-from-minibuffer | 1232 | (read-regexp |
| 1232 | (if current-prefix-arg | 1233 | (if current-prefix-arg |
| 1233 | "List lines in buffers whose names match regexp: " | 1234 | "List lines in buffers whose names match regexp: " |
| 1234 | "List lines in buffers whose filenames match regexp: ") | 1235 | "List lines in buffers whose filenames match regexp: ")))) |
| 1235 | nil | ||
| 1236 | nil | ||
| 1237 | nil | ||
| 1238 | 'regexp-history))) | ||
| 1239 | (if (equal input "") | 1236 | (if (equal input "") |
| 1240 | default | 1237 | default |
| 1241 | input)) | 1238 | input)) |