Re: [racket-users] Is it possible to embed a scheme'y text editor in another GUI application?

2020-10-11 Thread Christopher Lemmer Webber
Matthew Flatt writes:

> At Sun, 05 Aug 2018 11:50:09 -0400, Christopher Lemmer Webber wrote:
>> DrRacket includes a nice Scheme editor.  I don't need the whole
>> thing... but some of it would be nice, like the paren matching.  How
>> reusable is DrRacket's text editor tooling?  Reusable enough to embed in
>> another application?  Or would I have to rewrite this?
>
> You can use `racket:text%`.
>
> I usually find that I need something a little different than
> `racket:text%`, for one reason or another, but composing the right
> pieces of the "framework" collection can be tricky. If `racket:text%`
> isn't exactly what you want, you might look at this bit of the
> "slideshow-repl" package (which embeds a Racket editor into a Slideshow
> presentation) as an extra example:
>
> https://github.com/mflatt/slideshow-repl/blob/master/slideshow/private/editor.rkt

Been a while since I originally asked this, and I did put racket:text%
to use!

  https://dustycloud.org/gfx/goodies/fairy-forest-ui-mockup2.png

Out of curiosity, how hard is it to compose in other #lang type things
into this?  At the very least, it would be nice for my purposes to be
able to enable something scribble-like or at least the at-exp feature.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/871ri472e4.fsf%40dustycloud.org.


Re: [racket-users] Is it possible to embed a scheme'y text editor in another GUI application?

2018-08-10 Thread Christopher Lemmer Webber
David Thrane Christiansen writes:

>> Wow, those are stunning examples!  I had no idea!
>
> Thanks!
>
>> BTW, do you have code for either of these posted anywhere under a libre
>> license?  Might be interesting to look at :)
>
> I don't typically post the source code of the slides themselves,
> because I don't really design them for independent consumption outside
> of the context of the talk, and I don't want to do tech support for
> them.
>
> But the Idris interaction library has an example with it:
> https://github.com/david-christiansen/idris-interaction.rkt
>
> The second one uses bits and pieces of Pie, from
> https://github.com/the-little-typer/pie. I plan on publicly
> documenting that library much better at some point - right now there's
> only docs for the Pie language itself.
>
> If that's not enough to get started, contact me off-list and I'll send
> the (potentially somewhat bitrotted) source for either talk.
>
> David

Cool... I see the bits in the slideshow.rkt and gui/ directory of Pie,
and that looks helpful.  Thanks much :)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Is it possible to embed a scheme'y text editor in another GUI application?

2018-08-08 Thread David Thrane Christiansen
> Wow, those are stunning examples!  I had no idea!

Thanks!

> BTW, do you have code for either of these posted anywhere under a libre
> license?  Might be interesting to look at :)

I don't typically post the source code of the slides themselves,
because I don't really design them for independent consumption outside
of the context of the talk, and I don't want to do tech support for
them.

But the Idris interaction library has an example with it:
https://github.com/david-christiansen/idris-interaction.rkt

The second one uses bits and pieces of Pie, from
https://github.com/the-little-typer/pie. I plan on publicly
documenting that library much better at some point - right now there's
only docs for the Pie language itself.

If that's not enough to get started, contact me off-list and I'll send
the (potentially somewhat bitrotted) source for either talk.

David

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Is it possible to embed a scheme'y text editor in another GUI application?

2018-08-08 Thread Christopher Lemmer Webber
David Thrane Christiansen writes:

> Hi Christopher,
>
>> Oh, this is very nice!  I didn't even know there was a way to embed a
>> REPL like this in slideshow! :)
>
> It's possible to embed arbitrary GUI widgets!
>
> Here's a talk that uses Slideshow with an embedded Idris editor and REPL
> where the slides fire up an Idris compiler behind the scenes,
> interacting with it over a socket:
>
> https://www.youtube.com/watch?v=pqFgYCdiYz4
>
> The compiler does all the semantic coloring of the code, the interactive
> case-split generating, etc.

Holy cow!

