Using XEmacs as a lisp shell

From GLUG-BOM

You are here : Main Page > Howtos > Using XEmacs as a lisp shell

Contents

Objective

This document explains how to set up a interactive lisp environment in XEmacs.

Scenario

Normally, something on the lines of ``apt-get install clisp'' is all that I would require to get going with lisp. Adding contraints makes the problem more interesting. The goal is to learn lisp with below limitations:
1) No Linux, not even in a VM.
2) Interactive environment required.
3) Windows 2000, not even XP.

I decided to use XEmacs to practice Lisp since one of the menus had an option to execute lisp functions. However it was not clear as to how to use it interactively. That is, a lisp shell was required.

Approach taken: XEmacs + slime + GNU Common Lisp

Download links

XEmacs  : http://ftp.xemacs.org/xemacs/binaries/win32/InnoSetup/ I selected 21.4.19.
Slime  :     http://common-lisp.net/project/slime/#downloading


GNU lisp : ftp://ftp.cs.utexas.edu/pub/novak/gcl/gcl-2.6.1.exe (I used this one.)
                ftp://ftp.gnu.org/pub/gnu/gcl/binaries/stable

Installation

XEmacs and GNU lisp are simple Windows installers. The only precaution I would recommend are to avoid spaces in directory paths. As we will see later, backslashes have to be escaped in the (startup) init.el file.

Installing slime consists simply of extracting the .zip file to any convenient location.


Setting up the init.el file


The following lines have to be in your ~\.xemacs\init.el. In case of MS, ~ is your drive:\Documents and Settings\<username>\ directory.


(setq inferior-lisp-program "C:\\gcl\\lib\\gcl-2.6.1\\unixport\\saved_gcl.exe"
lisp-indent-function 'common-lisp-indent-function ); path to your GNU lisp executable above
(add-to-list 'load-path "C:\\slimedir\\slime-2.0") ; path to slime
(require 'slime)
(slime-setup)

Note that the backslashes have to be escaped.


Notation used

C-u stands for Control-u,
M-x stands for Alt-x. Esc-x also works.

Starting SLIME

Start XEmacs. The minibuffer (status bar cum command input/output form) at the bottom of the screen will show some activity "loading ...". Split the main buffer into two: C-x 2 Go to the second buffer: C-x o Then type: M-x slime

This starts a SLIME instance also called a REPL (Read Evaluate Print Loop). It behaves exactly like a lisp shell. This can be used for evaluating lisp expressions at the prompt as well as executing saved functions using load file.


Acknowledgments



1) As usual stfw
2) Vihan Pandey's pointers