From e39e019b4a5918016f3a74f3c76a44ea165bc4a1 Mon Sep 17 00:00:00 2001 From: Jon Malmaud Date: Wed, 23 Mar 2016 10:53:08 -0400 Subject: [PATCH] Fix 'should_reload' mechanic --- .gitignore | 1 + src/Autoreload.jl | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index fedf925..a49ab46 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.ipynb test.jl +.tags* diff --git a/src/Autoreload.jl b/src/Autoreload.jl index 34ab1c1..2d83617 100644 --- a/src/Autoreload.jl +++ b/src/Autoreload.jl @@ -51,15 +51,16 @@ function arequire(filename=""; command= :on, depends_on=UTF8String[]) filename = find_file(standarize(filename), constants=options[:constants]) filename == nothing && error("File $original_filename not found") if command in [:on, :on_depends] + was_reloading = false if filename in keys(files) + was_reloading = files[filename].should_reload remove_file(filename) end - # if command == :on - # should_reload = true - # else - # should_reload = false - # end - should_reload = true + if command == :on + should_reload = true + else + should_reload = was_reloading + end files[filename] = AFile(should_reload, reload_mtime(filename), UTF8String[]) parsed_file = parse_file(filename) auto_depends = extract_deps(parsed_file)