diff --git a/core/autoload/os.el b/core/autoload/os.el new file mode 100644 index 000000000..871eea21d --- /dev/null +++ b/core/autoload/os.el @@ -0,0 +1,9 @@ +;;; core/autoload/os.el -*- lexical-binding: t; no-byte-compile: t -*- + +;; FIXME obsolete :env +;;;###autoload +(def-setting! :env (&rest vars) + "TODO" + :obsolete set-env! + (when (featurep 'exec-path-from-shell) + `(exec-path-from-shell-copy-envs ,@vars))) diff --git a/core/core-os.el b/core/core-os.el index fe8a9ade5..8469faeb8 100644 --- a/core/core-os.el +++ b/core/core-os.el @@ -12,6 +12,9 @@ ;; http://stackoverflow.com/questions/15873346/elisp-rename-macro (advice-add #'evil-visual-update-x-selection :override #'ignore) +(defmacro set-env! (&rest _vars) + "Inject VARS from your shell environment into Emacs.") + (cond (IS-MAC (setq mac-command-modifier 'meta mac-option-modifier 'alt @@ -32,9 +35,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) + (defun set-env! (&rest vars) "Inject VARS from your shell environment into Emacs." - `(exec-path-from-shell-copy-envs (list ,@vars))) + (exec-path-from-shell-copy-envs 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/emacs/term/config.el b/modules/emacs/term/config.el index c65b42afb..6be92ed5b 100644 --- a/modules/emacs/term/config.el +++ b/modules/emacs/term/config.el @@ -6,7 +6,7 @@ ;; `term' (built-in) (after! term - (set! :env "SHELL") + (set-env! "SHELL") ;; Consider term buffers real (add-hook 'term-mode-hook #'doom|mark-buffer-as-real)) diff --git a/modules/lang/go/config.el b/modules/lang/go/config.el index 0c75e67db..47837c324 100644 --- a/modules/lang/go/config.el +++ b/modules/lang/go/config.el @@ -5,7 +5,7 @@ ;; (after! go-mode - (set! :env "GOPATH" "GOROOT") + (set-env! "GOPATH" "GOROOT") (set! :repl 'go-mode #'gorepl-run) (set! :lookup 'go-mode :definition #'go-guru-definition diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index 734cea5ea..ef1ea1d77 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -24,7 +24,7 @@ is loaded.") :config (add-hook! 'python-mode-hook #'(flycheck-mode highlight-numbers-mode)) - (set! :env "PYTHONPATH" "PYENV_ROOT") + (set-env! "PYTHONPATH" "PYENV_ROOT") (set! :electric 'python-mode :chars '(?:)) (set! :repl 'python-mode #'+python/repl) diff --git a/modules/lang/ruby/config.el b/modules/lang/ruby/config.el index 61f89ae6d..21e63dd15 100644 --- a/modules/lang/ruby/config.el +++ b/modules/lang/ruby/config.el @@ -16,7 +16,7 @@ :config (set-company-backend! 'ruby-mode 'company-dabbrev-code) (set! :electric 'ruby-mode :words '("else" "end" "elseif")) - (set! :env "RBENV_ROOT") + (set-env! "RBENV_ROOT") (set! :repl 'ruby-mode #'inf-ruby) ; `inf-ruby' (setq ruby-deep-indent-paren t) ;; Don't interfere with my custom RET behavior diff --git a/modules/lang/rust/config.el b/modules/lang/rust/config.el index 65dfdfd9d..7902ea517 100644 --- a/modules/lang/rust/config.el +++ b/modules/lang/rust/config.el @@ -1,7 +1,7 @@ ;;; lang/rust/config.el -*- lexical-binding: t; -*- (after! rust-mode - (set! :env "RUST_SRC_PATH") + (set-env! "RUST_SRC_PATH") (set! :docset 'rust-mode "Rust") (setq rust-indent-method-chain t) diff --git a/modules/tools/password-store/config.el b/modules/tools/password-store/config.el index 3f4da27ac..27e7ca61e 100644 --- a/modules/tools/password-store/config.el +++ b/modules/tools/password-store/config.el @@ -26,7 +26,7 @@ ;; `pass' (after! pass - (set! :env "PASSWORD_STORE_DIR") + (set-env! "PASSWORD_STORE_DIR") (set-evil-initial-state! 'pass-mode 'emacs) (set-popup-rule! "^\\*Password-Store" '((side . left) (size . 0.25))