Add smarter kill-ring saving

Thanks to Väinö Järvelä (@kaali) for the tip.