Mercurial > emacs
changeset 34480:816fa0390935
(perform-replace): Don't use an empty match adjacent
to a non-empty match when computing the next match before the
replacement is performed.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 12 Dec 2000 14:13:13 +0000 |
parents | aab24f62ad6b |
children | ba47c94ebbc5 |
files | lisp/replace.el |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/replace.el Tue Dec 12 13:31:47 2000 +0000 +++ b/lisp/replace.el Tue Dec 12 14:13:13 2000 +0000 @@ -965,15 +965,20 @@ (setq nonempty-match (/= (nth 0 real-match-data) (nth 1 real-match-data))) - ;; If the match is empty, record that the next one can't be adjacent. + ;; If the match is empty, record that the next one can't be + ;; adjacent. + ;; Otherwise, if matching a regular expression, do the next ;; match now, since the replacement for this match may ;; affect whether the next match is adjacent to this one. + ;; If that match is empty, don't use it. (setq match-again (and nonempty-match (or (not regexp-flag) (and (looking-at search-string) - (match-data))))) + (let ((match (match-data))) + (and (/= (nth 0 match) (nth 1 match)) + match)))))) ;; Calculate the replacement string, if necessary. (when replacements