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

New feature. Env from shell. #2331

Closed
jvillasante opened this issue Jul 15, 2015 · 2 comments
Closed

New feature. Env from shell. #2331

jvillasante opened this issue Jul 15, 2015 · 2 comments

Comments

@jvillasante
Copy link

This would be a nice addition I think:
https://github.com/purcell/exec-path-from-shell

It has to execute early for other packages to load.

Currently I have something like this in my .spacemacs

  (defun set-PATH-from-shell-PATH ()
    (let ((path-from-shell (shell-command-to-string "$SHELL -i -c 'echo $PATH'")))
      (setenv "PATH" path-from-shell)
      (setq exec-path (split-string path-from-shell path-separator))))
  (defun set-GOPATH-from-shell-GOPATH ()
    (let ((gopath-from-shell (shell-command-to-string "$SHELL -i -c 'echo $GOPATH'")))
      (setenv "GOPATH" gopath-from-shell)
      (setq exec-path (split-string gopath-from-shell path-separator))))
  (if window-system (set-PATH-from-shell-PATH))
  (if window-system (set-GOPATH-from-shell-GOPATH))

This load both $PATH and $GOPATH which I'm using, I would like to be able to write a function but I don't know lisp. Something like this:

(defun set-variable-from-shell (variable)
...)

(if window-system
  (set-variable-from-shell("PATH"))
  (set-variable-from-shell("GOPATH)))

Or better yet, integrate purcell package. Any help here??

@jb55
Copy link
Contributor

jb55 commented Jul 15, 2015

exec-path-from-shell is already included in the base spacemacs packages.

It's strange that it's not picking up your path correctly...

One thing to note is I've had to add exec-path-from-shell to my dotspacemacs-excluded-packages list when launching from the terminal, because exec-path-from-shell ignores the inherited path and tries to do its own thing.

srid added a commit to srid/spacemacs that referenced this issue Jul 29, 2015
cf. syl20bnr#2331 (comment)

(i was trying to do both, but it is not necessary given spacemacs defaults)
syl20bnr pushed a commit that referenced this issue Jul 30, 2015
cf. #2331 (comment)

(i was trying to do both, but it is not necessary given spacemacs defaults)
@StreakyCobra
Copy link
Contributor

As said, exec-path-from-shell is already integrated within spacemacs. Some documentation has also been added about this exec-path-from-shell in some layers (go, rust, osx at least). I'm closing the issue as it's main objective is solved. But feel free to open other issues if you are encountering bugs with it 😄

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

No branches or pull requests

3 participants