GNU Emacs for Allegro CL Express

Emacs (written in a Lisp dialect) has a long standing tradition of being the preferred code editor for many developers. We also recognize that many developers prefer a graphical environment so we provide an IDE for Windows, Mac, and Linux platforms.

Whether you prefer Emacs or our IDE, rest assured that either will expose the full flexibility offered from Common Lisp.

For Emacs, you can either use SLIME or our Emacs-Lisp Interface (ELI). This document deals exclusively with our interface.

Instructions for installation of Emacs for the various platforms are noted below.

Windows

Download and Install Emacs

The FSF now packages GNU Emacs for installation on Windows. Their installer can be found on ftp.gnu.org/gnu/emacs/windows/.

Configuring ELI

In order to use the Emacs-Lisp interface, you must load the necessary code into Emacs.

If you did not have a .emacs file created when you installed Emacs, use Emacs to install one or appropriately modify an existing one now. In Emacs, press the keys Control-X Control-F. You are prompted for a file to open. Enter c:\.emacs. A buffer will be opened indicating a new file (or an existing file if one already exists). Copy the contents of the sample .emacs file, noted below, into the buffer.

; This is sample code for starting and specifying defaults to the
; Emacs-Lisp interface. 
 (push "C:/acl11.0express/eli" load-path)
 (load "fi-site-init.el")
;
 (setq fi:common-lisp-image-name "C:/acl11.0express/allegro-express.exe")
 (setq fi:common-lisp-image-file "C:/acl11.0express/allegro-express.dxl")
 (setq fi:common-lisp-directory "C:/acl11.0express")

Then press the keys Control-X Control-S. The new .emacs file will be created and saved.

Again, the location pushed onto the load-path (which tells Emacs where to look for files to load) is determined by where Allegro CL is found by the Emacs installer, and so it should be correct (modify it if for any reason it is incorrect).

See the Emacs Usages Notes on this page for instructions on how to start Allegro CL.

Mac

Emacs on Mac OSX

There are two choices for GNU Emacs on Mac OS X: Aquamacs and the more vanilla Emacs for Mac OS X, both are built from FSF GNU Emacs.

Install Aquamacs as directed, then start it.

 

Configuring ELI

In Aquamacs, press the keys Control-X Control-F. You are prompted for a file to open. Enter "~\.emacs". A buffer will be opened indicating a new file (or an existing file if one already exists). Copy the contents of the sample .emacs file, noted below, into the buffer.

; This is sample code for starting and specifying defaults to the
; Emacs-Lisp interface.
  (push "/Applications/AllegroCL64.app/Contents/Resources/eli" load-path)
  (load "fi-site-init.el")
;
  (setq fi:common-lisp-image-name
    "/Applications/AllegroCL64express.app/Contents/Resources/alisp")
  (setq fi:common-lisp-image-file
    "/Applications/AllegroCL64express.app/Contents/Resources/alisp.dxl")
  (setq fi:common-lisp-directory
    "/Applications/AllegroCL64express.app/Contents/Resources/")

Then press the keys Control-X Control-S. The new .emacs file will be created and saved.

Again, the location pushed onto the load-path (which tells Emacs where to look for files to load) is determined by where Allegro CL is found by the Emacs installer, and so it should be correct (modify it if for any reason it is incorrect).

See the Emacs Usages Notes on this page for instructions on how to start Allegro CL.

Unix

GNU Emacs on UNIX

Ubuntu users: run the emacs command from a terminal and the installation instructions will be printed by the stub emacs command.

If you are using another Linux/Unix platform you can download GNU Emacs from http://directory.fsf.org/GNU/emacs.html.

Configuring ELI

In order to use the Emacs-Lisp interface, you must load the necessary code into Emacs. To load the file, you can evaluate the following form in the Emacs *scratch* buffer:

    (load "/usr/local/acl11.0express/eli/fi-site-init.el") Control-J

Pressing Control-J in the *scratch* buffer causes a form to be evaluated by Emacs (a simple carriage-return does not do that).

But rather than evaluating that form each time you run Emacs, it is better to have a .emacs file that includes that form. The .emacs file is loaded into Emacs whenever Emacs is started.

If you did not have a .emacs file created when you installed Emacs, use Emacs to install one or appropriately modify an existing one now. In Emacs, press the keys Control-X Control-F. You are prompted for a file to open. A buffer will be opened indicating a new file (or an existing file if one already exists). Copy the contents of the sample .emacs file, noted below, into the buffer. Then press the keys Control-X Control-S. The new .emacs file will be created and saved.

; This is sample code for starting and specifying defaults to the
; Emacs-Lisp interface. 
  (push "usr/local/acl11.0express/eli" load-path)
  (load "fi-site-init.el")
  (setq fi:common-lisp-image-name "usr/local/acl11.0express/alisp")
  (setq fi:common-lisp-image-file "usr/local/acl11.0express/alisp.dxl")
  (setq fi:common-lisp-directory "usr/local/acl11.0express")

See the Emacs Usages Notes on this page for instructions on how to start Allegro CL.

 

