summaryrefslogtreecommitdiff
path: root/lisp/isearch.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2008-10-19 22:33:17 +0000
committerJuri Linkov <juri@jurta.org>2008-10-19 22:33:17 +0000
commit9d14752f314c2d4d02cb734a0959457a227bb2c1 (patch)
tree064b869ba6977736e593ae59fec2025bc6d3da9d /lisp/isearch.el
parent56b00ec786784001d0ee3c03a096809a31137527 (diff)
downloademacs-9d14752f314c2d4d02cb734a0959457a227bb2c1.tar.gz
(isearch-query-replace, isearch-query-replace-regexp):
Add arg `delimited' as in `query-replace' for the case when isearch-allow-scroll=t and the user types C-u M-%. Doc fix. Add more indicators to the prompt ("word" and "in region").
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r--lisp/isearch.el29
1 files changed, 20 insertions, 9 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 43ac20b635a..525106246d4 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1333,9 +1333,15 @@ Use `isearch-exit' to quit without signaling."
(sit-for 1)
(isearch-update))
-(defun isearch-query-replace (&optional regexp-flag)
- "Start `query-replace' with string to replace from last search string."
- (interactive)
+(defun isearch-query-replace (&optional delimited regexp-flag)
+ "Start `query-replace' with string to replace from last search string.
+The arg DELIMITED (prefix arg if interactive), if non-nil, means replace
+only matches surrounded by word boundaries. Note that using the prefix arg
+is possible only when `isearch-allow-scroll' is non-nil, and it don't
+always provides the correct matches for `query-replace', so the preferred
+way to run word replacements from Isearch is `M-s w ... M-%'."
+ (interactive
+ (list current-prefix-arg))
(barf-if-buffer-read-only)
(if regexp-flag (setq isearch-regexp t))
(let ((case-fold-search isearch-case-fold-search)
@@ -1356,16 +1362,21 @@ Use `isearch-exit' to quit without signaling."
isearch-string
(query-replace-read-to
isearch-string
- (if isearch-regexp "Query replace regexp" "Query replace")
+ (concat "Query replace"
+ (if (or delimited isearch-word) " word" "")
+ (if isearch-regexp " regexp" "")
+ (if (and transient-mark-mode mark-active) " in region" ""))
isearch-regexp)
- t isearch-regexp isearch-word nil nil
+ t isearch-regexp (or delimited isearch-word) nil nil
(if (and transient-mark-mode mark-active) (region-beginning))
(if (and transient-mark-mode mark-active) (region-end)))))
-(defun isearch-query-replace-regexp ()
- "Start `query-replace-regexp' with string to replace from last search string."
- (interactive)
- (isearch-query-replace t))
+(defun isearch-query-replace-regexp (&optional delimited)
+ "Start `query-replace-regexp' with string to replace from last search string.
+See `isearch-query-replace' for more information."
+ (interactive
+ (list current-prefix-arg))
+ (isearch-query-replace delimited t))
(defun isearch-occur (regexp &optional nlines)
"Run `occur' with regexp to search from the current search string.