Next: , Previous: Leaving Edwin, Up: Edwin

8.3 Scheme Mode

As you might expect, Edwin has special support for editing and evaluating Scheme code. This section describes Scheme Mode, the appropriate mode for editing MIT/GNU Scheme programs.

Scheme mode is normally entered automatically by visiting a file whose file name ends in `.scm'. You can also mark a file as Scheme code by placing the string `-*-Scheme-*-' on the first line of the file. Finally, you can put any buffer in Scheme mode by executing the command M-x scheme-mode.

Scheme mode is similar to the Emacs modes that edit Lisp code. So, for example, C-i indents the current line, and C-M-q indents the expression to the right of point. The close parenthesis will temporarily flash the matching open parenthesis. Most Scheme constructs requiring special indentation are recognized by Scheme mode, for example, begin, do, and let.

Scheme mode also provides support that is specific to Scheme programs, much as Emacs-Lisp mode does in Emacs. Completion of global variable names is provided: type the first few characters of a variable, then type C-M-i, and Edwin will attempt to complete the variable name using the current set of bound variables. If C-M-i is given a prefix argument, it will complete the name using the current set of interned symbols (which includes the bound variables as a subset).

The M-A command (note the uppercase A) will show the parameters of a procedure when point is inside a procedure call. For example, type the string `(quotient', then press M-A, and the command will echo `(n d)' in the echo area. With a prefix argument, M-A will insert the parameter names in the buffer at point, so in this example, the buffer would contain `(quotient n d' after running C-u M-A.