Fri Apr 8 10:54:04 EDT 2016
Let's do this properly. Any change to the emacs buffer will propagate
to racket. Ideally it should parse incrementally, but there doesn't
seem to be a good reason to do it different than the dumb way: send it
the whole thing on every keystroke.
No this will be too complicated. It is important to keep the end
result in mind: allow numeric parameter updates without making
structural changes. This is a necessary optimization: incremental
compilation isn't fast enough to keep up with a 50 Hz update rate.
So the basic idea is to keep two models in sync:
- Emacs buffer with textual representation
- Compiled form + parameter values.
To make this work, start both from the same point = the source file.
Go back to that point whenever an invariant is broken.
Distinguish these kinds of edits:
- Number control events, e.g. from an external midi controller or
using emacs to modify the current number under edit.
This is structure-preserving, but needs to update the number
literals in the representation.
- Any other arbitrary code change.
If it parses to the same structure a parameter update can be
performed. Else a recompilation is necessary.
I wonder if geiser can be used to do this. Likely there are at least
some communication primitives to be reused.