fatteneder / MakieSlides.jl

MIT License
17 stars 2 forks source link

Integrate with Revise.jl #24

Open fatteneder opened 2 years ago

fatteneder commented 2 years ago

The current workflow is to write into a file slides.jl and then include that one in your Julia REPL with include("slides.jl"). This in turn then creates a new presentation from scratch whenever we include it again.

Is it possible to integrate with Revise.jl such that we can track the parts of the script that have changed and then only update the corresponding slides instead of redoing the whole presentation?

Assuming we can connect the parts of the script to the slides, e.g. by tracking the bodies of add_slides! calls, I think we could re-render the whole slide easily. What I anticipate to be not so simple to do (or impossible for now) is to update only selected parts of a slide. Not only would it be difficult to make the connection between a MarkdownBox call and its arguments with the corresponding Block element and its attributes. But (IIRC) Makie does not (yet) allow to clear parts of a figure either, hence, removing elements or re-layouting a slide is currently not doable.

To me it appears that re-rendering just the slide would need the least effort for the best improvement, provided we can make Revise.jl track which contents go to which slide. If we could combine this with #5 we might even be able to get responsive slides with little downtime between editing slides.

fatteneder commented 2 years ago

I studied the docs of Revise.jl and also CodeTracking.jl a little. Right now I don't see a way to get this to work easily. The reason is that although Revise can also track assign statements, this might not always be what we want to do. E.g. consider a slides script

using MakieSlides

# prepare some data here

a = []
push!(a, 1)

pres = Presentation()
add_slide!(pres) do fig
#...
end

Upon re-including you push more and more elements to a.

If we could make it so that Revise only tracks the add_slides! calls then this would be already an achievement.