Previous: Access to Guile Help and Completion, Up: Working with GDS in Scheme Buffers


3.5.4.2 Evaluating Scheme Code

The following keystrokes and commands provide various ways of sending code to a Guile client process for evaluation.

M-C-x
Evaluate the “top level defun” that the cursor is in, in other words the smallest balanced expression which includes the cursor and whose opening parenthesis is in column 0 (gds-eval-defun).
C-x C-e
Evaluate the expression that ends just before the cursor (gds-eval-last-sexp). This is designed so that it is easy to evaluate an expression that you have just finished typing.
C-c C-e
Read a Scheme expression using the minibuffer, and evaluate that expression (gds-eval-expression).
C-c C-r
Evaluate the Scheme code in the marked region of the current buffer (gds-eval-region). Note that GDS does not check whether the region contains a balanced expression, or try to expand the region so that it does; it uses the region exactly as it is.

If you type C-u before one of these commands, GDS will immediately pop up a Scheme stack buffer, showing the requested evaluation, so that you can single step through it. (This is achieved by setting a <source-trap> trap at the start of the requested evaluation; see Source Traps for more on how those work.) The Scheme stack display, and the options for continuing through the code, are described in the next two sections.