diff options
| author | Juri Linkov | 2008-10-19 22:33:17 +0000 |
|---|---|---|
| committer | Juri Linkov | 2008-10-19 22:33:17 +0000 |
| commit | 9d14752f314c2d4d02cb734a0959457a227bb2c1 (patch) | |
| tree | 064b869ba6977736e593ae59fec2025bc6d3da9d | |
| parent | 56b00ec786784001d0ee3c03a096809a31137527 (diff) | |
| download | emacs-9d14752f314c2d4d02cb734a0959457a227bb2c1.tar.gz emacs-9d14752f314c2d4d02cb734a0959457a227bb2c1.zip | |
(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").
| -rw-r--r-- | lisp/isearch.el | 29 |
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." | |||
| 1333 | (sit-for 1) | 1333 | (sit-for 1) |
| 1334 | (isearch-update)) | 1334 | (isearch-update)) |
| 1335 | 1335 | ||
| 1336 | (defun isearch-query-replace (&optional regexp-flag) | 1336 | (defun isearch-query-replace (&optional delimited regexp-flag) |
| 1337 | "Start `query-replace' with string to replace from last search string." | 1337 | "Start `query-replace' with string to replace from last search string. |
| 1338 | (interactive) | 1338 | The arg DELIMITED (prefix arg if interactive), if non-nil, means replace |
| 1339 | only matches surrounded by word boundaries. Note that using the prefix arg | ||
| 1340 | is possible only when `isearch-allow-scroll' is non-nil, and it don't | ||
| 1341 | always provides the correct matches for `query-replace', so the preferred | ||
| 1342 | way to run word replacements from Isearch is `M-s w ... M-%'." | ||
| 1343 | (interactive | ||
| 1344 | (list current-prefix-arg)) | ||
| 1339 | (barf-if-buffer-read-only) | 1345 | (barf-if-buffer-read-only) |
| 1340 | (if regexp-flag (setq isearch-regexp t)) | 1346 | (if regexp-flag (setq isearch-regexp t)) |
| 1341 | (let ((case-fold-search isearch-case-fold-search) | 1347 | (let ((case-fold-search isearch-case-fold-search) |
| @@ -1356,16 +1362,21 @@ Use `isearch-exit' to quit without signaling." | |||
| 1356 | isearch-string | 1362 | isearch-string |
| 1357 | (query-replace-read-to | 1363 | (query-replace-read-to |
| 1358 | isearch-string | 1364 | isearch-string |
| 1359 | (if isearch-regexp "Query replace regexp" "Query replace") | 1365 | (concat "Query replace" |
| 1366 | (if (or delimited isearch-word) " word" "") | ||
| 1367 | (if isearch-regexp " regexp" "") | ||
| 1368 | (if (and transient-mark-mode mark-active) " in region" "")) | ||
| 1360 | isearch-regexp) | 1369 | isearch-regexp) |
| 1361 | t isearch-regexp isearch-word nil nil | 1370 | t isearch-regexp (or delimited isearch-word) nil nil |
| 1362 | (if (and transient-mark-mode mark-active) (region-beginning)) | 1371 | (if (and transient-mark-mode mark-active) (region-beginning)) |
| 1363 | (if (and transient-mark-mode mark-active) (region-end))))) | 1372 | (if (and transient-mark-mode mark-active) (region-end))))) |
| 1364 | 1373 | ||
| 1365 | (defun isearch-query-replace-regexp () | 1374 | (defun isearch-query-replace-regexp (&optional delimited) |
| 1366 | "Start `query-replace-regexp' with string to replace from last search string." | 1375 | "Start `query-replace-regexp' with string to replace from last search string. |
| 1367 | (interactive) | 1376 | See `isearch-query-replace' for more information." |
| 1368 | (isearch-query-replace t)) | 1377 | (interactive |
| 1378 | (list current-prefix-arg)) | ||
| 1379 | (isearch-query-replace delimited t)) | ||
| 1369 | 1380 | ||
| 1370 | (defun isearch-occur (regexp &optional nlines) | 1381 | (defun isearch-occur (regexp &optional nlines) |
| 1371 | "Run `occur' with regexp to search from the current search string. | 1382 | "Run `occur' with regexp to search from the current search string. |