Writing my last post on setting environment variables in GUI Emacs got me thinking about a more general solution to that problem. Rather than requiring everyone to define a function like
set-exec-path-from-shell-PATH, it would be nice if there were a package that would handle importing everything for you given a list of environment variables.
To that end I wrote env-var-import. It’s available in Marmalade for easy installation:
Once you’ve installed it, add
(require 'env-var-import) to your Emacs configuration and you’re ready to do some importing!
You have two options for using it:
(env-var-import): In this mode, it will only import the environment variable defined by
exec-pathto the value of that variable.
env-var-import-exec-path-vardefaults to to
PATHbut can be customized.
(env-var-import '("VAR1" "VAR2")): In this mode it will still import the value of the environment variable defined in
exec-pathto that value. However, it will also import the values of