I’m aware or Revise.jl 's capabilities when it comes to editing code and having the changes immediately reflected in the repl.
I was wondering whether there would be a straightforward way to actually run some code whenever a file is saved.
E.g., I’m editing a function foo(x), and every time I save the file, I want foo(3) to be sent into the active repl I’m working on.
There’s things like watchexec and neovim autocommands, and these can be used to run something like julia filename.jl in the shell every time filename.jl is saved, but I’m not sure how they could be used to run things directly into the repl.
then you could do something like this in the REPL:
julia> using Revise
julia> includet("/tmp/foo.jl")
julia> entr(["/tmp/foo.jl"]) do
@show foo(3)
end
foo(3) = 1
# (at this point, edit foo.jl and save it)
foo(3) = 2
I was using ["test.jl"] instead of ["/tmp/foo.jl"], so the typo wouldn’t matter.
However, after playing around with it a bit more on a fresh repl session to confirm, I don’t get the same errors I was getting previously.
Perhaps I did something weird while messing around with the foo function in the previous session which was causing the errors I was getting previously.
Sorry for the confusion!