Next: , Previous: , Up: MIT/GNU Scheme   [Contents][Index]


7 GNU Emacs Interface

GNU Emacs is distributed with a loadable package xscheme, which facilitates running Scheme as a subprocess of Emacs.

To invoke Scheme from Emacs, load the xscheme package (for example by ‘(require 'xscheme)’, then use M-x run-scheme. You may give run-scheme a prefix argument, in which case it will allow you to edit the command line that is used to invoke Scheme. Do not remove the --emacs option!

Note carefully: In Emacs 19 and later, the run-scheme command exists, but is different from the one described here! In order to get this interface, you must load the xscheme library before executing run-scheme.

Scheme will be started up as a subprocess in a buffer called ‘*scheme*’. This buffer will be in scheme-interaction-mode and all output from the Scheme process will go there. The mode line for the ‘*scheme*’ buffer will have this form:

--**-*scheme*: 1 [Evaluator]           (Scheme Interaction: input)------

The first field, showing ‘1’ in this example, is the level number.

The second field, showing ‘[Evaluator]’ in this example, describes the type of REPL that is running. Other values include:

[Debugger]
[Where]

The mode after ‘Scheme Interaction’ is one of:

input

Scheme is waiting for input.

run

Scheme is running an evaluation.

gc

Scheme is garbage collecting.

When the xscheme package is loaded into Emacs, scheme-mode is extended to include commands for evaluating expressions (do C-h m in any scheme-mode buffer for the most up-to-date information):

M-o

Evaluates the current buffer (xscheme-send-buffer).

M-z

Evaluates the current definition (xscheme-send-definition). This is also bound to C-M-x.

C-M-z

Evaluates the current region (xscheme-send-region).

C-x C-e

Evaluates the expression to the left of point (xscheme-send-previous-expression). This is also bound to M-RET.

C-c C-s

Selects the ‘*scheme*’ buffer and places you at its end (xscheme-select-process-buffer).

C-c C-y

Yanks the most recently evaluated expression, placing it at point (xscheme-yank-previous-send). This works only in the ‘*scheme*’ buffer.

The following commands provide interrupt capability:

C-c C-c

Like typing C-g when running Scheme in a terminal. (xscheme-send-control-g-interrupt)

C-c C-x

Like typing C-c C-x when running Scheme in a terminal. (xscheme-send-control-x-interrupt)

C-c C-u

Like typing C-c C-u when running Scheme in a terminal. (xscheme-send-control-u-interrupt)

C-c C-b

Like typing C-c C-b when running Scheme in a terminal. (xscheme-send-breakpoint-interrupt)

C-c C-p

Like evaluating ‘(continue)’. (xscheme-send-proceed)


Next: Edwin, Previous: Profiling, Up: MIT/GNU Scheme   [Contents][Index]