Patched term.el from 24.3.1