Emacs integration
=================

Emacs is the canonical development environment for Scheme48.  The scheme.el and cmuscheme.el packages provide support for editing Scheme code and running inferior Scheme processes, respectively.  Also, the scheme48.el package provides more support for integrating directly with Scheme48. (scheme48.el is based on the older cmuscheme48.el, which is bundled with Scheme48 in the emacs/ directory.  Since cmuscheme48.el is older and less developed, it is not documented here.)  scheme.el and cmuscheme.el come with GNU Emacs; scheme48.el is available separately from

     http://www.emacswiki.org/cgi-bin/wiki/download/scheme48.el. display

     To load scheme48.el if it is in the directory EMACS-DIR,
     add these lines to your .emacs:

          (add-to-list 'load-path "EMACS-DIR/")
          (autoload 'scheme48-mode "scheme48"
            "Major mode for improved Scheme48 integration."
            t)
          (add-hook 'hack-local-variables-hook
                    (lambda ()
                      (if (and (boundp 'scheme48-package)
                               scheme48-package)
                          (progn (scheme48-mode)
                                 (hack-local-variables-prop-line))))) lisp

          The add-hook call sets Emacs up so that any file with a
          scheme48-package local variable specified in the file's
          -*- line or Local Variables section will be entered in
          Scheme48 mode.  Files should use the scheme48-package variable
          to enable Scheme48 mode; they should not specify Scheme48 mode
          explicitly, since this would fail in Emacs instances without
          scheme48.el.  That is, put this at the tops of files:

               ;;; -*- Mode: Scheme; scheme48-package: ... -*- lisp

               Avoid this at the tops of files:

                    ;;; -*- Mode: Scheme48 -*- lisp

                    There is also SLIME48, the Superior Lisp Interaction Mode for Emacs
                    with Scheme48.  It provides a considerably higher level of integration
                    the other Emacs packages do, although it is less mature.  It is at

                         http://mumble.net/~campbell/scheme/slime48.tar.gz; display

                         there is also a Darcs repository (Darcs is a revision control
                         system; see)

                              http://www.darcs.net/ display

                              for more details.} at

                                   http://mumble.net/~campbell/darcs/slime48/. display

                                   Finally, paredit.el implements pseudo-structural editing
                                   facilities for S-expressions: it automatically balances parentheses and
                                   provides a number of high-level operations on S-expressions.
                                   Paredit.el is available on the web at

                                        http://mumble.net/~campbell/emacs/paredit.el. display

                                        cmuscheme.el defines these:

                                         -- Emacs command: run-scheme [scheme-prog]
                                        Starts an inferior Scheme process or switches to a running one.  With
                                        no argument, this uses the value of scheme-program-name to run
                                        the inferior Scheme system; with a prefix argument SCHEME-PROG,
                                        this invokes SCHEME-PROG.

                                         -- Emacs variable: scheme-program-name
                                        The Scheme program to invoke for inferior Scheme processes.

                                        Under scheme48-mode with scheme.el, cmuscheme.el,
                                        and scheme48.el, these keys are defined:

                                   C-M-f --- forward-sexp
                                   C-M-b --- backward-sexp
                                   C-M-k --- kill-sexp
                                   ESC C-DEL (not C-M-DEL) --- backward-kill-sexp
                                   C-M-q --- indent-sexp
                                   C-M-@ --- mark-sexp
                                   C-M-SPC --- mark-sexp
                                        S-expression manipulation commands.  C-M-f moves forward by one
                                        S-expression; C-M-b moves backward by one.  C-M-k kills the
                                        S-expression following the point; ESC C-DEL kills the
                                        S-expression preceding the point.  C-M-q indents the S-expression
                                        following the point.  C-M-@ & C-M-SPC, equivalent to
                                        one another, mark the S-expression following the point.

                                   C-c z --- switch-to-scheme
                                        Switches to the inferior Scheme process buffer.

                                   C-c C-l --- scheme48-load-file
                                        Loads the file corresponding with the current buffer into Scheme48.  If
                                        that file was not previously loaded into Scheme48 with C-c C-l,
                                        Scheme48 records the current interaction environment in place as it
                                        loads the file; if the file was previously recorded, it is loaded into
                                        the recorded environment.  See Emacs integration commands.

                                   C-c C-r --- scheme48-send-region
                                   C-c M-r --- scheme48-send-region-and-go
                                        C-c C-r sends the currently selected region to the current
                                        inferior Scheme process.  The file of the current buffer is recorded as
                                        in the C-c C-l command, and code is evaluated in the recorded
                                        package.  C-c M-r does similarly, but subsequently also switches
                                        to the inferior Scheme process buffer.

                                   C-M-x --- scheme48-send-definition
                                   C-c C-e --- scheme48-send-definition
                                   C-c M-e --- scheme48-send-definition-and-go
                                        C-M-x (GNU convention) and C-c C-e send the top-level
                                        definition that the current point is within to the current inferior
                                        Scheme process.  C-c M-e does similarly, but subsequently also
                                        switches to the inferior Scheme process buffer.  C-c C-e and
                                        C-c M-e also respect Scheme48's file/environment mapping.

                                   C-x C-e --- scheme48-send-last-sexp
                                        Sends the S-expression preceding the point to the inferior Scheme
                                        process.  This also respects Scheme48's file/environment mapping.