Use this c++ test: main() { int _xx; _xx = _xx + 2; return _xx; } "query-replace" loses the edit region. Works in Emacs 23.3. Broke in GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29 1. Select region from line 2 '{' to line 8 '}' 2. Do "query-replace" to begin "Query replace in region" 3. Do Double-click left mouse to select '_xx' on line 3 -or- "mouse-drag-region" to select '_xx' on line 3 4. In "Query replace in region:" window do "mouse-yank-at-click" to insert '_xx'. 5. Via keyboard hit "Enter" key, now you see: "Query replace in region _xx with:" 6. Via keyboard type '_yy' and 'enter' "Query replace in region _xx with: _yy" 7. Nothing happens because the region in step (1) has been lost. It should ask to replace 4 '_xx's in the region.