Emacs Usage Notes

Some Emacs usage notes

If you are new to Emacs, you may want to look at the Emacs Tutorial, accessed with the Help menu on the Emacs menu bar. In this section, we will just provide brief usage notes which are in no way equivalent to a tutorial.

The Meta key

Many Emacs commands require pressing the Meta key. But there is no key labeled `Meta'. On Windows, usually the Alt keys serve as the Meta key. The Alt keys are on typically either side of the space bar. UNIX keyboards are too varied to make a definite suggestion, but often a key next or near the Space bar serves as the Meta key.

In Emacs, try pressing Alt-x. If M-x appears in the minibuffer (the bottom bar of the Emacs window), then the Alt key is serving as the Meta key. If you cannot find a Meta key (one that when you hold it down and press x, M-x appears in the minibuffer), press the Escape key and then the x key. That should always work, although it is less convenient.

The Meta key is typically abbreviated M- in Emacs documentation, just as the Control key is abbreviated C-. Case matters with the Meta key (Meta-Shift-A is different from Meta-A) but does not matter with the Control key.

Starting Lisp in Emacs

Once the eli/fi-site-init file is loaded into Emacs, you can start Allegro CL by entering M-x fi:common-lisp (press the Meta key and the x key simultaneously and then enter `fi:common-lisp', or press the Escape key, the `x' key, and then `fi:common-lisp'). You are prompted in the minibuffer for

  • a buffer name: accept the default *common-lisp*.
  • a host: accept the default localhost.
  • a process directory: the default is the Allegro directory (typically c:/acl11.0/ on Windows and /usr/local/acl11.0/ on UNIX), which is a reasonable choice, but specify a different existing directory if you wish.
  • a Lisp executable program: unless you uncommented the (setq fi:common-lisp-image-name "C:/acl11.0/mlisp.exe") line in the suggested .emacs file, the default will be alisp, which actually does not work on the Windows (the executable on Windows is alisp.exe); specify one of the Lisp executables such as c:/acl11.0/alisp.exe, c:/acl11.0/mlisp.exe, or c:/acl11.0/allegro.exe. If you did uncomment that line in the .emacs file, accept it or specify a different executable. Note the directory path must be included. On UNIX, use /usr/local/ and do not use the .exe extension.
  • a Lisp image (dxl) file: accept the default.
  • Image arguments (separated by spaces): the default on Windows is +B +cn (no splash screen, create but hide the Lisp console). Add additional arguments if you wish (see Command line arguments in startup.htm for a list of command-line arguments).

After specifying the command-line arguments, Allegro CL is started. If you specified the allegro.exe executable, the IDE will start up as well (the IDE has its own editor and many users use it instead of Emacs, but using Emacs works as well).

Some useful Emacs commands

  • C-x C-c: exit emacs.
  • C-x N: split the Emacs window into N buffers (N is typically 1 or 2).
  • C-h b: display the keybindings in effect in the current buffer (C-h brings up help, C-h ? give more information about available help).
  • C-c C-p: display an earlier command (repeated C-c C-p goes through a ring of earlier commands).
  • C-c C-r: you are prompted in the minibuffer for text, then the most recent command containing that text is displayed.
  • C-c C-s: evaluate or compile last S-expression. (This is useful when editing Lisp source in a file.)
  • C-c C-s: evaluate or compile the current region. (This is useful when editing Lisp source in a file.)
  • C-c a: display the argument list in the minibuffer (you are prompted for the function name, with the default the nearest symbol).
  • C-c ?: like apropos (you are prompted for text, then all symbols whose names contain that text are displayed in a buffer).

Emacs also has a menu bar. Menu commands can be used in place of key chords (a key chord is multiple keys pressed simultaneously, like M-x). The menus typically show the key chords equivalents of menu commands.

Other .emacs file suggestions

An Emacs function like the following will start the indicated Lisp executable without prompting you for details (as fi:common-lisp does). It is useful if you rarely vary the answers to the prompts. If you regularly run several images, you can write several such functions. Replace the values specified with the appropriate/desired values, of course. In particular, on UNIX, replace c:/program files/ with /usr/local/ and do not use the .exe extension (so /usr/local/acl11.0/mlisp).

(defun run-lisp ()
  (interactive)
  (fi:common-lisp "*common-lisp*"
                  "c:/acl11.0/"
                  "c:/acl11.0/mlisp.exe"
                  '("+B" "+cn")
                  "localhost"
                  "c:/acl11.0/mlisp.dxl"))

Other notes

Do not start more that one Lisp in a single emacs.

eli.htm is the documentation file for the Emacs-Lisp interface.

Emacs-Lisp Interface and Patches

You can use sys:update-allegro to get the latest patches for ELI. There were patches after the release of Allegro CL 11.0 that allowed it to run with GNU Emacs versions released after 11.0 came out.

Source code for Emacs-Lisp Interface

The source code for ELI is on github.

New Emacs Book

Copyright © Franz Inc., All Rights Reserved | Privacy Statement Twitter