purcell / exec-path-from-shell

Make Emacs use the $PATH set up by the user's shell
Other
1.41k stars 81 forks source link

Env variable not copied #54

Closed dgellow closed 7 years ago

dgellow commented 7 years ago

Hello,

I have a .profile, sourced from my .zshrc. In .profile I export a value for GOPATH

export GOPATH="$HOME/Development/Go/gopath/"

Running exec-path-from-shell-copy-env in emacs doesn't seem to work

(exec-path-from-shell-copy-env "GOPATH)
(getenv "GOPATH") ;; => nil

Am I doing something wrong?

purcell commented 7 years ago

.zshrc is only sourced for interactive shells, so it might be getting skipped due to your particular exec-path-from-shell-arguments.

You should put environment variable settings like that in your .zshenv, or in a file which you source from there.

dgellow commented 7 years ago

Same issue :s

purcell commented 7 years ago

Okay, so perhaps Emacs doesn't think that your shell is zsh... what's the result of M-: (getenv "SHELL")?

dgellow commented 7 years ago

@purcell Correct! The SHELL variable was set to "/bin/bash". I've setenved it to "/bin/zsh" and everything work as expected. Thank you for your help 🙇🏻

purcell commented 7 years ago

Happy to help. Glad you figured it out.