aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index ad9be77a79b..5c0616e25f0 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2698,7 +2698,7 @@ characters."
2698 (num-replacements 0) 2698 (num-replacements 0)
2699 (nocasify t) ; Undo must preserve case (Bug#31073). 2699 (nocasify t) ; Undo must preserve case (Bug#31073).
2700 search-string 2700 search-string
2701 next-replacement) 2701 last-replacement)
2702 (while (and (< stack-idx stack-len) 2702 (while (and (< stack-idx stack-len)
2703 stack 2703 stack
2704 (or (null replaced) last-was-act-and-show)) 2704 (or (null replaced) last-was-act-and-show))
@@ -2709,9 +2709,9 @@ characters."
2709 ;; Bind swapped values 2709 ;; Bind swapped values
2710 ;; (search-string <--> replacement) 2710 ;; (search-string <--> replacement)
2711 search-string (nth (if replaced 4 3) elt) 2711 search-string (nth (if replaced 4 3) elt)
2712 next-replacement (nth (if replaced 3 4) elt) 2712 last-replacement (nth (if replaced 3 4) elt)
2713 search-string-replaced search-string 2713 search-string-replaced search-string
2714 next-replacement-replaced next-replacement 2714 next-replacement-replaced last-replacement
2715 last-was-act-and-show nil) 2715 last-was-act-and-show nil)
2716 2716
2717 (when (and (= stack-idx stack-len) 2717 (when (and (= stack-idx stack-len)
@@ -2733,16 +2733,18 @@ characters."
2733 (match-data t (nth 2 elt))) 2733 (match-data t (nth 2 elt)))
2734 noedit 2734 noedit
2735 (replace-match-maybe-edit 2735 (replace-match-maybe-edit
2736 next-replacement nocasify literal 2736 last-replacement nocasify literal
2737 noedit real-match-data backward) 2737 noedit real-match-data backward)
2738 replace-count (1- replace-count) 2738 replace-count (1- replace-count)
2739 real-match-data 2739 real-match-data
2740 (save-excursion 2740 (save-excursion
2741 (goto-char (match-beginning 0)) 2741 (goto-char (match-beginning 0))
2742 (if regexp-flag 2742 (if regexp-flag
2743 (looking-at next-replacement) 2743 (looking-at last-replacement)
2744 (looking-at (regexp-quote next-replacement))) 2744 (looking-at (regexp-quote last-replacement)))
2745 (match-data t (nth 2 elt)))) 2745 (match-data t (nth 2 elt))))
2746 (when regexp-flag
2747 (setq next-replacement (nth 4 elt)))
2746 ;; Set replaced nil to keep in loop 2748 ;; Set replaced nil to keep in loop
2747 (when (eq def 'undo-all) 2749 (when (eq def 'undo-all)
2748 (setq replaced nil 2750 (setq replaced nil