From 738f39d21a220e5498ef027c8b09a3b70b2569d5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 2 Mar 2018 19:55:03 -0500 Subject: [PATCH] Change how shell env is injected #449 Changes the behavior of the :env setting to fetch the shell variables immediately on call. --- core/core-os.el | 6 +++--- modules/lang/go/config.el | 11 +++++++---- modules/lang/python/config.el | 3 +-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core/core-os.el b/core/core-os.el index d1f171604..61af0b29d 100644 --- a/core/core-os.el +++ b/core/core-os.el @@ -37,12 +37,12 @@ ;; 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))) + "Inject VARS from your shell environment into Emacs." + `(exec-path-from-shell-copy-env (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) - (add-hook 'emacs-startup-hook #'exec-path-from-shell-initialize))) + (exec-path-from-shell-initialize))) ((require 'osx-clipboard nil t) (osx-clipboard-mode +1)))) diff --git a/modules/lang/go/config.el b/modules/lang/go/config.el index d9a0d040f..e88880569 100644 --- a/modules/lang/go/config.el +++ b/modules/lang/go/config.el @@ -1,20 +1,23 @@ ;;; lang/go/config.el -*- lexical-binding: t; -*- -(set! :env "GOPATH" "GOROOT") +;; +;; Plugins +;; (def-package! go-mode :mode "\\.go$" :interpreter "go" :config - (when (executable-find "goimports") - (setq gofmt-command "goimports")) - + (set! :env "GOPATH" "GOROOT") (set! :repl 'go-mode #'gorepl-run) (set! :lookup 'go-mode :definition #'go-guru-definition :references #'go-guru-referrers :documentation #'godoc-at-point) + (when (executable-find "goimports") + (setq gofmt-command "goimports")) + (setq gofmt-show-errors nil) ; Leave it to flycheck (add-hook 'go-mode-hook #'flycheck-mode) (add-hook! go-mode diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index 600554ad2..9d23a45a5 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -1,7 +1,5 @@ ;;; 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.") @@ -26,6 +24,7 @@ is loaded.") :config (add-hook! 'python-mode-hook #'(flycheck-mode highlight-numbers-mode)) + (set! :env "PYTHONPATH" "PYENV_ROOT") (set! :company-backend 'python-mode '(company-anaconda)) (set! :electric 'python-mode :chars '(?:)) (set! :repl 'python-mode #'+python/repl)