CSDE Installation Guide

Note: This is copied from the JDE installation page. I have tried to make the right edits to reflect what is/is not needed by the CSharp mode, but may have made mistakes (am only human). Please send corrections to Matt Bruce

Welcome to the CSDE Installation Guide. This guide shows you how to install the CSDE on Unix platforms (see Unix Installation) and on Windows platforms (see Windows Installation in English or German). See XEmacs Setup for information on configuring XEmacs to run the CSDE.

Note If you are new to Emacs, you should read the Init File section in the Customization section of the online Emacs manual before attempting to install the CSDE.

Unix Installation

  1. Install the CSDE files on your file system.

    The Unix CSDE distribution file is a zipped tar file. The easiest way to install the CSDE files is to copy the distribution file to the directory where you want the CSDE to reside permanently. Then enter

    gzip -cd csde-csharp.tar.gz | tar xvf -

    at the command line. This command will create a "csharp" subdirectory in the current directory and copy the CSDE files and documentation to the newly created directory.

  2. Download the latest versions of Eric Ludlam's speedbar, eieio, and semantic bovinator packages and install them on your system, each in their own directory.

    You can download these packages from SourceForge.

    Note Emacs and XEmacs include earlier versions of speedbar that are incompatible with the CSDE. You must delete the earlier version or ensure that it is not on the Emacs load path. Otherwise you will get a Lisp error when trying to start Emacs.

  3. Download the Emacs Lisp library package from the JDE (Java Development Environment) website in in compressed tar or zip format. Uncompress and install the package in a convenient location, for example, in your Emacs site directory.

  4. Update the Emacs Lisp load path.

    You must tell Emacs where the CSDE and its required packages live. You can do this by adding Lisp forms to your Emacs startup (.emacs) file that update the Emacs load-path variable, which lists the paths that Emacs searches when looking for Lisp packages required by commands that you execute. The following is an example of how to do this.

    (add-to-list 'load-path (expand-file-name "~/emsharp/site/csharp"))
    (add-to-list 'load-path (expand-file-name "~/emacs/site/semantic"))
    (add-to-list 'load-path (expand-file-name "~/emacs/site/speedbar"))
    (add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))
    (add-to-list 'load-path (expand-file-name "~/emacs/site/eieio"))

  5. Ensure that the CSDE is loaded at Emacs startup.

    To ensure this, add the following line to your .emacs file:

    (require 'csde)

    Be sure to add this line after the line that updates the load path (see step 3).

    Note See minimal .emacs file for an example of the minimal setup file required to run the CSDE with Emacs.

  6. Compile the CSDE's Lisp files.

    Note You do not have to compile the CSDE Lisp files to use the CSDE. However, compiling the files can reduce Emacs startup time and speed some operations.

    The easiest way to compile the files is to use the CSDE command csde-compile-csde.

    The CSDE's lisp directory contains a makefile that compiles the CSDE Lisp files. The makefile assumes that you are using GNU Emacs and that the packages required by the CSDE are installed in the same directory as the CSDE package itself, i.e., the makefile assumes a directory structure similar to the following:

      site
        csde
        speedbar
        semantic
        elib
        eieio
    

    If your installation does not fit these assumptions, edit the makefile to reflect your installation.

    If Emacs is not on your path, you can specify it on the make command line, e.g.,

    make EMACS=d:/Applications/emacs/emacs.exe
    

Windows 95/98/NT Installation

This section provides instructions for installing a full-featured CSDE setup on Windows. This section includes instructions for installing and integrating the following packages:

Installing Emacs

  1. Download the latest precompiled version of Emacs from the NT/Emacs ftp site.

    Note The distribution comes in zipped tar format. Tape archive (tar) format is a Unix file format for storing multiple files in a single file for archiving or transport to other systems. To unpack the Emacs distribution, you will need an unzip utility that can handle zipped tar files. The popular WinZip utility can handle zipped tar files. You can also use Windows versions of the Unix gzip and tar facilities to unzip and untar the Emacs distribution. You can find precompiled versions of the compression and archive utilities at the NT/Emacs site.

  2. Unpack Emacs into a directory of your choice.

    For example, I unpacked my copy into d:/emacs

    You should find a file named README as a part of the distribution. Be sure to read this file for information on installing Emacs.

  3. Register Emacs.

    Let's assume that the directory in which you have unpacked Emacs is d:/emacs. First, run the program addpm.exe from the Emacs bin directory. The easiest way to do this is to open a Windows Explorer window on the bin directory (for example, d:\emacs\bin) and double-click the addpm.exe entry. Or you can invoke addpm.exe from a Windows command shell by entering, for example, the following lines:

          cd d:\emacs\bin   
       addpm.exe

    Invoking addpm.exe creates a set of registry keys that tell Emacs where to find its support files (lisp, info, etc.). It also creates a folder containing an icon linked to runemacs.exe (a wrapper program for invoking Emacs).

    Now, to run Emacs, simply click on the icon in the newly created folder or invoke runemacs.exe from a command prompt.

  4. Create a home directory in your computer's filesystem.

    The home directory is the directory where Emacs expects to find your Emacs startup file (see next step). The home directory is also where the bash shell (see Installing the Cygnus Unix Distribution) expects to find the various startup files that it recognizes. Creating a home directory involves two steps. First, create the directory. It can be located anywhere you choose and can have any name. (I follow a pseudo Unix convention on my system by naming my home directory: c:\usr\home.). Then, create a HOME environment variable that points to the home directory.

    Note: Creating a home directory is not a prerequisite to installing Emacs. If you do not specify a home directory via a HOME variable, Emacs assumes that your home directory is c:\. However, putting your startup file(s) in a separate directory makes them easier to manage.

  5. Create an empty Emacs startup file in your home directory.

    The startup file can be named either _emacs or .emacs. If you have both files in your home directory, Emacs will load the .emacs file and ignore _emacs. For more information on startup files, see startup.

  6. Create an Emacs add-on directory for storing Emacs Lisp packages that do not come with the core Emacs distribution, a prime example, being the CSDE itself.

    Some Emacs users simply dump add-on packages into the Emacs core lisp directory. However, it is better to keep add-on packages in a separate directory to avoid overwriting the add-on packages when you update the core distribution. On my system, the add-on directory is located at c:\usr\home\emacs\site.

    You must add the site directory to the Emacs load-path, i.e., the list of directories where Emacs searches for packages that you require. You do this by inserting at the head of your .emacs file Lisp code that prepends the site directory to the load path, e.g.,

        
      (add-to-list 'load-path (expand-file-name "~/emacs/site/csharp"))
      (add-to-list 'load-path (expand-file-name "~/emacs/site/semantic"))
      (add-to-list 'load-path (expand-file-name "~/emacs/site/speedbar"))
      (add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))
      (add-to-list 'load-path (expand-file-name "~/emacs/site/eieio"))
    

    Note that, following Unix convention, NT/Emacs replaces the tilde (~) character in paths with the path of your home directory.

  7. Set up Emacs to use a browser.

    See Specifying a Browser for information on configuring Emacs to use a browser.

  8. Set up Emacs to emulate Windows editor key bindings and mouse selection mode.

Emacs's default text selection mode and cut-and-paste key bindings differ from the CUA standard used by Windows. (Hardly surprising, as Emacs antedates both CUA and Windows). If you prefer the CUA mode (as I do), you can configure Emacs to emulate CUA mode. To do this, first copy the package cua-mode.el into your Emacs site directory (see step 6 above). Then, insert the following code into your .emacs file (see step 5 above).

(pc-selection-mode) 
(load "cua-mode")
(CUA-mode t) 

Installing Cygwin

This step is optional. You don't need the Cygwin to run the CSDE. However, you may find some of the utilities provided by the distribution useful for developing Csharp applications, in particular, the ports of the GNU make utility and the bash shell.

  1. The Cygwin setup program copies the Cygwin distribution from the Cygwin site and installs the distribution on your system. Click here to run the setup program.

  2. Set up a Unix style directory hierarchy in your Windows file system.

    Cygnus and Emacs have a Unix heritage and retain some of their Unix characteristics. You can make them feel more at home in a Windows environment by providing a Unix style hierarchy. On my system, the hierarchy resides on my home directory. It has the following structure:

    c:\usr
      home
        emacs

    Following Unix tradition, I use the home directory to store my Emacs and bash startup files. (bash is a Unix shell that comes with the Cygwin distribution. I recommend that you use bash in place of the native Windows shell, command or cmd.) My home directory includes a subdirectory named emacs. I use this to store add-on software packages for Emacs that do not come with the NT/Emacs distribution, such as the psgml package and gnuserv.

    Note Using a separate directory to store add-on packages simplifies upgrading Emacs.

  3. Set your system's path to include the directory containing Cygwin executables.

    For example, suppose that you installed Cygwin on your d drive. You should then update the path in your autoexec.bat file (on Windows 95) or Environment variables panel (on Windows/NT) to point to

    d:\Cygwin\bin

  4. Define a HOME environment variable that points to your home directory (c:\usr\home).

    For example, on Windows 95, enter the following in your autoexec.bat file:

    set home=c:/usr/home

    Emacs, Cygwin, and other expatriate Unix tools use this variable to find your home directory.

  5. Create a bash startup file in your home directory.

    Use any text editor to create the file. Then save it in your home directory under the name .bashrc. The following is my .bashrc file, which I copied from a bash expert and modified slightly. I don't understand it fully, as I am no bash expert myself, and I suspect that some of it does not even apply to a Windows environment. However, it works, and that's good enough for me.

    #! /usr/bin/sh
    # $Id: .bashrc 1.1 1997/05/22 16:31:48 paulk Exp paulk $

    export PATH=".:${PATH}"
    export HOME=/usr/home
    export TMOUT=3600
    export HISTCONTROL=ignoredups
    export FIGNORE='~:.o'
    export PS1='//\h/.../\W \$ '

    # home key
    bind '"\e[1~":beginning-of-line'

    # del key
    bind '"\e[3~":delete-char'

    # end key
    bind '"\e[4~":end-of-line'

    # pgup key
    bind '"\e[5~":history-search-forward'

    # pgdn key
    bind '"\e[6~":history-search-backward'

    alias cp='cp -r'
    alias rm='rm -r'
    alias ls='ls -F'
    alias dir='ls -laF'
    alias edit='notepad'
     

  6. If you plan to use the bash shell, add the following lines to your .emacs file:

    (setq binary-process-input t)
    (setq w32-quote-process-args ?\")
    (setq shell-file-name "bash") ;; or sh if you rename your bash executable to sh.
    (setenv "SHELL" shell-file-name)
    (setq explicit-shell-file-name shell-file-name)
    (setq explicit-sh-args '("-login" "-i"))

Installing the CSDE

Installing the CSDE entails downloading the CSDE distribution, unpacking it into a directory on your filesystem, and configuring Emacs to run the CSDE. The following details these steps.

  1. Download the Windows version of the CSDE distribution (see  Downloading the CSDE).

    The CSDE Windows distribution file is a standard Windows zip file that contains the CSDE directory and its contents. You can use any Windows unzip program to unzip the CSDE.

  2. Unzip the CSDE into your Emacs add-on package directory.


  3. Download the latest versions of Eric Ludlam's speedbar and semantic bovinator packages and install them on your system, each in their own directory.

    You can download these packages from SourceForge.

    Note Emacs and XEmacs include earlier versions of speedbar that are incompatible with the CSDE. You must delete the earlier version or ensure that it is not on the Emacs load path. Otherwise you will get a Lisp error when trying to start Emacs.

  4. Download the Emacs Lisp library from the JDE (Java Development Environment) website in in compressed tar or zip format. Uncompress and install the package in a convenient location, for example, in your Emacs site directory.

  5. Update the Emacs Lisp load path.

    You must tell Emacs where the CSDE and its required packages live. You can do this by adding Lisp forms to your Emacs startup (.emacs) file that update the Emacs load-path variable, which lists the paths that Emacs searches when looking for Lisp packages required by commands that you execute. The following is an example of how to do this.

    (add-to-list 'load-path (expand-file-name "~/emacs/site/csharp"))
    (add-to-list 'load-path (expand-file-name "~/emacs/site/semantic"))
    (add-to-list 'load-path (expand-file-name "~/emacs/site/speedbar"))
    (add-to-list 'load-path (expand-file-name "~/emacs/site/elib"))
    (add-to-list 'load-path (expand-file-name "~/emacs/site/eieio"))

  6. Tell Emacs to load the CSDE at startup.

    To ensure this, add the following lines to your .emacs file:

    (require 'csde)

    Be sure to add this line after the line that updates the load path (see step 3 above).

  7. Compile the CSDE's Lisp files.

    Note You do not have to compile the CSDE Lisp files to use the CSDE. However, compiling the files can reduce Emacs startup time and speed some operations.

    The CSDE command csde-compile-csde compiles the CSDE Lisp code. It is the easiest way to compile the CSDE Lisp.

    The CSDE's lisp directory contains a makefile that compiles the CSDE Lisp files. The makefile assumes that you are using GNU Emacs and that the packages required by the CSDE are installed in the same directory as the CSDE package itself, i.e., the makefile assumes a directory structure similar to the following:

      site
        csde
        speedbar
        semantic
        elib
        eieio
    

    If your installation does not fit these assumptions, edit the makefile to reflect your installation.

    You can specify the path to Emacs or XEmacs on the commmand line, i.e.,

    make EMACS=d:/Applications/XEmacs/XEmacs-21.1/i386-pc-win32/xemacs
    

Specifying a Browser

The CSDE delegates the task of displaying HTML documents, such as The CSDE User's Guide, to browse-url, Emacs' generic interface to HTML browsers. The default browse-url browser in the latest version of NT/Emacs is the Windows default HTML browser. The default browse-url browser on Unix systems is Netscape. You can customize browse-url to use other browsers by executing M-x customize-group browse-url and editing and saving the appropriate configuration variables.

Note The Windows version of browse-url uses the default action associated with the html file type on your system to display a URL (execute C-h f w32-shell-execute for more information). You can thus configure browse-url indirectly by configuring the default Windows action for html files. To do this, select View->Folder Options on the Windows/NT or Windows 95 Explorer menu (note we're talking about the file, not the Internet Explorer). For example, when you install Internet Explorer, the setup program for Internet Explorer defines actions for opening HTML files in an existing window or a new window, respectively. You can set either of these as the default open action, according to your preference.

Note You can configure versions of NT/Emacs earlier than 20.4 to use the default Windows browser. For more information, see shellex and the CSDE Troubleshooting Guide). However, you can get the same result with far less effort simply by upgrading to the latest version of NT/Emacs.

XEmacs Setup

  1. Unzip the CSDE distribution in any convenient directory on your system.

  2. Delete or rename the ..XEmacs/xemacs-packages/etc/csharp directory created by the XEmacs package installer.

    This step is crucial. The CSDE package includes both Lisp and nonLisp files. XEmacs and the standard CSDE distribution have different ideas about where to store these files. The XEmacs installer stores the CSDE's lisp files in the xemacs-packages lisp directory and the CSDE's non-lisp files in the xemacs-packages etc directory. By contrast, the CSDE distribution stores its lisp files and non-lisp files in various subdirectories of the directory where the CSDE distribution is unpacked. The CSDE decides where to look for its nonLisp files based on whether the XEmacs/xemacs-packages/etc/csharp directory exists. If the directory exists, the CSDE assumes that it was installed by the XEmacs installer and thus looks for its nonLisp files in the etc/csharp directory. If the directory does not exist, the CSDE assumes that it was installed manually and thus looks for its nonLisp files in the directory in which it was unpacked. By deleting or renaming the etc/csharp directory in the XEmacs hierarchy, you are telling the CSDE that it was manually installed.

  3. Follow the instructions given elsewhere in this guide for updating your .emacs file to include the CSDE.

  4. If you have not already done so, install the XEmacs debug package.

    The debug package includes the gud package which is required by the CSDE.

    Note For help on installing XEmacs packages, choose Options->Manage Packages->Help from the XEmacs menubar.