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

zsh should maybe not use the `-l` flag #40

Closed cpaulik closed 8 months ago

cpaulik commented 8 years ago

zsh sources ~/.zshenv before the profile files (see here for loading order) which might overwrite the PATH. This happened to me on Arch because /etc/profile contained:

PATH="/usr/local/sbin:/usr/local/bin:/usr/bin"
export PATH
purcell commented 8 years ago

Nonetheless, that should be a result consistent with what you see in your terminal, right? That is one goal of the package. I'm also a zsh user, and ultimately I'd like to remove -i / -l from the shell flags used by exec-path-from-shell, but that will break things for some people too, so it's a probably a question of which bug reports I'd prefer to receive. :-)

purcell commented 8 years ago

(I am a bit surprised by that aspect of the zsh startup file order... I wonder what the reasoning is.)

cpaulik commented 8 years ago

The results were not consistent with what I have in my terminal since my terminal emulator does not start zsh as a login shell. I understand that such a change can be problematic but I wanted to let you know since I was also quite surprised. Feel free to close the issue if you decide not to change it in this way.

purcell commented 8 years ago

Thanks. I probably will close this, because there isn't a one-size-fits-all solution given the wide variety of shell configs people have. First I need to ponder things a bit more, I think. In the meantime, you can customise exec-path-from-shell-arguments to minimise problems.

johnmastro commented 8 years ago

ultimately I'd like to remove -i / -l from the shell flags used by exec-path-from-shell, but that will break things for some people too

My current understanding is that bash won't source any of ~/.bashrc, ~/.bash_profile, or ~/.profile for a non-interactive non-login shell. You can specify a file for it to source via BASH_ENV, but I suspect few people do that. If that's correct, I think bash users will need at least one of -i or -l.

I could easily be misunderstanding, but that's what the man page seems to say and a quick experiment seems to confirm it.

I know you're not planning to make any changes immediately but I was poking around at this stuff today and came across this issue. Let me know if I'm missing something - I'd love to have a better understanding.

purcell commented 8 years ago

Thanks @johnmastro, that's helpful background info.

cjxgm commented 8 years ago

I'd like to remove -i and -l, too. My bash startup script detects if it starts as interactive login shell, if so, exec fish. The rationale behind this is, a program that need to be run by bash will not need interactive bash (interactive shells are for the user, not programs). And if I invoke bash manually, it won't be a login shell. This causes bug in exec-path-from-shell.

purcell commented 8 years ago

I'd like to remove -i and -l, too.

You can easily do this:

M-x customize-variable RET exec-path-from-shell-arguments
aleksandersumowski commented 6 years ago

Any suggestions how remove -i from within the Spacemacs configuration? I'm trying out Spacemacs after being long time Vim user

purcell commented 6 years ago

@aleksandersumowski

Any suggestions how remove -i from within the Spacemacs configuration? I'm trying out Spacemacs after being long time Vim user

Unsure, sorry, I don't use Spacemacs, but I understand it has its own config file scheme.

cpaulik commented 6 years ago

@aleksandersumowski You should be able to set the flags in your spacemacs config like in this example https://github.com/cpaulik/dotfiles/blob/master/.spacemacs.d.symlink/init.el#L368

Blaisorblade commented 6 years ago

I'd like to remove -i and -l, too.

Removing -i is reasonable (see also #17) but removing -l isn't, because then you skip reading .profile, and that is where you should set PATH and such things.

purcell commented 6 years ago

Removing -i is reasonable (see also #17) but removing -l isn't, because then you skip reading .profile, and that is where you should set PATH and such things

@Blaisorblade There is .zshenv for this.

Blaisorblade commented 6 years ago

@purcell Sorry for the noise, I was answering a comment about bash (https://github.com/purcell/exec-path-from-shell/issues/40#issuecomment-220845253).

purcell commented 6 years ago

@Blaisorblade Oh right, cool - sorry!

purcell commented 8 months ago

Closing as this was mostly a question about shell config, and not clearly a fault with exec-path-from-shell.