diff --git a/doc/DOCUMENTATION.org b/doc/DOCUMENTATION.org index 9dbcfce77..82f6bcfef 100644 --- a/doc/DOCUMENTATION.org +++ b/doc/DOCUMENTATION.org @@ -94,6 +94,7 @@ - [[#layout-key-bindings][Layout key bindings]] - [[#workspaces][Workspaces]] - [[#workspace-key-bindings][Workspace key bindings]] +- [[#environment-variables-and-path-from-the-shell][Environment variables and PATH from the shell]] - [[#commands][Commands]] - [[#vim-key-bindings][Vim key bindings]] - [[#escaping][Escaping]] @@ -1716,6 +1717,24 @@ There are also some handy globally available key bindings related to workspaces: | ~gT~ | go to previous workspace | | ~SPC b W~ | go to workspace and window by buffer | +* Environment variables and PATH from the shell +When using the Emacs GUI environment variables defined by your shell may not +be available to the Emacs process. This is especially true for macOS. + +The command to fetch the environment variables from your shell is very expensive +and increases the startup time quite a lot. + +For this reason, Spacemacs caches the PATH value and some environment variables +in the file located at =~/.emacs.d/.cache/.env-vars=. + +Any environment variables that are not found are still written to the cache file +with the value =-NOTFOUND-PLEASE-DEFINE-IN-YOUR-SHELL=. + +Spacemacs won't update the cached values by itself, if you want to update your +shell variables then either delete the cache file or execute the interactive +function =spacemacs/import-path= and restart Emacs to fetch any updated +environment variables. + * Commands ** Vim key bindings Spacemacs is based on =Vim= modal user interface to navigate and edit text. If diff --git a/layers/+distributions/spacemacs-bootstrap/config.el b/layers/+distributions/spacemacs-bootstrap/config.el index 9aa5401b2..e6fb376f9 100644 --- a/layers/+distributions/spacemacs-bootstrap/config.el +++ b/layers/+distributions/spacemacs-bootstrap/config.el @@ -81,3 +81,6 @@ if used there.") ("iedit-insert" "firebrick1" (bar . 2))) "Colors assigned to evil states with cursor definitions. To add your own, use `spacemacs/add-evil-curosr'.") + +(defvar spacemacs-env-vars-file (concat spacemacs-cache-directory ".env-vars") + "Cache file for exec-path variable.") diff --git a/layers/+distributions/spacemacs-bootstrap/funcs.el b/layers/+distributions/spacemacs-bootstrap/funcs.el index 0ee7703f6..264aed326 100644 --- a/layers/+distributions/spacemacs-bootstrap/funcs.el +++ b/layers/+distributions/spacemacs-bootstrap/funcs.el @@ -183,8 +183,38 @@ Example: (evil-map visual \"<\" \"