diff options
author | Karoly Lorentey <karoly@lorentey.hu> | 2007-04-22 11:42:03 +0000 |
---|---|---|
committer | Karoly Lorentey <karoly@lorentey.hu> | 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 |
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." (message (if query-flag - (substitute-command-keys - "Query replacing %s with %s: (\\<query-replace-map>\\[help] for help) ")))) + (apply 'propertize + (substitute-command-keys + "Query replacing %s with %s: (\\<query-replace-map>\\[help] for help) ") + minibuffer-prompt-properties)))) ;; If region is active, in Transient Mark mode, operate on region. (when start @@ -1466,27 +1468,35 @@ make, or the user didn't cancel the call." ;; otherwise, search for a match after moving forward ;; one char if progress is required. (setq real-match-data - (if (consp match-again) - (progn (goto-char (nth 1 match-again)) - (replace-match-data t - real-match-data - match-again)) - (and (or match-again - ;; MATCH-AGAIN non-nil means we - ;; accept an adjacent match. If - ;; we don't, move one char to the - ;; right. This takes us a - ;; character too far at the end, - ;; but this is undone after the - ;; while-loop. - (progn - (forward-char 1) - (not (or (eobp) - (and limit (>= (point) limit)))))) - (funcall search-function search-string limit t) - ;; For speed, use only integers and - ;; reuse the list used last time. - (replace-match-data t real-match-data))))) + (cond ((consp match-again) + (goto-char (nth 1 match-again)) + (replace-match-data + t real-match-data match-again)) + ;; MATCH-AGAIN non-nil means accept an + ;; adjacent match. + (match-again + (and + (funcall search-function search-string + limit t) + ;; For speed, use only integers and + ;; reuse the list used last time. + (replace-match-data t real-match-data))) + ((and (< (1+ (point)) (point-max)) + (or (null limit) + (< (1+ (point)) limit))) + ;; If not accepting adjacent matches, + ;; move one char to the right before + ;; searching again. Undo the motion + ;; if the search fails. + (let ((opoint (point))) + (forward-char 1) + (if (funcall + search-function search-string + limit t) + (replace-match-data + t real-match-data) + (goto-char opoint) + nil)))))) ;; Record whether the match is nonempty, to avoid an infinite loop ;; repeatedly matching the same empty string. @@ -1702,12 +1712,6 @@ make, or the user didn't cancel the call." (match-data t))) stack))))) - ;; The code preventing adjacent regexp matches in the condition - ;; of the while-loop above will haven taken us one character - ;; beyond the last replacement. Undo that. - (when (and regexp-flag (not match-again) (> replace-count 0)) - (backward-char 1)) - (replace-dehighlight)) (or unread-command-events (message "Replaced %d occurrence%s" |