aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorKenichi Handa2012-09-30 23:39:46 +0900
committerKenichi Handa2012-09-30 23:39:46 +0900
commitc194970e15b6d6efa07697679a25dfab3aa76442 (patch)
tree49aec8be9d2dcc74ad3c81f562e48308d8e27b75 /lisp/replace.el
parent95402d5faa114a311cabfb8c64cf22a93787a066 (diff)
parentdd946752ab8810149a66a3eff469eb128709972d (diff)
downloademacs-c194970e15b6d6efa07697679a25dfab3aa76442.tar.gz
emacs-c194970e15b6d6efa07697679a25dfab3aa76442.zip
merge trunk
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el46
1 files changed, 22 insertions, 24 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index f192574a7e2..82edb0037fb 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -378,35 +378,33 @@ regexp in `search-whitespace-regexp'.
378Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace 378Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
379only matches that are surrounded by word boundaries. 379only matches that are surrounded by word boundaries.
380Fourth and fifth arg START and END specify the region to operate on." 380Fourth and fifth arg START and END specify the region to operate on."
381 (declare (obsolete "use the `\\,' feature of `query-replace-regexp'
382for interactive calls, and `search-forward-regexp'/`replace-match'
383for Lisp calls." "22.1"))
381 (interactive 384 (interactive
382 (progn 385 (progn
383 (barf-if-buffer-read-only) 386 (barf-if-buffer-read-only)
384 (let* ((from 387 (let* ((from
385 ;; Let-bind the history var to disable the "foo -> bar" default. 388 ;; Let-bind the history var to disable the "foo -> bar"
386 ;; Maybe we shouldn't disable this default, but for now I'll 389 ;; default. Maybe we shouldn't disable this default, but
387 ;; leave it off. --Stef 390 ;; for now I'll leave it off. --Stef
388 (let ((query-replace-to-history-variable nil)) 391 (let ((query-replace-to-history-variable nil))
389 (query-replace-read-from "Query replace regexp" t))) 392 (query-replace-read-from "Query replace regexp" t)))
390 (to (list (read-from-minibuffer 393 (to (list (read-from-minibuffer
391 (format "Query replace regexp %s with eval: " 394 (format "Query replace regexp %s with eval: "
392 (query-replace-descr from)) 395 (query-replace-descr from))
393 nil nil t query-replace-to-history-variable from t)))) 396 nil nil t query-replace-to-history-variable from t))))
394 ;; We make TO a list because replace-match-string-symbols requires one, 397 ;; We make TO a list because replace-match-string-symbols requires one,
395 ;; and the user might enter a single token. 398 ;; and the user might enter a single token.
396 (replace-match-string-symbols to) 399 (replace-match-string-symbols to)
397 (list from (car to) current-prefix-arg 400 (list from (car to) current-prefix-arg
398 (if (and transient-mark-mode mark-active) 401 (if (and transient-mark-mode mark-active)
399 (region-beginning)) 402 (region-beginning))
400 (if (and transient-mark-mode mark-active) 403 (if (and transient-mark-mode mark-active)
401 (region-end)))))) 404 (region-end))))))
402 (perform-replace regexp (cons 'replace-eval-replacement to-expr) 405 (perform-replace regexp (cons 'replace-eval-replacement to-expr)
403 t 'literal delimited nil nil start end)) 406 t 'literal delimited nil nil start end))
404 407
405(make-obsolete 'query-replace-regexp-eval
406 "for interactive use, use the special `\\,' feature of
407`query-replace-regexp' instead. Non-interactively, a loop
408using `search-forward-regexp' and `replace-match' is preferred." "22.1")
409
410(defun map-query-replace-regexp (regexp to-strings &optional n start end) 408(defun map-query-replace-regexp (regexp to-strings &optional n start end)
411 "Replace some matches for REGEXP with various strings, in rotation. 409 "Replace some matches for REGEXP with various strings, in rotation.
412The second argument TO-STRINGS contains the replacement strings, separated 410The second argument TO-STRINGS contains the replacement strings, separated