Subject: bug#10959: 23.3; emacs -nw doesn't always restore the terminal screen

From: Chong Yidong <[email-masked]>
Date: Sat, 16 Jun 2012 18:00:31 +0800

I committed a patch to xterm.el that seems to stop the bug from
happening with the posted recipe.  It adds a `discard-input' call before
doing the xterm Report Background query, as is already done for the
Device Attributes query earlier in `terminal-init-xterm'.  I am still
not 100% sure of the chain of effect leading to the bug, though.