Sams Teach Yourself Emacs in 24 Hours |
|||||||||||||||||
Hour 2: Using Emacs in Microsoft Windows |
|||||||||||||||||
|
Windows NT is not UNIX, and there are some things it simply does not do according to the UNIX philosophy. When Emacs runs up against those things, it has problems. Often there is a workaround, and the following sections cover a few of them.
Windows NT has a concept called named streams . This allows a program to treat one file as several logical files within the one file. NT Emacs does not support named streams in any way. In fact, if you change a text file with one or more named streams, the named streams will be destroyed.
Emacs has a neat facility called ange-FTP. This lets you edit a file on a remote computer via the FTP protocol. If you can read the file and write to it via FTP, you can edit it with Emacs, and Emacs will hide most of the FTP stuff for you. Versions of NT Emacs prior to 20.3.1 had problems using Windows's native FTP client. 20.3.1 works with the Windows client, so that might be a good reason to upgrade from a prior version.
One problem you will have with ange-FTP is that ange-FTP's filename code does not understand MS-DOS drive letters such as C:. So files on a Windows computer might not be accessible to Emacs even though the FTP server has permission to make the file available.
One workaround is to make the file available as a network share. You can then access the file through the share name. After you have typed in the UNC name of the share ( \\server\files\, for example), tab completion works as it does with local files.
One thing users of Windows 95/98 should beware: command.com (the standard Windows 95/98 command-line shell) does not support multitasking or multiple shell buffers under Emacs. command.com does not respond well to C-c commands, which is what Emacs uses to shut down shells that it runs. The result might be zombie copies of command.com that make it impossible to shut down Windows gracefully.
There are two solutions. The most UNIX-like and most effective is to install the Cygnus Bash port. BASH is a shell found on UNIX. It is the standard shell for Linux, for example. The Cygnus port of Bash is primarily intended for Windows NT, and some users have reported problems with it on Windows 95. It is probably the UNIX shell most used by NT Emacs users.
If you use command.com, note that the end-of-line handling code in Emacs version 20.3.1 prevents command.com from being used as the interactive shell on Win95 out of the box. To use command.com as your shell, place the following in your startup file:
(setq process-coding-system-alist '(("cmdproxy" . (raw-text-dos . raw-text-dos))))
Also, make sure you have msdos-shell-fix.el and w32-shellex.el both installed in your site-lisp directory. They make command.com more bearable on Windows 95/98. If you installed Emacs from the CD-ROM, you already have them installed. To make them effective, add the following to your .emacs file:
(if (memq window-system '(win32 w32)) ; Windows NT/95 (progn ;; add w32-shellex. (require 'w32-shellex) ;; NT Emacs on W95 has a problem leaving command.com as a ;; orphan process when Emacs is shut down. This fixes that ;; problem, It appears to be harmless on NT. (add-hook 'comint-exec-hook (function (lambda () (require 'msdos-shell-fix)))) ))
Sams Teach Yourself Emacs in 24 Hours |
|||||||||||||||||
Hour 2: Using Emacs in Microsoft Windows |
|||||||||||||||||
|
© Copyright Macmillan USA. All rights reserved.