my question is very similar to this one.
I use my .profile
file to set environment variables, such as EDITOR
. However, when I run ansi-term
and type printenv
I can see that that variable is not defined.
I am already using exec-path-from-shell
but it looks like certain environment variables are not set.
Apparently the .profile
file is only supposed to be read on login, but this means that environment variables that I do need to be set are not set for ansi-term
which is my preferred way to use a shell in emacs.
Simply put I am looking for a way to make the environment in ansi-term
identical to the a login shell. Is there a way to do this?
.profile
is read on login, and so your environment variables would be set in Emacs (and therefore in all Emacs subprocesses including the ones started from ansi-term). If your environment variables aren't set in Emacs then there's something wrong with your system configuration, it isn't Emacs fault. Are you running OSX? It manages user sessions differently; if you're running OSX you should look at OSX documentation/tutorials to see how to set environment variables. – Gilles 'SO- stop being evil' Apr 14 '17 at 07:24