This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
It's very specific to the core, and not used elsewhere, hence move it out of terminal-util.[ch].