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

Does not ignore zshrc exec statements #70

Closed xiamaz closed 4 years ago

xiamaz commented 7 years ago

I start fish through my zshrc file, which enables fish to inherit all the path variables from my former main shell. The problem is, that exec-path-from-shell won't work anymore, as it seems to be parsing the whole zshrc. Since I am starting a different shell in my zshrc, this is not possible anymore.

Would it be possible to ignore exec statements while parsing the rc files?

purcell commented 7 years ago

Let's just be clear: this code doesn't parse your RC files, so it can't control what's executed or not. The only options to control that are the combination of the $SHELL environment variable in Emacs, and the flags passed to the shell, as per the exec-path-from-shell-arguments. (Set exec-path-from-shell-debug to t to see what command is being executed.)

Generally speaking, if you want your shell to be fish, you should set that as your user shell instead of zsh. And zshrc is meant for interactive use, so you should not be relying on non-interactive shells evaluating it.

Probably the solution in this case is for you to instead set your environment variables (PATH etc) in your .zshenv instead of in your .zshrc.