env-var-import
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: package-install env-var-import.
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 byenv-var-import-exec-path-varand setexec-pathto the value of that variable.env-var-import-exec-path-vardefaults to toPATHbut can be customized.(env-var-import '("VAR1" "VAR2")): In this mode it will still import the value of the environment variable defined inenv-var-import-exec-path-varand setexec-pathto that value. However, it will also import the values ofVAR1andVAR2.