From a9cbfc7f4edf362a095b36f675964d226636982a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 1 Mar 2018 00:55:58 -0500 Subject: [PATCH] New :env setting for pulling shell envvars into MacOS sessions :env lets you specify what environment variables exec-path-from-shell should pull in from your shell environment at startup. As such, these need to be defined at startup. :env is useless post-init. May address #433 --- core/core-os.el | 3 +++ modules/lang/go/config.el | 2 ++ modules/lang/python/config.el | 2 ++ 3 files changed, 7 insertions(+) diff --git a/core/core-os.el b/core/core-os.el index 8ced59f0d..d1f171604 100644 --- a/core/core-os.el +++ b/core/core-os.el @@ -36,6 +36,9 @@ ;; environment, so envvars will be wrong. That includes the PATH ;; Emacs picks up. `exec-path-from-shell' fixes this. (when (require 'exec-path-from-shell nil t) + (def-setting! :env (&rest vars) + "Ensure VARs are grabbed from your shell environment." + `(nconc exec-path-from-shell-variables (list ,@vars))) (setq exec-path-from-shell-check-startup-files nil exec-path-from-shell-arguments (delete "-i" exec-path-from-shell-arguments)) (defvaralias 'exec-path-from-shell-debug 'doom-debug-mode) diff --git a/modules/lang/go/config.el b/modules/lang/go/config.el index cd655e9ef..d9a0d040f 100644 --- a/modules/lang/go/config.el +++ b/modules/lang/go/config.el @@ -1,5 +1,7 @@ ;;; lang/go/config.el -*- lexical-binding: t; -*- +(set! :env "GOPATH" "GOROOT") + (def-package! go-mode :mode "\\.go$" :interpreter "go" diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index 334968423..600554ad2 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -1,5 +1,7 @@ ;;; lang/python/config.el -*- lexical-binding: t; -*- +(set! :env "PYTHONPATH" "PYENV_ROOT") + (defvar +python-pyenv-root nil "The path to pyenv's root directory. This is automatically set when `python' is loaded.")