Created
August 23, 2013 14:10
-
-
Save ddeaguiar/6319724 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun set-exec-path-from-shell-PATH () | |
"Set up Emacs' `exec-path' and PATH environment variable to match that used by the user's shell. | |
This is particularly useful under Mac OSX, where GUI apps are not started from a shell." | |
(interactive) | |
(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 exec-path (split-string path-from-shell path-separator)))) | |
(set-exec-path-from-shell-PATH) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment