Screwing around with Cygwin...
Cygwin now (as of at least 2/2004) offers an XEmacs package, and a CLisp package. Both interest me. I use XEmacs (but the native, not cygwin version so far) as my daily editor, and keeping it updated would be slightly simpler as part of the Cygwin distribution. I'm experimenting with Lisp, and CLisp sounds like a decent implementation of Common Lisp, except for a minor concern about the license (but apparently there's an escape clause).
Basic Installation of Cygwin
The Cygwin installation consists of many packages, with a single top-level installer that you run off the net to install, remove, or update them.
Go to http://cygwin.com, click on the "Install or update now!" link, and choose "Open". This downloads and runs the installer. You'll use this same procedure later to update your installation or add or remove packages.
In the installer wizard, you go through these steps:
- Choose "Install from Internet"
- Choose a root directory (default is c:/cygwin; best to avoid spaces in this path)
- Also on this page, choose install for "All Users"
- Also on this page, choose default text file type "DOS"
- Choose the Local Package Directory. This is where downloaded packages will go prior to processing, as well as information about packages installed and available. I use c:\cygwin\install.
- Choose Direct Connection (unless you need something else to get through a firewall)
- Choose a download site. I currently use ftp://ftp.nas.nasa.gov. The download from the orbital FTP server doesn't take that long. (Just kidding.)
This brings you to the critical but potentially confusing "Select packages" step. The UI is OK but has some annoying quirks, the main one being that you can't resize it. Play with the View button a bit; it cycles through different arrangements of the information, and can be especially helpful when updating an existing installation. The Category view is useful when initially browsing for stuff. The radio button group Keep/Prev/Cur/Exp refers to the package versions that will be offered:
- Keep your currently installed package version
- Use a Previous version (possibly downgrading)
- Use the Current version (usually recommended)
- Use an Experimental (i.e. unstable) version
Relatively few packages are selected by default initially. Consider selecting these packages:
- The entire Base category.
- This includes some commonly-needed libraries and utilities, the bash shell, basic file-handling utilities like ls, rm, etc.
- In the Devel category:
- clisp if you want to try out Common Lisp.
- In the Doc category:
- cygwin-doc
- 'man, in order to UNIX-style man pages (highly recommended)
- Under Editors:
- XEmacs, if you want to try that as a development environment. (1)
- pick vim if you remember and ever use vi. (2)
- Under Games, of course, don't select anything.
- Under Net:
- inetutils to get Cygwin's version of ftp. (Esp. recommended if you're using XEmacs, since XEmacs uses ftp to update it's packages.)
- ncftp is a nice interactive (but non-GUI) FTP program.
- openssl is an implementation of SSH
- Under Text:
- less is an alternative to "more" with a vi-like navigation interface. (3)
- Under Utils:
- d, an alternative to ls. Kinda silly, actually...
After you've picked the packages you want, go the next page, and the wizard should download and install everything for you. Annoyingly, if you run into errors during the download, I think you pretty much have to start over. (This used to happen to me a lot, but not much with recent versions. If you figure out a better way to recover, let me know.)
Footnotes for DWM's personal recommendations:
- XEmacs is my editor of choice, and has been for a while. Emacs (the GNU version, of which XEmacs is a fork) is also a good choice; I understand that the Windows builds of Emacs are now pretty stable, which wasn't the case when I chose XEmacs over Emacs. I'm just experimenting with the Cygwin version of XEmacs. You can also install a native version for Windows from the XEmacs home page, in which case you don't want the Cygwin xemacs package. Some things work better with the Cygwin version, but the jury's still out.
- I use vi occasionally for quick editing sessions instead of starting XEmacs.
- less is absolutely the fastest and most convenient way to take a quick look at a file when you're working at the command line, and you can pipe stuff into it like you would with more. I've been using this for years on both *nix and Windows.
Basic notes on working with Cygwin programs
Cygwin is, at it's heart, a UNIX emulation library that lets UNIX-style programs run on DOS/Windows machines. It's been around for a while, and has become more robust and useful over time. Still, be prepared for occasional surprises due to culture clash.
The most fundamental thing you need to know is that Cygwin maps between Windows-style and UNIX-style file names. A program built using Cygwin typically sees all directory as being in one big hierarchy, like on UNIX. The root directory / maps to the root of your Cygwin installation (c:/cygwin/, if you followed the installation directions above). Directories under the Cygwin root are arranged in a UNIXy way.
To get to other drives, you use a fake directory prefix, /cygdrive. For instance to get to drive D:, you use the funny path /cygdrive/d/. To get to network shares, you use a syntax very much like Windows'. For instance, on my home network I can get to my home directory on server scorpion using //scorpion/danm/.
Note that UNIX uses forward slashes as directory separators. In some contexts, you can use either a forward- or back-slash, but you have to remember that backslash is an escape character for many programs, including bash, so it often has to be doubled. Prefer forward-slashes when possible.
Post-installation configuration steps
These steps will help certain things work more smoothly. I'll assume here that you're running the BASH shell that comes with Cygwin. If you add c:/cygwin/bin to your PATH, most of these commands will work from a Windows command shell, too, but you'll probably be happier in the long run with BASH, so give it a spin.
To make it easier to get to your usual hard drives and improve useability of some programs, you can mount your hard drives so that you can reference them more conveniently. For example, if you have C: and D: drives, run these commands:
mkdir /c /d # Creates two dirs in root; assumes Cygwin's mkdir! mount c:/ /c # Make C:\ accessible as /c (instead of /cygdrive/c) mount d:/ /d # Ditto for D:\
You only need to do this once; the settings persist. This is particularly handy if you're using CLisp, because it will automatically translate native path names like "C:\projects\lisp" to "/c/projects/lisp".
Using XEmacs
XEmacs and Emacs are big systems in their own right. Use the tutorial to get yourself started with basic editing and navigation (see the Help menu).
There's a ton of information on the net. Keep in mind that there are subtle differences between XEmacs and Emacs. The majority of the information on the net is applicable to both, but some information is specific to GNU Emacs. Some important places:
- [XEmacs.org XEmacs home site], in particular the [FAQ] section for using [XEmacs on Windows]
- [Emacs Wiki]. In particular, see
.
XEmacs has its own package updating system for editor extensions (of which there are many).
Notes on getting Cygwin XEmacs working right
I found that, somewhat to my surprise, much of my existing XEmacs configuration works. Have to find out yet if all of the DOS-style path names work, though.
Some of the info files that come with Cygwin's XEmacs out of the box cause XEmacs crash when paging through the Info system's top page. So far I've identified these:
- gnus-mime-ja.info
- mew-ja.info
- tm-edit-ja.info
- tm-ja.info
- tm-mh-e-ja.info They all seem to be Japanese versions, and have funny characters in them. Some other info files with these characteristics don't seem to cause problems. You have to move these out of /usr/share/xemacs/xemacs-packages/info to avoid the problem. (That's the path as seen in cygwin's shell; it's actually c:/cygwin/usr/share/... if you installed cygwin in c:/cygwin.) I should verify that none of these files were corrupted in the install process.
Here's the stack dump file (xemacs-21.4.14.exe.stackdump) contents:
Stack trace: Frame Function Args 0022E3D8 77E7AC21 (00000000, 00000000, 00543E30, 0173AB08) 0022E438 61087E49 (00000E5C, 00000006, 00000001, 00000020) 0022E458 61086211 (00000006, 0043B830, 00000000, 00000000) 0022E478 61026B4C (0000065C, 0000EA60, 00000014, 0022E4B4) 0022E4F8 6108A855 (00000000, 77E7AC58, FFFFFFFF, 0022E558) 0022E558 61087E49 (00000E5C, 00000006, 0022E588, 610883B3) 0022E568 61087EFC (00000006, 00000000, 0022E594, 005C4AB1) 0022E588 610883B3 (0043E500, 0046B7D0, 00000233, 0046B7FC) 0022E5B8 61086211 (0046B7D0, 00000233, 0046B7FC, 00000004) 0022E6C8 0046BCBB (1025D000, 105647E8, 104BF240, 000001F0) 0022E798 0046CF5A (1025D000, 105647E8, 105DF980, 00000000) 0022E7C8 0055CF36 (1025D000, 105647E8, 00000000, 00000000) 0022E818 0055FCF1 (1025D000, 106757E8, 105647E8, 1058F880) 0022E8D8 0055C61F (1025D000, 10308800, 10308C60, 00000017) 0022E938 0055F008 (1025D000, 0000090C, 0000145F, 0000090C) 0022E9A8 00559387 (1025D000, 00000000, 00000000, 00000000) End of stack trace (more stack frames may be present)
To get the package updater to work, you need to make sure Cygwin's version of ftp is installed. This is in the inetutils package, which might not be installed by default.
This version of XEmacs seems to understand standard Windows paths, e.g. "C:\Program Files\XEmacs", at least when entered interactively. The last time I tried a cygwin build of XEmacs, it only understood Cygwin-style paths, e.g. "/cygdrive/c/Program Files/XEmacs".