Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clojure's Emacs CIDER repl - environment variables from .profile are missing

I don't know if this is a general Emacs issue or clojure/cider specific. Anyway: How do I pass through environment variables which work in the shell and are configured currently in my ~/.profile. Now if I lein repl in my project, this works just fine:

(System/getenv "FOO")
-> "BAR

But when I cider-jack-in in my project, the CIDER repl can't see the variable:

(System/getenv "FOO")
-> nil

I'm using the GUI (Cocoa) version of Emacs version 24.4.50. Cider version is cider-20140718.747.

like image 371
auramo Avatar asked Aug 12 '14 19:08

auramo


1 Answers

You can either, as noisesmith points out, set the environment variables system wide so you don't need to cause emacs to use your .profile settings, or you can start emacs from the command line so that it gets the settings from .profile as in this answer: https://stackoverflow.com/a/13243093/90801 Starting it from the command line is nice because you can start several emacs's with different settings. or start them from a script:

FOO="BAR" /Applications/Emacs.app/Contents/MacOS/Emacs project.clj

would start emacs with foo having the value "BAR" without changing anything system wide.

like image 87
Arthur Ulfeldt Avatar answered Nov 03 '22 07:11

Arthur Ulfeldt