improvement to emacs e function