Skip to content

Instantly share code, notes, and snippets.

@darrylhebbes
Created January 31, 2015 15:14
Show Gist options
  • Select an option

  • Save darrylhebbes/4d10e0b7ccb8361f61d6 to your computer and use it in GitHub Desktop.

Select an option

Save darrylhebbes/4d10e0b7ccb8361f61d6 to your computer and use it in GitHub Desktop.
#Emacs Ensure the GUI Emacs always sees the same $PATH that I get inside a shell
;; credit SanityInc : http://stackoverflow.com/a/6415812
(defun set-exec-path-from-shell-PATH ()
(let ((path-from-shell (replace-regexp-in-string
"[ \t\n]*$"
""
(shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
(setenv "PATH" path-from-shell)
(setq eshell-path-env path-from-shell) ; for eshell users
(setq exec-path (split-string path-from-shell path-separator))))
(when window-system (set-exec-path-from-shell-PATH))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment