On Sat, Mar 28, 2015 at 12:26 PM, Rick Frankel <rick@rickster.com> wrote:
On Thu, Mar 26, 2015 at 02:57:40PM +0100, Alan Schmitt wrote:
> On 2015-03-26 14:50, Bernd Haug <bernd.haug@xaidat.com> writes:
>
> I'm using this nice trick (passed to me by a colleague) that sets the
> environment variables and path to be the same in zsh and emacs (launched
> From the GUI).
>
> #+begin_src emacs-lisp
> (let ((vars (split-string-and-unquote (shell-command-to-string ". ~/.zshrc; export") "\n")))
>   (mapcar (lambda (X) (let ((var_val (split-string-and-unquote X "=")))
>                         (setenv (car var_val) (cadr var_val)))) vars)
>   (setq exec-path
>         (append
>          (split-string-and-unquote (getenv "PATH") ":")
>          exec-path)))
> #+end_src

You could also use the `exec-path-from-shell' package, which will set a
specified list of variables (defaults to MANPATH, PATH) from the shell.

Which is the way I do it also. I have the following in my emacs-init.org file (that Tangles to my actual Emacs init file)

#+begin_src emacs-lisp :tangle yes
  (add-to-list 'el-get-sources '(:name exec-path-from-shell))
  (let ((exec-path-from-shell.el "~/.emacs.d/el-get/exec-path-from-shell/exec-path-from-shell.el"))
    (when (file-exists-p exec-path-from-shell.el)
      (load exec-path-from-shell.el)
      (require 'exec-path-from-shell)
      (when (memq window-system '(mac ns))
        (exec-path-from-shell-initialize))))
#+end_src



 
rick