From 5fa73a7d98040f749f4cd45cfa40cf3c1c8cc2e3 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Sun, 3 Jun 2018 23:28:30 +0900 Subject: query-replace undo: Handle when user edits the replacement string * lisp/replace.el (perform-replace): Update the replacement string after the user edit it (Fix Bug#31538). * test/lisp/replace-tests.el (query-replace-undo-bug31538): New test. Backport: (cherry picked from commits ea133e04f49afa7928e49a3ac4a85b47f6f13f01 and 7dcfdf5b14325ae7996f272f14c72810d7c84944) --- lisp/replace.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/replace.el') diff --git a/lisp/replace.el b/lisp/replace.el index 88da7e26cb0..940bf566509 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2721,7 +2721,8 @@ It must return a string." (replace-match-maybe-edit next-replacement nocasify literal noedit real-match-data backward) - replaced t)) + replaced t) + (setq next-replacement-replaced next-replacement)) (setq done t)) ((eq def 'delete-and-edit) -- cgit v1.2.1