Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent eshell-path-env getting out-of-sync with $PATH #55

Merged
merged 2 commits into from
Oct 16, 2019

Conversation

dkellner
Copy link
Contributor

When changing .envrc in a running Eshell session, changes to $PATH don't have any effect:

Welcome to the Emacs shell

$ mkdir foo && cd foo
$ echo "#!/bin/sh" > bar.sh
$ echo "echo 'works!'" >> bar.sh
$ chmod +x bar.sh
$ ./bar.sh
works!

$ echo "PATH_add ." > .envrc
$ direnv allow
$ direnv-update-directory-environment
direnv: ~PATH (~/dev/emacs-direnv/foo)
$ echo $PATH
/home/dkellner/dev/emacs-direnv/foo:...

$ bar.sh
bar.sh: command not found
$ sh -c "bar.sh"
works!

After updating eshell-path-env to the current value of $PATH, the behaviour is as expected:

$ (setq eshell-path-env (getenv "PATH"))
/home/dkellner/dev/emacs-direnv/foo:...
$ bar.sh
works!

Copy link
Owner

@wbolster wbolster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't use eshell myself, but this looks good

Copy link
Owner

@wbolster wbolster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using eq to check major-mode, i think it's better to use derived-mode-p instead

Copy link
Owner

@wbolster wbolster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've updated the pr. looks good now.

@wbolster wbolster merged commit d9ec9a8 into wbolster:master Oct 16, 2019
wbolster added a commit that referenced this pull request Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants