summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2019-07-08 01:18:07 +0300
committerJuri Linkov <juri@linkov.net>2019-07-08 01:18:07 +0300
commit3bffc09d17cf7edf46e3834edd84520a493d2239 (patch)
tree00185cfda0dc8888b8e36c7b7ba7fe8a1f720937
parent736d5927abfb6bae218cf5612c287b1a1f77b4a5 (diff)
downloademacs-3bffc09d17cf7edf46e3834edd84520a493d2239.tar.gz
* lisp/replace.el (perform-replace): Move save-match-data here
from replace-highlight for isearch-lazy-highlight-new-loop (bug#36328).
-rw-r--r--lisp/replace.el27
1 files changed, 14 insertions, 13 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index db305adfd38..ab1ff327f6c 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2316,11 +2316,7 @@ It is called with three arguments, as if it were
(isearch-forward (not backward))
(isearch-other-end match-beg)
(isearch-error nil))
- (save-match-data
- ;; Preserve match-data for perform-replace since
- ;; isearch-lazy-highlight-new-loop calls `sit-for' that
- ;; does redisplay that might clobber match data (bug#36328).
- (isearch-lazy-highlight-new-loop range-beg range-end)))))
+ (isearch-lazy-highlight-new-loop range-beg range-end))))
(defun replace-dehighlight ()
(when replace-overlay
@@ -2582,10 +2578,14 @@ characters."
(if (not query-flag)
(progn
(unless (or literal noedit)
- (replace-highlight
- (nth 0 real-match-data) (nth 1 real-match-data)
- start end search-string
- regexp-flag delimited-flag case-fold-search backward))
+ (save-match-data
+ ;; replace-highlight calls isearch-lazy-highlight-new-loop
+ ;; and `sit-for' whose redisplay might clobber match data.
+ ;; (Bug#36328)
+ (replace-highlight
+ (nth 0 real-match-data) (nth 1 real-match-data)
+ start end search-string
+ regexp-flag delimited-flag case-fold-search backward)))
(setq noedit
(replace-match-maybe-edit
next-replacement nocasify literal
@@ -2602,10 +2602,11 @@ characters."
(while (not done)
(set-match-data real-match-data)
(run-hooks 'replace-update-post-hook) ; Before `replace-highlight'.
- (replace-highlight
- (match-beginning 0) (match-end 0)
- start end search-string
- regexp-flag delimited-flag case-fold-search backward)
+ (save-match-data
+ (replace-highlight
+ (match-beginning 0) (match-end 0)
+ start end search-string
+ regexp-flag delimited-flag case-fold-search backward))
;; Obtain the matched groups: needed only when
;; regexp-flag non nil.
(when (and last-was-undo regexp-flag)