I think this is a close representation of what I was trying to describe with running a separate executable within a window/widget…any way to do this?
Can I type #!eof
in a Racket? For example, in Scheme I can mytest.scm
My program
#!eof
My progaam, but I want to skip ...
What is #!eof
equivalent in .rkt
?
There’s no racket equivalent of that.
Thanks.
Hi @bsilverstrim
I can see see some security problems with embedding an external program into a new GUI. Consider the case where an user thinks he as opened a bank application, but in reality has opened an app that catches all keystrokes and sends them to an existing embedded bank app.
For that reason I was about to say, that your mission is impossible. But from the question you posted above, you get to the question [1] below. So it seems the QT framework has a solution to the problem.
But … I am pretty sure there is no standard macOS and Windows GUI elements that allow embedded another application.
That said - I can think of some terrible hacks. Consider this scenario:
- Make an extra screen (a virtual one - just a big canvas).
- Hide it from the user.
- Open the external application on the virtual screen.
- From you app copy screen shots from the virtual screen to a canvas in your app.
[1] https://stackoverflow.com/questions/33699258/qt-5-5-embed-external-application-into-qwidget
Note that you can just comment it out, using block comment, right?
So:
My program
#!eof
My progaam, but I want to skip ...
=>
My program
#\|
My progaam, but I want to skip ...
\|#
racket-mode doesn’t seem to handle well the programs inside #\| ... \|#
. #\|
(define (foo x)
1)
\|#
After indent #\|
(define (foo x)
1)
\|#
But that is another quesion.
If you want to comment programs, perhaps use S-exp comment
My program
#;
(define (foo x)
1)
In summary, something like this isn’t a standard or near standard ability in most OSs, even if it is somewhat possible under one.
And Racket does not have a way to readily display an interactive session with an application, unless it’s terminal based (probably) since that’s just redirection of stdin/stdout/stderr
A terminal plugin as a snip would be cool.
Maybe there is a terminal project that has special support for the “embed terminal in another application”? It’s worth looking for.
Yes, but it can only comment one sexp. I have just created an <https://github.com/greghendershott/racket-mode/issues/603|racket-mode issue>. It is not urgent.
I don’t think that’s a bug though. #\| ... \|#
is not meant to exclusively comment code. It can comment anything, and I certainly don’t want to indent my prose with Racket indentation.
Yes, it can only comment one sexp, but note that you can chain them
#;#;
(define (foo x)
1)
(define (foo x)
1)
Something like this: https://github.com/AndreRenaud/EmbeddedCLI
I have no ideas whether this particular project is suitable or not.
Nice. But it is not convenient, because I have a lot of code need to be commented.
What is the meaning of #\| ... \|#
? Is it part of racket? You said it is not meant to comment code…I am confused.
Yes, that comment syntax is built-in to racket
#\| ... \|#
is a part of Racket. It’s just like /* ... */
in C. So you know, it can be used to comment anything, including regular text comment, license, etc.
And I definitely don’t want license and text comment to be indented as if they are code.
> And I definitely don’t want license and text comment to be indented as if they are code. I agree. But the current racket-mode will indent the text inside #\| ... \|#
and the indent is incorrect. I hope the indent system of racket-mode doesn’t touch them at all.
> And I definitely don’t want license and text comment to be indented as if they are code. To that I agree, but I also think that the content between the #\| ... \|#
should be left alone and “not (not-)indented” as if it wasn’t code.
Oh, that’s what Siyuan just said. :slightly_smiling_face:
By the way, different from /* ... */
in C, #\| ... \|#
can be nested, if I remember correctly.
I believe you can roll your own by using a table that maps function names to hooks and providing your own #%app
. But places that need advising or to run advising functions would need to import your module