How to Load and Run Allegro Common LISP (v5.0.1 Enterprise)

These instructions pertain to the installation at the University of Texas but, except for the file paths, should also be applicable to other installations with appropriate changes.. Instructions for other versions of Allegro Common LISP:

Setup

Allegro Common LISP v5.0.1 is available on all of the departmental machines. The best way to run LISP is in an Emacs buffer, however if you want to run LISP from the UNIX shell, type acl. The binary is in the directory /lusr/bin.

However, the best way to run LISP is as a subprocess of Emacs. To do this you need to make some changes to your ".emacs" file and to your LISP initialization file, ".clinit.cl".

1. Set up your UNIX environment

  1. Put /lusr/bin in your path variable.

2. Set up your ".emacs" file

Add the following lines to the file (by the way, "fi" stands for "Franz Incorporated"):
  1. (setq load-path (cons "/lusr/lib/franz/acl5.0.1-enterprise/eli/" load-path))
  2. (autoload 'fi:common-lisp "fi-site-init" "" t)
  3. (global-set-key "\C-cl" 'fi:toggle-to-lisp) -- this is useful
  4. (setq fi:common-lisp-image-name "lisp")

3. Set up your ".clinit.cl" file

Allegro Common LISP will automatically load a file called ".clinit.cl" if it exists in your home directory. You can use this file to automatically load certain files or perform certain operations whenever you start LISP.

I have the following code in my ".clinit.cl" file:


(in-package :cl-user)

;;; Set a few top-level variables.
(tpl:setq-default top-level:*history*            50)
(tpl:setq-default top-level:*print-length*      NIL)
(tpl:setq-default top-level:*print-level*       NIL)
(tpl:setq-default top-level:*zoom-print-level*   10)
(tpl:setq-default top-level:*zoom-print-length*  10)
(tpl:setq-default top-level:*exit-on-eof*       NIL)

;;; Have packages print with their shortest nickname 
;;; instead of the package name.
(tpl:setq-default *print-nickname* t)

;;; Only print "Compiling" messages for files, not for individual functions,
;;; unless there is a warning or error.
(tpl:setq-default *compile-verbose* t)
(tpl:setq-default *compile-print* nil)

;; Suppress GC messages
(SYS::GSGC-SET-SWITCH :print NIL)


;; The last thing...print the current directory.
(print (current-directory))

4. Start LISP from Emacs

Do the command: M-x fi:common-lisp

Common problems


Emacs doesn't understand Allegro-specific commands

Example: You are editing a LISP source file and you want to compile a function using the command ctrl-c ctrl-s. However, Emacs beeps and says it doesn't understand.

Diagnosis: You started editing the file before you started Common LISP, so the buffer is in COMMON-LISP mode instead of FI:COMMON-LISP mode.

Solution: Place the source file buffer in the correct mode by typing: M-x fi:common-lisp-mode


The LISP apropos command doesn't seem to work

Example: You have defined a function called longest but the command (apropos "long" :CL-USER) doesn't list it.

Diagnosis: You are running on a UNIX machine.

Solution: Use uppercase in the search strings, as in: (apropos "LONG" :CL-USER).


Your functions act strange after recompiling and reloading them

Example: Your function, which used to work fine, has a segmentation fault, or acts like certain global variables are not initialized correctly.

Solution: Use (defparameter ...) to define global variables instead of defvar. Also turn off all tracing before compiling functions. Use (untrace) to untrace all functions. (This is a bug in ACL).


Inside Allegro Common LISP

The ACL shell accepts a set of keyword commands. For example, :LD loads a file. Here is a list of ACL commands. Also, the Allegro Emacs-Lisp interface defines a set of Emacs commands to manipulate files and program components. Type ctrl-h m in a LISP mode buffer to list the available commands.
[Algernon home]

This page was created by

Micheal Hewett