make emacs plugin work correctly in terminal only environments