Skip to content

Import variables into emacs from the system environment

Notifications You must be signed in to change notification settings

bwachter/system-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

system-environment

Introduction

This package helps making environment variables defined outside of Emacs available inside. Quite often some system component - like a shell, or systemd user session - is configured with correct environment variables, but the launcher does not have a complete set, resulting in Emacs inheriting a bad copy.

Example for Linux with systemd user session, exporting everything but the variables listed here:

(system-environment-import-from-command "systemctl --user show-environment"
                                        '("DISPLAY" "HOME" "LOGNAME" "USER") t)))

Example for Windows, importing only the variables listed here:

(system-environment-import-from-async-command
 "powershell -Command Get-ChildItem Env:|Foreach-Object {'{0}={1}' -f $_.Key,$_.Value }"
 '("GIT_SSH" "HOMEDRIVE" "HOMEPATH" "GOPATH" "PATH" "SSH_AUTH_SOCK"))

Example for MacOS (or any other system with zsh), importing only the two variables listed:

(system-environment-import-from-command "zsh -i -c env" '("PATH" "SSH_AUTH_SOCK") nil nil t)

For more detailed information consult the function documentation.

About

Import variables into emacs from the system environment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published