Better support for emacs in terminal