I'm looking into Bug#20247 , currently listed as a blocker for Emacs 25. From the bug report, it appears that the attached patch would have prevented the bug. This patch is a change to Emacs behavior so I'll propose it here now, and give a heads-up on the Emacs-devel mailing list before installing it. Comments welcome. I don't care myself about the behavior one way or another (I don't use desktop mode) and am mainly just trying to clear out the bug backlog.