> Here's one where the Pie type checker runs in-process in the slides:
>
> https://www.youtube.com/watch?v=1BWYy2-WM-o
>
> That one is based on the same editor widgets that you're using, extended
> with a type checker and custom lexer and color scheme. No external
> processes needed.
>
>
> Slideshow is really fun for making interactive talks!
>
> David

Wow, those are stunning examples!  I had no idea!

BTW, do you have code for either of these posted anywhere under a libre
license?  Might be interesting to look at :)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Is it possible to embed a scheme'y text editor in another GUI application?

2018-08-05 Thread David Thrane Christiansen
Hi Christopher,

> Oh, this is very nice!  I didn't even know there was a way to embed a
> REPL like this in slideshow! :)

It's possible to embed arbitrary GUI widgets!

Here's a talk that uses Slideshow with an embedded Idris editor and REPL
where the slides fire up an Idris compiler behind the scenes,
interacting with it over a socket:

https://www.youtube.com/watch?v=pqFgYCdiYz4

The compiler does all the semantic coloring of the code, the interactive
case-split generating, etc.


Here's one where the Pie type checker runs in-process in the slides:

https://www.youtube.com/watch?v=1BWYy2-WM-o

That one is based on the same editor widgets that you're using, extended
with a type checker and custom lexer and color scheme. No external
processes needed.


Slideshow is really fun for making interactive talks!

David

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Is it possible to embed a scheme'y text editor in another GUI application?

2018-08-05 Thread Christopher Lemmer Webber
Matthew Flatt writes:

> At Sun, 05 Aug 2018 11:50:09 -0400, Christopher Lemmer Webber wrote:
>> DrRacket includes a nice Scheme editor.  I don't need the whole
>> thing... but some of it would be nice, like the paren matching.  How
>> reusable is DrRacket's text editor tooling?  Reusable enough to embed in
>> another application?  Or would I have to rewrite this?
>
> You can use `racket:text%`.

Oh I see... this is awesome! :)

I did a quick test:

(require racket/gui
 framework)

(define (sexp-editor)
  (define frame
(new frame% [label "sexp editor"]))
  (define canvas
(new editor-canvas%
 [parent frame]
 [min-height 480]))
  (define racket-text
(new racket:text%))
  (send canvas set-editor racket-text)
  (send frame show #t))

It works great!  I am shocked at how easy that was!

> I usually find that I need something a little different than
> `racket:text%`, for one reason or another, but composing the right
> pieces of the "framework" collection can be tricky. If `racket:text%`
> isn't exactly what you want, you might look at this bit of the
> "slideshow-repl" package (which embeds a Racket editor into a Slideshow
> presentation) as an extra example:
>
> https://github.com/mflatt/slideshow-repl/blob/master/slideshow/private/editor.rkt

Oh, this is very nice!  I didn't even know there was a way to embed a
REPL like this in slideshow! :)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Is it possible to embed a scheme'y text editor in another GUI application?

2018-08-05 Thread Matthew Flatt
At Sun, 05 Aug 2018 11:50:09 -0400, Christopher Lemmer Webber wrote:
> DrRacket includes a nice Scheme editor.  I don't need the whole
> thing... but some of it would be nice, like the paren matching.  How
> reusable is DrRacket's text editor tooling?  Reusable enough to embed in
> another application?  Or would I have to rewrite this?

You can use `racket:text%`.

I usually find that I need something a little different than
`racket:text%`, for one reason or another, but composing the right
pieces of the "framework" collection can be tricky. If `racket:text%`
isn't exactly what you want, you might look at this bit of the
"slideshow-repl" package (which embeds a Racket editor into a Slideshow
presentation) as an extra example:

https://github.com/mflatt/slideshow-repl/blob/master/slideshow/private/editor.rkt

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Is it possible to embed a scheme'y text editor in another GUI application?

2018-08-05 Thread Christopher Lemmer Webber
DrRacket includes a nice Scheme editor.  I don't need the whole
thing... but some of it would be nice, like the paren matching.  How
reusable is DrRacket's text editor tooling?  Reusable enough to embed in
another application?  Or would I have to rewrite this?

I know I can embed a more vanilla editor, but parentheses matching and
indentation support are what I'm mostly interested in.

(If you're guessing this has to do with the user-hackable distributed
game, you're right...!)

Thanks,
 - Chris

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.