💥 Replace exec-path-from-shell w/ 'bin/doom env'

IMPORTANT: This is a breaking update for Mac users, as your shell
environment will no longer be inherited correctly (with the removal of
exec-path-from-shell). The quick fix is: 'bin/doom env refresh'. Also,
the set-env! autodef now does nothing (and is deprecated), be sure to
remove calls to it in your config.

Smaller changes:
+ This update also adds --no-* switches to doom quickstart
+ Includes general improvements to the documentation of several bin/doom
  commands.
+ Moves doom/reload* commands to core/autoload/config.el
+ doom/reload-project has been removed (it didn't actually do anything)

The breaking change:
This update adds an "envvar file" to Doom Emacs. This file is generated
by `doom env refresh`, populated with variables scraped from your shell
environment (from both non-interactive and interactive sessions). This
file is then (inexpensively) loaded at startup, if it exists.

+ The file is manually generated with `doom env refresh`.
+ It can be regenerated automatically whenever `doom refresh` is run by
  running `doom env enable` (`doom env clear` will reverse this and
  delete the env file).
+ `doom quickstart` will ask if you want to auto-generate this envvar
  file. You won't need it if you're confident Emacs will always be
  started from the correct environment, however.
+ Your env file can be reloaded from a running Emacs session with `M-x
  doom/reload-env`. Note: this won't work if the Emacs session you're
  running it in doesn't have a correct SHELL set. i.e. don't use this to
  create your first env file!

The idea isn't mine -- it's borrowed from Spacemacs -- and was
introduced to me in #1053 by @yurimx. I was impressed with it. Prior to
this, I was unhappy with exec-path-from-shell (no hate to the dev, I
understand its necessity), and 'doom patch-macos' wasn't ideal for mac
users (needed to be reapplied every time you update Emacs). What's more,
many users (even Linux users) had to install exec-path-from-shell
anyway.

This solution suffers from none of their shortcomings. More reliable
than patch-macos, more performant and complete than
exec-path-from-shell, and easily handled by bin/doom.
This commit is contained in:
Henrik Lissner 2019-03-28 00:06:10 -04:00
parent ab616cfb95
commit 2dc52bc9be
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
19 changed files with 266 additions and 136 deletions

View file

@ -110,7 +110,7 @@
"t" #'doom/reload-theme
"p" #'doom/reload-packages
"f" #'doom/reload-font
"P" #'doom/reload-project)
"e" #'doom/reload-env)
"T" #'doom/toggle-profiler
"V" #'set-variable
"C-v" #'doom/version

View file

@ -21,9 +21,7 @@
(when IS-BSD
;; Use GNU ls as `gls' from `coreutils' if available. Add `(setq
;; dired-use-ls-dired nil)' to your config to suppress the Dired warning
;; when not using GNU ls. We must look for `gls' after
;; `exec-path-from-shell' was initialized to make sure that `gls' is in
;; `exec-path'
;; when not using GNU ls.
(if-let* ((gls (executable-find "gls")))
(setq insert-directory-program gls)
(setq args (delete "--group-directories-first" args))

View file

@ -6,7 +6,5 @@
;; `term' (built-in)
(after! term
(set-env! "SHELL")
(add-hook 'term-mode-hook #'doom|mark-buffer-as-real)
(add-to-list 'doom-detect-indentation-excluded-modes 'term-mode nil #'eq))

View file

@ -4,7 +4,6 @@
;; Packages
(after! go-mode
(set-env! "GOPATH" "GOROOT")
(set-docsets! 'go-mode "Go")
(set-repl-handler! 'go-mode #'gorepl-run)
(set-lookup-handlers! 'go-mode

View file

@ -18,7 +18,6 @@ called.")
(setq python-environment-directory doom-cache-dir
python-indent-guess-indent-offset-verbose nil)
:config
(set-env! "PYTHONPATH" "PYENV_ROOT" "ANACONDA_HOME")
(set-electric! 'python-mode :chars '(?:))
(set-repl-handler! 'python-mode #'+python/open-repl)

View file

@ -15,7 +15,6 @@
(enh-ruby-mode)
(ruby-mode)))
:config
(set-env! "RBENV_ROOT")
(set-electric! '(ruby-mode enh-ruby-mode) :words '("else" "end" "elsif"))
(set-repl-handler! '(ruby-mode enh-ruby-mode) #'inf-ruby)

View file

@ -1,7 +1,6 @@
;;; lang/rust/config.el -*- lexical-binding: t; -*-
(after! rust-mode
(set-env! "RUST_SRC_PATH")
(set-docsets! 'rust-mode "Rust")
(setq rust-indent-method-chain t)

View file

@ -25,7 +25,6 @@
;; `pass'
(after! pass
(set-env! "PASSWORD_STORE_DIR")
(set-evil-initial-state! 'pass-mode 'emacs)
(set-popup-rule! "^\\*Password-Store" :side 'left :size 0.25 :quit nil)
(define-key! pass-mode-map

View file

@ -5,7 +5,6 @@
:defer t
:preface (setq vterm-install t)
:config
(set-env! "SHELL")
(set-popup-rule! "^vterm" :size 0.25 :vslot -4 :select t :quit nil :ttl 0)
(add-hook 'vterm-mode-hook #'doom|mark-buffer-as-real)