Skip to content

Commit 31d0a4d

Browse files
timholystevengj
authored andcommitted
Check whether Revise is running at startup, and if so configure it (JuliaLang#708)
Revise checks whether IJulia is running in its `__init__` function, and if so defines an appropriate `preexecute_hook`. However, I believe most users of Revise who also use the REPL configure it in their `.julia/config/startup.jl` script. It appears that this script runs before IJulia is loaded, and as a consequence Revise has no chance to detect whether it should define the hook. To make both work independent of load order, we therefore have to check symmetrically: Revise checks for IJulia, and IJulia checks for Revise. Fixes timholy/Revise.jl#150
1 parent acbd9e2 commit 31d0a4d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/kernel.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,10 @@ delete!(task_local_storage(),:SOURCE_PATH)
2929
# workaround JuliaLang/julia#6765
3030
Core.eval(Base, :(is_interactive = true))
3131

32+
# check whether Revise is running and as needed configure it to run before every prompt
33+
if isdefined(Main, :Revise)
34+
mode = get(ENV, "JULIA_REVISE", "auto")
35+
mode == "auto" && IJulia.push_preexecute_hook(Main.Revise.revise)
36+
end
37+
3238
IJulia.waitloop()

0 commit comments

Comments
 (0)