My startup.jl for Revise + Juno

So with the new Debugger integration into Juno there’s a lot more incentive to have Revise loaded within a Juno session, but I ran into some issues where loading Revise in my startup.jl was problematic because Atom wasn’t loaded yet, so Revise didn’t know to hook into its eval loop, so evaluating things in Atom didn’t trigger Revise-magic.

I think I have a pretty good setup, so I figured I’d share - it might be useful to some folks and others may have improvements.

Here’s the contents of my startup.jl. It does a few things:

  • activate the project in the current directory if there’s a Project.toml
  • load Revise.jl
  • load OhMyREPL
ENV["JULIA_PKG_DEVDIR"] = "$(ENV["HOME"])/Dropbox/juliadev"

using Pkg
if isfile("Project.toml")
    # auto-activate project in current directory
    @info "Activating project in $(pwd())"

@info "Importing Revise"
    using Revise
    # configure Revise to run revise() before every REPL eval
catch ex
    @warn "Could not load Revise: $ex"

@info "Importing OhMyREPL"
    using OhMyREPL
catch ex
    @warn "Could not load OhMyREPL: $ex"

Now typically when launching Julia in Juno this would get run before the REPL starts up and before Juno loads all its Atom/Juno goodies. So all I did was add the --startup-file=no option in the julia-client settings:

and then created the following ~/.julia/config/juno_startup.jl


This does two things:

  • now startup.jl gets run AFTER Juno has a chance to set itself up
  • from within my startup.jl I can check if "AWESOME_ATOM" in keys(ENV)" if I want to add any Atom-specific code to my startup.jl.

Thanks so much for sharing this! I’d been fighting with this for several days and this configuration finally did the trick.

Sorry for reviving an old post, but there’s one tiny thing that’s been happening for me and I was curious if anybody else had seen it. In particular, in my Atom REPL, I get the little “Info” things for importing Revise and OhMyREPL, but it appears to just hang there without a new REPL prompt appearing. At first I thought it was actually taking ages to import for some reason but then I realized if I just hit return I would get a new prompt and everything seemed to work.

Anyone else seen this and/or know how to fix?

1 Like

Yes - I recall this happening as well. My recollection is that it would come back if I executed code from my file, or as you noted, just hit enter, but also that it wasn’t happening recently - are you on the latest versions of everything?

Not quite on topic, but it might be worth future visitors to this thread: Juno is now support-only, and future development is happening in VS Code, (see here)