Description
One workflow that I like is the idea of a "scratch buffer." That is, a buffer that you can quickly visit, put some code in and evaluate to see what happens. Many IDEs support something like this, including Emacs (the usual scratch buffer), Dreampie for Python, Groovy Console for Groovy, and of course, DrRacket's definitions window, where you can enter a bunch of code and then hit Run.
I have a similar workflow configured in Emacs, where I open a scratch buffer named *scratch - Racket*
with racket-mode
as the major mode. I can evaluate individual expressions in this buffer if I happen to have a REPL open, but what I'd like to be able to do is run this buffer without needing to save it to disk (the same way as with DrRacket). That way, I could just clear the contents upon visiting the buffer, and enter some fresh code in and have it evaluated from scratch each time, and being able to easily edit errors and re-run as needed. I find this helpful for quickly validating assumptions or trying things or initial prototyping without the "commitment" of having a saved file yet, and where I can treat it as a cohesive program (and not just individual expressions to edit with varying dynamic state as in the REPL). But at the moment, attempting to run
this makeshift scratch buffer prompts to save the file -- which makes sense usually, but not for the UX I'm going for here.
Would it make sense to add a Scratch Buffer to Racket Mode? If you think so, some of the links above could provide some design ideas for iterating on this feature in Racket Mode - Dreampie in particular has some good ideas.