Change how shell env is injected #449

Changes the behavior of the :env setting to fetch the shell variables
immediately on call.
This commit is contained in:
Henrik Lissner 2018-03-02 19:55:03 -05:00
parent 45096c2ab6
commit 738f39d21a
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 11 additions and 9 deletions

View file

@ -37,12 +37,12 @@
;; 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) (def-setting! :env (&rest vars)
"Ensure VARs are grabbed from your shell environment." "Inject VARS from your shell environment into Emacs."
`(nconc exec-path-from-shell-variables (list ,@vars))) `(exec-path-from-shell-copy-env (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)
(add-hook 'emacs-startup-hook #'exec-path-from-shell-initialize))) (exec-path-from-shell-initialize)))
((require 'osx-clipboard nil t) ((require 'osx-clipboard nil t)
(osx-clipboard-mode +1)))) (osx-clipboard-mode +1))))

View file

@ -1,20 +1,23 @@
;;; lang/go/config.el -*- lexical-binding: t; -*- ;;; lang/go/config.el -*- lexical-binding: t; -*-
(set! :env "GOPATH" "GOROOT") ;;
;; Plugins
;;
(def-package! go-mode (def-package! go-mode
:mode "\\.go$" :mode "\\.go$"
:interpreter "go" :interpreter "go"
:config :config
(when (executable-find "goimports") (set! :env "GOPATH" "GOROOT")
(setq gofmt-command "goimports"))
(set! :repl 'go-mode #'gorepl-run) (set! :repl 'go-mode #'gorepl-run)
(set! :lookup 'go-mode (set! :lookup 'go-mode
:definition #'go-guru-definition :definition #'go-guru-definition
:references #'go-guru-referrers :references #'go-guru-referrers
:documentation #'godoc-at-point) :documentation #'godoc-at-point)
(when (executable-find "goimports")
(setq gofmt-command "goimports"))
(setq gofmt-show-errors nil) ; Leave it to flycheck (setq gofmt-show-errors nil) ; Leave it to flycheck
(add-hook 'go-mode-hook #'flycheck-mode) (add-hook 'go-mode-hook #'flycheck-mode)
(add-hook! go-mode (add-hook! go-mode

View file

@ -1,7 +1,5 @@
;;; 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.")
@ -26,6 +24,7 @@ is loaded.")
:config :config
(add-hook! 'python-mode-hook #'(flycheck-mode highlight-numbers-mode)) (add-hook! 'python-mode-hook #'(flycheck-mode highlight-numbers-mode))
(set! :env "PYTHONPATH" "PYENV_ROOT")
(set! :company-backend 'python-mode '(company-anaconda)) (set! :company-backend 'python-mode '(company-anaconda))
(set! :electric 'python-mode :chars '(?:)) (set! :electric 'python-mode :chars '(?:))
(set! :repl 'python-mode #'+python/repl) (set! :repl 'python-mode #'+python/repl)