Home > slime48

slime48

Slime48 is a project mainly written in SCHEME and EMACS LISP, it's free.

Unofficial git mirror of slime48 for scheme48 1.3.

  • SLIME for Scheme48 1.3 -- outline --

This directory contains the source files that implement a Scheme48 back end for the Superior Lisp Interaction Mode for Emacs. Refer to http://common-lisp.net/project/slime/ for more details on SLIME in general.

This code, and the documentation in this file, is written by Taylor Campbell and placed in the Public Domain. All warranties are disclaimed.

** Emacs Setup

To set up SLIME48 for use in Emacs, add these lines to your .emacs file:

(add-to-list 'load-path "/path/to/slime") (add-to-list 'load-path "/path/to/slime48") ;; If these two directories are the same, i.e. if you obtained the ;; all-in-one SLIME48 tarball, you can skip one of the above two ;; lines.

(autoload 'slime "slime" "Start an inferior^_superior Lisp and connect to its Swank server." t)

(autoload 'slime-mode "slime" "SLIME: The Superior Lisp Interaction Mode for Emacs (minor-mode)." t)

(eval-after-load "slime" '(progn (slime-setup) (setq slime-lisp-implementations `((s48 ("scheme48") :init slime48-init-command) ,@slime-lisp-implementations))))

(autoload 'slime48-init-command "slime48" "Return a string to initialize Scheme48 running under SLIME.")

;; This snippet lets you specify a scheme48-package local variable, ;; in a file's -- line or local variables section, and have SLIME48 ;; automatically evaluate code in the right package. For instance, ;; all of my Scheme48 source files start with: ;; ;;; -- Mode: Scheme; scheme48-package: ... -*- (eval-after-load "slime48" '(add-hook 'slime-mode-hook (lambda () (if (and (boundp 'scheme48-package) scheme48-package) (setq slime-buffer-package (with-output-to-string (princ scheme48-package)))))))

** Starting SLIME48

To start up SLIME48, then, type M-- M-x slime RET s48 RET.

Warning: THIS IS NOT SECURE! ANYONE MAY CONNECT TO THE SWANK SERVER ON THE PORT AND DO ARBITRARY THINGS IN YOUR SCHEME48 SYSTEM! DO NOT RUN THIS ON AN INSECURE NETWORK!

(This is due to a deficiency in Scheme48's networking interface. It is being worked on.)

Loading SLIME48 may take a little while. You will see several warnings. Expect warnings about structures having undefined exports named SWANK:..., which correspond both to unimplemented features and to CL-specific things that you would never encounter in Scheme. If you encounter a warning about a Swank RPC call for a feature you want, or a different kind of warning, please contact me by means specified at the bottom of this file.

** Special Packages in SLIME48

Like the Scheme48 command processor, there are three special packages in SLIME48 which are accessible to the user but not through any structures defined in the config package. These three packages are the user package, the config package itself, and the Swank RPC package. The user package is the default initial package for SLIME48 sessions; it corresponds with the user package of the Scheme48 command processor. The config package is the same as in the Scheme48 command processor; that is, it contains all module definitions and the configuration language. The Swank RPC package is the environment in which RPCs sent by Emacs are evaluated.

These packages are identified by the names (USER), (CONFIG), and (SWANK-RPC). This helps to distinguish them from bindings defined in the config package. Also, the notation for the config package is common to SLIME48 and scheme48.el, so it is conventional to write this line at the tops of files in the configuration language:

;;; -- Mode: Scheme; scheme48-package: (config) --

There are also SLIME REPL shortcuts defined for access to the user and config packages; see below.

The Swank RPC package is most likely not useful to many users, and should generally be avoided. It may vanish in a future SLIME48.

** Scheme Buffer Setup

In order to get SLIME integration into Scheme buffers, you can do one of several things:

  1. Always manually enable the SLIME minor mode with M-x slime-mode in all buffers you wish it to be enabled in. This can be a bother.
  2. Automatically enable it in all Scheme buffers: (add-hook 'scheme-mode-hook (lambda () (slime-mode +1))) This can be annoying in non-Scheme48 buffers.
  3. Conditionally enable it based on the scheme48-package local variable, which you can specify in files you want to have SLIME48 enabled in (which you should do anyway): (add-hook 'hack-local-variables-hook (lambda () (if (and (boundp 'scheme48-package) scheme48-package) (slime-mode +1))))

** Utilities in slime48.el

The slime48.el file that comes with SLIME48 defines several conveniences for SLIME48. It is automatically loaded by the above initialization code.

*** REPL Presentations

By default, REPL presentations are disabled. You can enable them in SLIME48 with these commands defined in slime48.el (which the above initialization code loads):

M-x slime48-toggle-presentations RET M-x slime48-enable-presentations RET M-x slime48-disable-presentations RET

Note that these commands will not work in Common Lisp SLIME instances; they are specific to Scheme48.

*** REPL Shortcuts

SLIME48 adds three new REPL shortcuts, which will work only in Scheme48 SLIME instances, not Common Lisp SLIME instances:

,USER Switches to the USER environment, which is the initial one for general interaction.

,CONFIG Switches to the config environment, for loading package & interface definitions. For example, to load the package & interface definitions in the file /foo/bar/packages.scm, you might type this: ,config RET ,cl RET /foo/bar/packages.scm RET

,USE-PACKAGE package Opens the supplied package into the interaction environment. This is like the ,OPEN command of Scheme48's command processor; the name USE-PACKAGE comes from the hope that it might be implemented in a CL-friendly way (where the function really is called USE-PACKAGE) in the offical SLIME.

** Unimplemented Features

If, while working with SLIME, you end up trying to use an unimplemented feature (of which there are many), and you are thrown into SLDB because of that, just hit `a' to abort the request sent by Emacs to call the unimplemented feature. Contact me by means described below if you encounter an unimplemented feature that you would like me to implement.

** Restarts

SLIME48 implements its own restart system, which I hope to see in the official Scheme48 at some point. It is a very simple system, but it lacks much integration, which will be added in later versions of SLIME48. Typically, you will see only ABORT restarts for aborting SLIME requests; RESET restarts for returning to an SLDB level and killing all threads there; and RESUME restarts for returning to an SLDB level, killing the thread that caused another level to be pushed, and resuming the operation of all other threads on that level. (The latter two correspond with Scheme48's ,RESET and ,RESUME commands.)

Also, references to undefined variables are now restartable. You get three restarters: one to simply substitute a value in the place of the reference, one to define the variable to a given value and use that value, and one to substitute a different variable altogether for that reference and use its value.

Note that SLIME48 presents restarts in the opposite order from the CL SLIME back ends. I consider this presentation more useful: the SLDB window centres on the top of the backtrace and bottom of the restart list, so logically one should see the restarts most relevant to the error there. Also, the lowest numbers are at the top of the list, so, with the order of presentation in SLIME48, 0 will always reset the top level & 1 will always resume the top level; you don't need to look for the number to select those restarts: you can just remember those two useful ones.

** Contact

Send questions, comments, bugs, feature requests, &c., to the email address formed with the little-endian order of net.mumble with the username campbell; or address them to Riastradh on the Freenode IRC network, irc.freenode.net, in the #scheme channel.