Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An API to register an overdubbing REPL? #132

Open
mbauman opened this issue Jun 18, 2019 · 1 comment
Open

An API to register an overdubbing REPL? #132

mbauman opened this issue Jun 18, 2019 · 1 comment

Comments

@mbauman
Copy link

mbauman commented Jun 18, 2019

In testing out a change, we found it quite helpful to use ReplMaker.jl to create a custom REPL prompt that applied a cassette transform. It's super easy!

using Cassette, ReplMaker

Cassette.@context Ctx
# Do overdubbing...
function parse_to_expr(s)
    p = Meta.parse(s)
    isa(p, Expr) && p.head in (:using, :import) && return p
    quote $Cassette.@overdub($(Ctx()), $p) end
end
initrepl(parse_to_expr,
                prompt_text="Ctx> ",
                prompt_color = :blue,
                start_key=')',
                mode_name="Ctx_mode")

Is this something worth upstreaming here? Maybe as a flag to @context to create a REPL?

@vchuravy
Copy link
Member

Huh, that is fun! Should definitely go into https://github.com/jrevels/DemoTapes.jl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants