This issue was discussed on the mailing list with the thread starting here: https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg00550.html A patch was proposed here: https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg00292.html and is copied here as an attachment.