How to evaluate a single expression?

I am looking for the equivalent of C-x C-e in Emacs' Scheme mode. In Emacs the function eval-last-sexp gets evaluated. If you put the cursor on a closing parenthesis, the code up to the corresponding opening parenthesis gets evaluated. How to do this in DrRacket?

2 Likes

FWIW in racket-mode in Emacs, it's still C-x X-e.

Can't recommend racket-mode enough, if you are using Emacs.

2 Likes

You might want to set up a custom keybinding that does eval-last-sexp. See https://docs.racket-lang.org/drracket/Keyboard_Shortcuts.html#%28part..Sending.Program_.Fragments_to_the_.R.E.P.L%29 for more details.

1 Like

But it does not work as expected. See screen shot.

Where is the cursor here?

Before ( or after ) on line 3?

You may be looking for the select-send-sexpr quickscript. There are instructions for installing it here.

2 Likes