aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 451650401b1..33162b02d3c 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1,7 +1,7 @@
1;;; replace.el --- replace commands for Emacs 1;;; replace.el --- replace commands for Emacs
2 2
3;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1996, 1997, 2000, 2001, 2002, 3;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1996, 1997, 2000, 2001,
4;; 2003, 2004, 2005 Free Software Foundation, Inc. 4;; 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
5 5
6;; Maintainer: FSF 6;; Maintainer: FSF
7 7
@@ -88,7 +88,7 @@ is highlighted lazily using isearch lazy highlighting (see
88(defun query-replace-descr (string) 88(defun query-replace-descr (string)
89 (mapconcat 'isearch-text-char-description string "")) 89 (mapconcat 'isearch-text-char-description string ""))
90 90
91(defun query-replace-read-from (string regexp-flag) 91(defun query-replace-read-from (prompt regexp-flag)
92 "Query and return the `from' argument of a query-replace operation. 92 "Query and return the `from' argument of a query-replace operation.
93The return value can also be a pair (FROM . TO) indicating that the user 93The return value can also be a pair (FROM . TO) indicating that the user
94wants to replace FROM with TO." 94wants to replace FROM with TO."
@@ -107,10 +107,10 @@ wants to replace FROM with TO."
107 query-replace-from-history-variable)))) 107 query-replace-from-history-variable))))
108 (read-from-minibuffer 108 (read-from-minibuffer
109 (if (and lastto lastfrom) 109 (if (and lastto lastfrom)
110 (format "%s (default %s -> %s): " string 110 (format "%s (default %s -> %s): " prompt
111 (query-replace-descr lastfrom) 111 (query-replace-descr lastfrom)
112 (query-replace-descr lastto)) 112 (query-replace-descr lastto))
113 (format "%s: " string)) 113 (format "%s: " prompt))
114 nil nil nil 114 nil nil nil
115 query-replace-from-history-variable 115 query-replace-from-history-variable
116 nil t t)))) 116 nil t t))))
@@ -173,22 +173,22 @@ the original string if not."
173 to)) 173 to))
174 174
175 175
176(defun query-replace-read-to (from string regexp-flag) 176(defun query-replace-read-to (from prompt regexp-flag)
177 "Query and return the `to' argument of a query-replace operation." 177 "Query and return the `to' argument of a query-replace operation."
178 (query-replace-compile-replacement 178 (query-replace-compile-replacement
179 (save-excursion 179 (save-excursion
180 (read-from-minibuffer 180 (read-from-minibuffer
181 (format "%s %s with: " string (query-replace-descr from)) 181 (format "%s %s with: " prompt (query-replace-descr from))
182 nil nil nil 182 nil nil nil
183 query-replace-to-history-variable from t t)) 183 query-replace-to-history-variable from t t))
184 regexp-flag)) 184 regexp-flag))
185 185
186(defun query-replace-read-args (string regexp-flag &optional noerror) 186(defun query-replace-read-args (prompt regexp-flag &optional noerror)
187 (unless noerror 187 (unless noerror
188 (barf-if-buffer-read-only)) 188 (barf-if-buffer-read-only))
189 (let* ((from (query-replace-read-from string regexp-flag)) 189 (let* ((from (query-replace-read-from prompt regexp-flag))
190 (to (if (consp from) (prog1 (cdr from) (setq from (car from))) 190 (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
191 (query-replace-read-to from string regexp-flag)))) 191 (query-replace-read-to from prompt regexp-flag))))
192 (list from to current-prefix-arg))) 192 (list from to current-prefix-arg)))
193 193
194(defun query-replace (from-string to-string &optional delimited start end) 194(defun query-replace (from-string to-string &optional delimited start end)
@@ -1061,6 +1061,8 @@ See also `multi-occur'."
1061 title-face prefix-face match-face keep-props) 1061 title-face prefix-face match-face keep-props)
1062 (with-current-buffer out-buf 1062 (with-current-buffer out-buf
1063 (let ((globalcount 0) 1063 (let ((globalcount 0)
1064 ;; Don't generate undo entries for creation of the initial contents.
1065 (buffer-undo-list t)
1064 (coding nil)) 1066 (coding nil))
1065 ;; Map over all the buffers 1067 ;; Map over all the buffers
1066 (dolist (buf buffers) 1068 (dolist (buf buffers)