In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.23) of 2015-10-14 Repository revision: 38f99a02b83e9e408970cb7abdb685725b2004f9 Quite often, performing query-replace, i just hit the [space] quicky with no much attention. If i replace one string by mistake, i can comeback to it with "^", but if i edit the string with "E" to reset it to its original value, the interactive query-replace session ends. I found useful if we can undo such replacements without exiting the query-replace. The attached patch implement such behaviour for `query-replace'. Having this also working for `query-replace-regexp' would be very nice, but harder to implement.