franz inc logo  
  download techcorner franz inc franz inc store search franz inc          

products
services
support
about
success
resources

RSS Feeds

AllegroServe at opensource.franz.com

GNU Emacs on Windows

[Information on SLIME can be obtained here.]

We have packaged the standard gnu.org GNU Emacs 22.1 binaries into a downloadable installer for easy installation of GNU Emacs 22.1 on Microsoft Windows. The installer above is merely a repackaging of the gnu.org binaries (downloaded from ftp://ftp.gnu.org/pub/gnu/emacs/windows/emacs-22.1-bin-i386.zip ). We did not compile nor change in any way the GNU Emacs 22.1 binaries. We offer this repackaging in the hope that people find it easier to install.

The GNU Emacs Installer provides a simple means of installing Emacs and creating the Start Menu shortcuts for starting it. The installer also creates an uninstallation utility for quick and easy uninstallation of Emacs if you wish to remove it.

If the installer detects an installation of Allegro CL, it will also look for the Emacs initialization file .emacs and ask if you would like to add sample code for loading the Franz Inc. Emacs-Lisp interface. This code will be added to the file as comments, which you may uncomment in order to have the code take affect. If no .emacs file exists (or is found) the installer will ask if it can create one.

The installer was created with NSIS using install.nsi and makefile. You can read more about how to build the GNU Emacs installer here.

GNU Emacs on UNIX

GNU Emacs for UNIX platforms are available from http://www.gnu.org. We do not suuply an installer for GNU Emacs on UNIX platfoms. On that site, see in particular http:///directory.fsf.org/GNU/emacs.html.

Using the GNU Emacs-Allegro Common Lisp Interface

In order to use the Emacs-Lisp interface, you must load the necessary code into Emacs. The file to load is [Allegro directory]/eli/fi-site-init.el]. On Windows, the standard [Allegro directory] is c:/Program Files/acl81/ (on UNIX, it is /usr/local/acl81/). To load the file, you can evaluate the following form in the Emacs *scratch* buffer:

For Windows

(load "C:/Program Files/acl81/eli/fi-site-init.el") Control-J

For UNIX

(load "/usr/local/acl81/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. The standard location on Windows for a .emacs file is C:\, that is, the top-level directory on the C drive. (If you have a home directory, the .emacs should go there. Having a home directory on Windows is optional and many Windows users do not have one. Presumably, if you have one, you know it.)

The Emacs installer described above asks if you want a .emacs file installed. If you answered yes, the file C:\.emacs is created with the following contents (the directory where Allegro CL was installed -- C:/Program Files/acl81/ -- appears in several lines; that value was determined by searching for the location and if you installed in a different location, the different location should appear):

; This is sample code for starting and specifying defaults to the
; Emacs-Lisp interface. Uncomment this code if you want the ELI
; to load automatically when you start emacs.
; (push "C:/Program Files/acl81/eli" load-path)
; (load "fi-site-init.el")
;
; (setq fi:common-lisp-image-name "C:/Program Files/acl81/mlisp.exe")
; (setq fi:common-lisp-image-file "C:/Program Files/acl81/mlisp.dxl")
; (setq fi:common-lisp-directory "C:/Program Files/acl81")

You should uncomment (remove the leading semicolon) the lines

; (push "C:/Program Files/acl81/eli" load-path)
; (load "fi-site-init.el")

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). You may also wish to uncomment the three setq lines. They provide defaults for the fi:common-lisp function which we are about to describe. Below we have suggestions for additional code for the .emacs file. After uncommenting, the file should look like:

; This is sample code for starting and specifying defaults to the
; Emacs-Lisp interface. Uncomment this code if you want the ELI
; to load automatically when you start emacs.
 (push "C:/Program Files/acl81/eli" load-path)
 (load "fi-site-init.el")
;
 (setq fi:common-lisp-image-name "C:/Program Files/acl81/mlisp.exe")
 (setq fi:common-lisp-image-file "C:/Program Files/acl81/mlisp.dxl")
 (setq fi:common-lisp-directory "C:/Program Files/acl81")

If you did not have a .emacs file created when you installed Emacs, or if you are on UNIX, 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 into the buffer and uncomment the necessary lines as described. Then press the keys Control-X Control-S. The new .emacs file will be created and saved. For UNIX, replace C:/Program Files/ with /usr/local/ and do not use the .exe extension.

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:/program files/acl81/ on Windows and /usr/local/acl81/ 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:/Program Files/acl81/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:/program files/acl81/alisp.exe, c:/program files/acl81/mlisp.exe, or c:/program files/acl81/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, replace c:/program files/ with /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/acl8.1/mlisp).

(defun run-lisp ()
  (interactive)
  (fi:common-lisp "*common-lisp*"
                  "c:/program files/acl81/"
                  "c:/program files/acl81/mlisp.exe"
                  '("+B" "+cn")
                  "localhost"
                  "c:/program files/acl81/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.

 

© 2008 Franz Inc - Privacy Statement
[ Consulting Services | Packages/Pricing | Allegro NFS | Certification Program ]