Add set-env! autodef; make :env obsolete

This commit is contained in:
Henrik Lissner 2018-06-15 03:15:34 +02:00
parent 3b0fad871f
commit 98d2f1de3f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
8 changed files with 20 additions and 8 deletions

9
core/autoload/os.el Normal file
View file

@ -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)))

View file

@ -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)

View file

@ -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))

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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))