use var instead of env var to detect terminal app
small improvements
emacs update