Fix running emacs in a terminal