Using Allegro Common Lisp 5.0 in Emacs


Configuring Emacs

Information on the Emacs interface for ACL5 can be found in /lusr/lib/franz/acl5/eli/doc/eli.htm. You may also want to look at keybindings for the common-lisp mode in that readme file. A sample of what to put in your ~/.emacs file to use the emacs interface follows; or just copy the version in ~mooney/cs351-code/.emacs to your home directory:

;;;; Configure ACL Elisp interface
(defvar acl-dir (if (file-directory-p "/lusr/lib/franz/acl5-libc6/")
                    "/lusr/lib/franz/acl5-libc6/" ; Linux libc6 hack
                  "/lusr/lib/franz/acl5/")
  "root directory for Allegro Common Lisp")

(defvar acl-eli-dir (concat acl-dir "eli/") 
  "root directory for the Elisp interface to Allegro Common Lisp")

(autoload 'fi:common-lisp (concat acl-eli-dir "fi-site-init") 
  "Start the ACL Elisp interface" t)

;; Pick a Lisp image to use
(cond ((and window-system (file-readable-p (concat acl-dir "composer.dxl")))
       (setq fi:common-lisp-image-name (concat acl-dir "composer"))
       (setq fi:common-lisp-image-file (concat acl-dir "composer.dxl")))
      (t
       (setq fi:common-lisp-image-name (concat acl-dir "lisp"))
       (setq fi:common-lisp-image-file (concat acl-dir "lisp.dxl"))))

Starting Lisp

With that in your ~/.emacs, you can then invoke the ACL5 interface with M-x fi:common-lisp. The first time you invoke fi:common-lisp in an emacs session, it will ask several questions. You can just accept the default for each question by hitting the Return key. You will be asked those questions each time an emacs process runs the fi:common-lisp function, but only once for any given emacs process.

If you prefer, when it asks for a Process directory:, you can pick whatever directory you're keeping your cs351 files in, such as e.g. ~/cs351/. You can make that directory the default by adding to your ~/.emacs file:

(setq fi:common-lisp-directory "~/cs351/")

If you're using the Composer (you need this to run the nicer window debugger), you may need to use the Unix xhost command (or other X-windows security commands) to allow the Lisp process to connect to your X-server when executing Start Composer from the emacs Composer menu. In Unix just execute xhost host, where host is the name of the machine you are using. Also, note that the Composer is not available on all platforms. Try the Suns in the basement of Taylor if you'd like to use Composer or other tools that depend upon it.

Emacs and the HyperSpec

Emacs users may also be interested in Erik Naggum's hyperspec.el, an Emacs lisp package that uses browse-url.el to command a web browser to look up a symbol in the Common Lisp HyperSpec.

You'll need to put the hyperspec.el file somewhere in your emacs load-path for this to work. You can do that by making a directory called ~/elisp, putting hyperspec.el in that directory, and then adding the following at the beginning of your ~/.emacs file:

(setq load-path (cons "~/elisp/" load-path))

I use the following code in my ~/.emacs to bind the key sequence C-c h to lookup the symbol at the point in the HyperSpec:

(defun use-hyperspec ()
  (require 'hyperspec)
  (local-set-key "\C-ch" 'common-lisp-hyperspec))

(add-hook 'fi:lisp-mode-hook 'use-hyperspec)

To lookup a symbol in the Common Lisp HyperSpec, have a copy of Netscape running (or configure browse-url for your browser of choice), put the emacs point (cursor) on top of a Common Lisp symbol in a buffer, and hit C-c h. The web browser should display the relevant part of the HyperSpec.

You may also need a copy of browse-url.el, if your version of emacs doesn't come with one, or the one you have is too old (or too new) to work with hyperspec.el.


Last Updated: Jan 19, 1999
sferris@cs.utexas.edu