Emacs installation

  1. Unpack the archive

    The emacs-21.1 archive contains directory information and long filenames, which both must be preserved when unpacking the files (see your unpacker help). Unpack the archive to your programs directory, e.g. C:\Programs. The unpacker will create the directory \emacs-21.1 in your programs directory with the subdirectories \bin, \etc, \info, \lisp, and perhaps the empty subdirectories \lock and \site-lisp. To save some typing I suggest to rename the emacs directory e.g. to \emacs211.

  2. Create the \emacsen subdirectory

    In order to make future updates of NTEmacs as painless as possible, it is useful to keep all Elisp and other files that you will add to your basic NTEmacs installation in a separate directory. Therefore create a sibling of the emacs directory like C:\Programs\emacsen. The trick is that you can add and remove future versions of NTEmacs without touching your local add-ons. You can even run a new version in parallel to your existing version to see whether some of your local add-ons break. In this new subdirectory, create the subdirectories \bin and \site-lisp.

  3. Adjust PATH

    Add the \emacs211\bin and \emacsen\bin directories to the PATH environment variable. This will let you start Emacs from the command line. In the control panel, select the "Environment" tab in the System dialog. Append the \bin directories, e.g. c:\Programs\emacs211\bin;c:\Programs\emacsen\bin to the PATH environment variable (this is a semicolon-separated list of directories) in the system variables panel (the upper one in WinNT, the lower one in Win2000) and press Set. Close the dialog by pressing Ok.

  4. Create HOME

    Every user on your NT/2000/XP box has to define an environment variable called HOME. This variable will let Emacs find the personal _emacs file. Depending on your system, HOME should point either to a local or a network home directory. The variable is set via the control panel. Select the "Environment" tab in the System dialog and create HOME in the user variables panel (the lower one in NT, the upper one in Win2000 - by now you should see the pattern. I'll leave it as an extra bit of brain jogging for the XP users to find out where the panel is on their systems). Set its value to the appropriate directory, e.g. c:\User\myself and press Set. You can also use %HOMEDRIVE%%HOMEPATH% as a value for HOME instead. Close the dialog by pressing Ok.

    If you want to set up Emacs with a system-wide configuration file, set the HOME environment variable of your administrator account to an appropriate directory. After completing the whole SGML setup procedure from your administrator account, simply move the contents of the _emacs in your administrator home directory to one of the system-wide configuration files. This will be described at the end of this tutorial.

  5. Set the load-path

    Now you'll have to make the first customizations to the _emacs file. The variable load-path tells Emacs where to look for Lisp files. The following chunk of code should be pretty much at the top of your _emacs file as other packages depend on load-path.

    ;; append some additional paths to load-path
    (setq load-path
           (nconc load-path (list "C:/Programs/emacsen/site-lisp"
             "C:/Programs/emacsen/site-lisp/psgml-1.2.4")))
       
    

    Adjust the paths as necessary. You could extend this list of paths for any additional Emacs Lisp packages that you install.

    Note: This code adds the path of the PSGML package that we will install in the next chapter. Just keep in mind that we already took care of load-path at this point.