diff options
Diffstat (limited to 'lisp/replace.el')
| -rw-r--r-- | lisp/replace.el | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index d1eabb035d3..88da7e26cb0 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -2147,6 +2147,10 @@ passed in. If LITERAL is set, no checking is done, anyway." | |||
| 2147 | noedit nil))) | 2147 | noedit nil))) |
| 2148 | (set-match-data match-data) | 2148 | (set-match-data match-data) |
| 2149 | (replace-match newtext fixedcase literal) | 2149 | (replace-match newtext fixedcase literal) |
| 2150 | ;; `query-replace' undo feature needs the beginning of the match position, | ||
| 2151 | ;; but `replace-match' may change it, for instance, with a regexp like "^". | ||
| 2152 | ;; Ensure that this function preserves the match data (Bug#31492). | ||
| 2153 | (set-match-data match-data) | ||
| 2150 | ;; `replace-match' leaves point at the end of the replacement text, | 2154 | ;; `replace-match' leaves point at the end of the replacement text, |
| 2151 | ;; so move point to the beginning when replacing backward. | 2155 | ;; so move point to the beginning when replacing backward. |
| 2152 | (when backward (goto-char (nth 0 match-data))) | 2156 | (when backward (goto-char (nth 0 match-data))) |