diff options
| author | Karoly Lorentey | 2007-04-22 11:42:03 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2007-04-22 11:42:03 +0000 |
| commit | 81088e260b086fe28f36964f32b6338210ec6fd8 (patch) | |
| tree | 53d5af73ca0c971fe6925944d4d059caab5337a2 /lisp/replace.el | |
| parent | fa1b1007cac59bafd16df7bd501ef2591dd77d62 (diff) | |
| parent | a6f0e674ebf44b1d37732b64070b804673481d28 (diff) | |
| download | emacs-81088e260b086fe28f36964f32b6338210ec6fd8.tar.gz emacs-81088e260b086fe28f36964f32b6338210ec6fd8.zip | |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-650
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-651
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-652
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-653
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-654
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-655
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-656
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-657
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-658
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-659
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-203
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-204
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-205
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-599
Diffstat (limited to 'lisp/replace.el')
| -rw-r--r-- | lisp/replace.el | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 9790dacd82b..5b970681ea7 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -1423,8 +1423,10 @@ make, or the user didn't cancel the call." | |||
| 1423 | 1423 | ||
| 1424 | (message | 1424 | (message |
| 1425 | (if query-flag | 1425 | (if query-flag |
| 1426 | (substitute-command-keys | 1426 | (apply 'propertize |
| 1427 | "Query replacing %s with %s: (\\<query-replace-map>\\[help] for help) ")))) | 1427 | (substitute-command-keys |
| 1428 | "Query replacing %s with %s: (\\<query-replace-map>\\[help] for help) ") | ||
| 1429 | minibuffer-prompt-properties)))) | ||
| 1428 | 1430 | ||
| 1429 | ;; If region is active, in Transient Mark mode, operate on region. | 1431 | ;; If region is active, in Transient Mark mode, operate on region. |
| 1430 | (when start | 1432 | (when start |
| @@ -1466,27 +1468,35 @@ make, or the user didn't cancel the call." | |||
| 1466 | ;; otherwise, search for a match after moving forward | 1468 | ;; otherwise, search for a match after moving forward |
| 1467 | ;; one char if progress is required. | 1469 | ;; one char if progress is required. |
| 1468 | (setq real-match-data | 1470 | (setq real-match-data |
| 1469 | (if (consp match-again) | 1471 | (cond ((consp match-again) |
| 1470 | (progn (goto-char (nth 1 match-again)) | 1472 | (goto-char (nth 1 match-again)) |
| 1471 | (replace-match-data t | 1473 | (replace-match-data |
| 1472 | real-match-data | 1474 | t real-match-data match-again)) |
| 1473 | match-again)) | 1475 | ;; MATCH-AGAIN non-nil means accept an |
| 1474 | (and (or match-again | 1476 | ;; adjacent match. |
| 1475 | ;; MATCH-AGAIN non-nil means we | 1477 | (match-again |
| 1476 | ;; accept an adjacent match. If | 1478 | (and |
| 1477 | ;; we don't, move one char to the | 1479 | (funcall search-function search-string |
| 1478 | ;; right. This takes us a | 1480 | limit t) |
| 1479 | ;; character too far at the end, | 1481 | ;; For speed, use only integers and |
| 1480 | ;; but this is undone after the | 1482 | ;; reuse the list used last time. |
| 1481 | ;; while-loop. | 1483 | (replace-match-data t real-match-data))) |
| 1482 | (progn | 1484 | ((and (< (1+ (point)) (point-max)) |
| 1483 | (forward-char 1) | 1485 | (or (null limit) |
| 1484 | (not (or (eobp) | 1486 | (< (1+ (point)) limit))) |
| 1485 | (and limit (>= (point) limit)))))) | 1487 | ;; If not accepting adjacent matches, |
| 1486 | (funcall search-function search-string limit t) | 1488 | ;; move one char to the right before |
| 1487 | ;; For speed, use only integers and | 1489 | ;; searching again. Undo the motion |
| 1488 | ;; reuse the list used last time. | 1490 | ;; if the search fails. |
| 1489 | (replace-match-data t real-match-data))))) | 1491 | (let ((opoint (point))) |
| 1492 | (forward-char 1) | ||
| 1493 | (if (funcall | ||
| 1494 | search-function search-string | ||
| 1495 | limit t) | ||
| 1496 | (replace-match-data | ||
| 1497 | t real-match-data) | ||
| 1498 | (goto-char opoint) | ||
| 1499 | nil)))))) | ||
| 1490 | 1500 | ||
| 1491 | ;; Record whether the match is nonempty, to avoid an infinite loop | 1501 | ;; Record whether the match is nonempty, to avoid an infinite loop |
| 1492 | ;; repeatedly matching the same empty string. | 1502 | ;; repeatedly matching the same empty string. |
| @@ -1702,12 +1712,6 @@ make, or the user didn't cancel the call." | |||
| 1702 | (match-data t))) | 1712 | (match-data t))) |
| 1703 | stack))))) | 1713 | stack))))) |
| 1704 | 1714 | ||
| 1705 | ;; The code preventing adjacent regexp matches in the condition | ||
| 1706 | ;; of the while-loop above will haven taken us one character | ||
| 1707 | ;; beyond the last replacement. Undo that. | ||
| 1708 | (when (and regexp-flag (not match-again) (> replace-count 0)) | ||
| 1709 | (backward-char 1)) | ||
| 1710 | |||
| 1711 | (replace-dehighlight)) | 1715 | (replace-dehighlight)) |
| 1712 | (or unread-command-events | 1716 | (or unread-command-events |
| 1713 | (message "Replaced %d occurrence%s" | 1717 | (message "Replaced %d occurrence%s" |