;; Set the exec-path of emacs equal to the shell's $PATH,
;; so that emacs knows the shell's $PATH
(defun set-exec-path-from-shell-PATH ()
- (let ((path-from-shell (shell-command-to-string "$SHELL -i -c 'echo $PATH'")))
+ (replace-regexp-in-string "[[:space:]\n]*$" ""
+ (shell-command-to-string "$SHELL -l -c 'echo $PATH'"))))
(setenv "PATH" path-from-shell)
(setq exec-path (split-string path-from-shell path-separator))))