[racket] Command line Racket equivalent of DrRacket's Racket | Run (CTRL+T or F5)?

From: Greg Hendershott (greghendershott at gmail.com)
Date: Mon Dec 13 14:31:14 EST 2010

To answer my own question: It looks I want
geiser-mode-switch-to-repl-and-enter. Great. That works close to what
I'd hoped.

Unfortunately I'm encountering a problem where sometimes Geiser gets
into a state such that switching away from the "* Racket REPL *"
buffer (with e.g. C-x o) will create a buffer named "*spurious*" with
contents like this:

-----

stdin::332: read: unexpected `)'
c:\users\greg\site\geiser\scheme\racket\geiser\user.rkt:57:15:
((current-read-interaction) (object-name in) in)
c:\users\greg\site\geiser\scheme\racket\geiser\user.rkt:56:2:
(let-values (((form) ((current-read-interaction) (object-name in)
in))) (let-values (((arg) (datum->syntax (....) ....))) (let-values
(((....) ....)) (let-values ....))))


 === context ===
c:\users\greg\site\geiser\scheme\racket\geiser\user.rkt:53:0
C:\Program Files (x86)\Racket\collects\racket\private\misc.rkt:74:7

racket at dns.rkt> stdin::333: read: unexpected `)'
c:\users\greg\site\geiser\scheme\racket\geiser\user.rkt:57:15:
((current-read-interaction) (object-name in) in)
c:\users\greg\site\geiser\scheme\racket\geiser\user.rkt:56:2:
(let-values (((form) ((current-read-interaction) (object-name in)
in))) (let-values (((arg) (datum->syntax (....) ....))) (let-values
(((....) ....)) (let-values ....))))


 === context ===
c:\users\greg\site\geiser\scheme\racket\geiser\user.rkt:53:0
C:\Program Files (x86)\Racket\collects\racket\private\misc.rkt:74:7

racket at dns.rkt>

-----

It's stuck in a state where every time I switch to the *Racket REPL*
buffer and away again, it will create yet another *spurious* buffer.
For instance *spurious*<2>, *spurious*<3> and so on.

On Mon, Dec 13, 2010 at 12:49 PM, Greg Hendershott
<greghendershott at gmail.com> wrote:
> Thank you Eduardo.
>
> Actually I had looked at Geiser but wasn't able to find just what I
> was looking for. I would love to try it again.
>
> Do you know what command in Geiser would be closest to doing a Racket
> | Run (e.g. F5 or C-t) in DrRacket?  Meaning, it would (1)
> evaluate/run the entire Emacs buffer, and, (2) provide an interactive
> Racket prompt afterward?
>
> On Mon, Dec 13, 2010 at 12:43 PM, Eduardo Bellani <ebellani at gmail.com> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> For racket in emacs, I would advise you to try geiser:
>>
>> http://www.nongnu.org/geiser/
>>
>> See you
>>
>> On 12/13/2010 03:19 PM, Greg Hendershott wrote:
>>> I feel like I'm missing something obvious here.
>>>
>>> Using Racket interactively from the command-line, how do I get a
>>> similar result as choosing Racket | Run (e.g. CTRL+T or F5) in
>>> DrRacket?
>>>
>>> Meaning: All the expressions in the file are evaluated, and afterward
>>> you have a prompt to do some more interactive things (or just type
>>> "(exit)").
>>>
>>> For instance if I have test.rkt which is
>>>
>>> #lang scheme
>>> (define (foo)
>>>   (displayln "I am foo."))
>>> (foo)
>>>
>>> then here's what happens at the OS command line:
>>>
>>> [1] "racket test.rkt"
>>> Runs it: Yes.  Racket prompt: No (Racket exits automatically).
>>> [2] "racket -i test.rkt"
>>> Runs it: No.  Racket prompt: Yes.  Typing "foo" at prompt: "reference
>>> to undefined identifier: foo"
>>> [3] "racket -i -f test.rkt"
>>> Runs it: No.  Racket prompt: Yes.  Typing "foo" at prompt: "reference
>>> to undefined identifier: foo"
>>> [4]  "racket _______ "
>>> Runs it: Yes.  Racket prompt: Yes.  Typing "foo" at prompt: "#<procedure:foo>"
>>>
>>> What is ____ in for 4?
>>>
>>>
>>> P.S. As more background, I want to be able to do this from the command
>>> line. So that's why I put the question that way.  But also, I'm
>>> interested in trying to use Racket from Emacs. At the moment the only
>>> thing I really want now is "get the same thing as pressing F5 in
>>> DrRacket". And (again maybe I'm missing something obvious, or botched
>>> the config) neither Racket nor Geiser seem to provide just quite that.
>>> So I was looking at binding F5 to mode-compile and setting the correct
>>> Racket flags ... that I haven't figured out yet, because apparently
>>> I'm a numskull.
>>>
>>> Thank you.
>>> _________________________________________________
>>>   For list-related administrative tasks:
>>>   http://lists.racket-lang.org/listinfo/users
>>
>>
>> - --
>> Eduardo Bellani
>>
>> omnia mutantur, nihil interit.
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.9 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>
>> iEYEARECAAYFAk0GW10ACgkQSbLl0kCTjGm+NQCfS5Qx/QLF0NoI+lWC1Ev37Zuc
>> hLQAniIlTHQPUZ15hmd0RBrzMij6KiS5
>> =Nfln
>> -----END PGP SIGNATURE-----
>>
>


Posted on the users mailing list.