fix for 24.4 and support terminal emacs and emacs-mac-port