You can easily add this to your ~/.juliarc.jl file and then it does happen, no?
On Wed, Jun 11, 2014 at 2:26 AM, Aerlinger <[email protected]> wrote: > Often when working on projects I find it's common to do certain > initializations when Julia starts. This generally includes setting certain > configurations, declaring environment variables, setting up connections etc > before my code begins to run. Basically, something that looks like this: > > if isfile("some_initializer.jl") > # ... > end > > Wouldn't it be more convenient to have a convention where Julia checks for > the existence of a runtime configuration .juliarc.jl file in the working > directory and executes it at startup if it exists? Other languages and > interactive environments such as R (.Rprofile) have implemented this > capability and can be very useful. > > It's not terribly difficult to implement, either. The following code > recursively traverses up the directory structure calling any .juliarc.jl > configuration files it encounters in reverse order: > > function loadrc(path::String) > if (path == ENV["HOME"] || path == "/") > return "" > end > > loadrc(dirname(path)) > juliarc = joinpath(path, ".juliarc.jl") > > if isfile(juliarc) > println("Loading config file:", juliarc) > include(juliarc) > end > end > > loadrc(pwd()) > > Perhaps this should be done by default? >
