Updated patch is attached, following discussion on emacs-devel. (I have a CA on file, btw.)