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
This commit is contained in:
Henrik Lissner 2018-03-01 00:55:58 -05:00
parent 48e605a7ca
commit a9cbfc7f4e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 7 additions and 0 deletions

View file

@ -36,6 +36,9 @@
;; environment, so envvars will be wrong. That includes the PATH ;; environment, so envvars will be wrong. That includes the PATH
;; Emacs picks up. `exec-path-from-shell' fixes this. ;; Emacs picks up. `exec-path-from-shell' fixes this.
(when (require 'exec-path-from-shell nil t) (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 (setq exec-path-from-shell-check-startup-files nil
exec-path-from-shell-arguments (delete "-i" exec-path-from-shell-arguments)) exec-path-from-shell-arguments (delete "-i" exec-path-from-shell-arguments))
(defvaralias 'exec-path-from-shell-debug 'doom-debug-mode) (defvaralias 'exec-path-from-shell-debug 'doom-debug-mode)

View file

@ -1,5 +1,7 @@
;;; lang/go/config.el -*- lexical-binding: t; -*- ;;; lang/go/config.el -*- lexical-binding: t; -*-
(set! :env "GOPATH" "GOROOT")
(def-package! go-mode (def-package! go-mode
:mode "\\.go$" :mode "\\.go$"
:interpreter "go" :interpreter "go"

View file

@ -1,5 +1,7 @@
;;; lang/python/config.el -*- lexical-binding: t; -*- ;;; lang/python/config.el -*- lexical-binding: t; -*-
(set! :env "PYTHONPATH" "PYENV_ROOT")
(defvar +python-pyenv-root nil (defvar +python-pyenv-root nil
"The path to pyenv's root directory. This is automatically set when `python' "The path to pyenv's root directory. This is automatically set when `python'
is loaded.") is loaded.")