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

Fish shell and Environment variables #55

Closed Pilgrim1379 closed 6 years ago

Pilgrim1379 commented 7 years ago

I decided to try Fish shell after using ZSH for a while. Everything was fine in ZSH but now every time I start Emacs, I get the warning You appear to be setting environment variables ("PATH") in your .bashrc or .zshenv ... with the suggestion that I instead set it in .zshenv or .bash_profile etc.

The thing is fish has only one config file as far as I know which is config.fish. Do you know how to set the PATH in fish so as to get rid of the warning. I have tried moving setting into different folders under ~/.config/fish without success. I appreciate that you may not use Fish Shell and as such can't help.

purcell commented 7 years ago

Not sure, sorry: I don't use fish myself, and don't generally support the use of non-POSIX shells.

motohedgehog commented 7 years ago

@thepreacher I use a snippet that lives in my $XDG_CONFIG_HOME/fish/conf.d to initialize all the environment variables including PATH. No warnings so far.

Pilgrim1379 commented 7 years ago

@aafomin Do you mind linking to you snippet so I could take a look? and the $XDG_CONFIG_HOME defaults to $HOME so I don't have it explicitly set. That shouldn't be problem right?

motohedgehog commented 7 years ago

@thepreacher Yep, I don't have the XDG_CONFIG_HOME explicitly set too as I'm on macOS. I just mean the place where your configuration files live, typically $HOME/.config. The snippet itself is just too short for the gist, so here it is:


 $  cat $HOME/.config/fish/conf.d/env.fish
set -x PATH $HOME/.gem/ruby/2.3.0/bin $PATH
 $  echo $PATH
/Users/afomin/.gem/ruby/2.3.0/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin
$ emacsclient --eval '(getenv "PATH")'
"/Users/violator/.gem/ruby/2.3.0/bin:/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9:/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_9:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
braham-snyder commented 7 years ago

@thepreacher https://fishshell.com/docs/current/index.html#initialization

Pilgrim1379 commented 6 years ago

Closing this issues as the problem doesn't exist anymore after reconfiguring fish shell.