diff options
| -rw-r--r-- | lisp/replace.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 6fc67ad87bc..2a0735cfe5a 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -965,15 +965,20 @@ which will run faster and probably do exactly what you want." | |||
| 965 | (setq nonempty-match | 965 | (setq nonempty-match |
| 966 | (/= (nth 0 real-match-data) (nth 1 real-match-data))) | 966 | (/= (nth 0 real-match-data) (nth 1 real-match-data))) |
| 967 | 967 | ||
| 968 | ;; If the match is empty, record that the next one can't be adjacent. | 968 | ;; If the match is empty, record that the next one can't be |
| 969 | ;; adjacent. | ||
| 970 | |||
| 969 | ;; Otherwise, if matching a regular expression, do the next | 971 | ;; Otherwise, if matching a regular expression, do the next |
| 970 | ;; match now, since the replacement for this match may | 972 | ;; match now, since the replacement for this match may |
| 971 | ;; affect whether the next match is adjacent to this one. | 973 | ;; affect whether the next match is adjacent to this one. |
| 974 | ;; If that match is empty, don't use it. | ||
| 972 | (setq match-again | 975 | (setq match-again |
| 973 | (and nonempty-match | 976 | (and nonempty-match |
| 974 | (or (not regexp-flag) | 977 | (or (not regexp-flag) |
| 975 | (and (looking-at search-string) | 978 | (and (looking-at search-string) |
| 976 | (match-data))))) | 979 | (let ((match (match-data))) |
| 980 | (and (/= (nth 0 match) (nth 1 match)) | ||
| 981 | match)))))) | ||
| 977 | 982 | ||
| 978 | ;; Calculate the replacement string, if necessary. | 983 | ;; Calculate the replacement string, if necessary. |
| 979 | (when replacements | 984 | (when replacements |