Emacs won't start anymore? See troubleshooting below.
Shells and subprocesses don't work? Using anti-virus software? See anti-virus problems below.
Using bash from Cygwin-b19? See bash below.
This document is mirrored at:
ftp.sunet.se
in Sweden
ic.uva.nl in Netherlands
More from Eli:
It might be of interest to Windows users that this version of Emacs supports long filenames (Windows 95 only) and the Windows clipboard (all versions of MS-Windows). It also supports multiple frames, but they all overlap, like when Emacs runs on a ``glass teletype'' terminal.People who would like to run Emacs on plain DOS (as opposed to Windows) will need to download and install a DPMI host at this URL:
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/csdpmi3b.zip
Hisashi Miyashita <himi@bird.scphys.kyoto-u.ac.jp> maintains MULE, multilingual Emacs. You can get distributions of MULE at ftp://ftp.tokyonet.AD.JP/pub/windows/win32/mule-win32.
There are a couple of XEmacs for Windows NT/9X porting projects. See the XEmacs FAQ entry for more info, as well as Hrvoje Niksic's XEmacs on Windows FAQ.
If you have general questions about Emacs, the best places to start looking are the Emacs manual and the standard Emacs FAQ. If you already have Emacs, you can browse the manual using Info by typing "C-h i m Emacs RET", and you can view the FAQ by typing "C-h F". Or you can browse both of them online:
Emacs 20.3.1 is the latest release of Emacs on NT and Win95/98. It contains a significant number of bug fixes and features not found in the 19.34.6 release, and is relatively stable (especially compared with the Emacs 20.2.1 release). All future development will be done under Emacs 20, and I recommend that new users download this version.
A significant change between 19.34.6 and 20 is the way in which end-of-line characters are handled. Emacs 20 has a general mechanism for detecting code systems used in files, and part of this mechanism detects end-of-line characters. I expect there to be unexpected surprises in the interaction between assumptions made by older packages and the new mechanism, so be aware.
I also highly recommend reading the help text for the function find-buffer-file-type-coding-system. Since this will be utterly impenetrable, I then suggest reading the Info pages on coding systems and end-of-line detection, and then taking a peak at f-b-f-t-c-s again.
Another very noticeable change between Emacs 19 and Emacs 20 is that all identifiers prefixed with "win32" have been changed to "w32". You should change references to these identifiers in your startup file and other lisp code to match this change.
Unfortunately, VM has not been ported to Emacs 20 yet. If you are considering whether to move to Emacs 20 and you use VM, you will probably want to stick with 19.34.6 until VM has moved forward. (Bill Carpenter <bill@carpenter.ORG> on the question of VM and Emacs 20.)
The variable c-mode-map changed to c-mode-base-map from version 19.34 to version 20.1.
Erwin Achermann <acherman@inf.ethz.ch> has graciously collected user experiences related to upgrading from 19.34.6 to 20.3.
Charles Curley <ccurley@trib.com> thoroughly reports the process he went through.
The latest end-of-line handling code in Emacs 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))))
The version of speedbar shipped with Emacs 20.3.1 has a bug preventing it from being used. If you have the JDE, you can use the version of speedbar.elc from there (either by modifying your load-path or copying it over into your lisp directory). If you don't have the JDE, the following version should work:
Some versions of sendmail give a limit when reporting the SIZE extension, and this confuses the version of smtpmail shipped with 20.3.1. The warning is completely harmless, but if it annoys you then you can apply the following patch to lisp\mail\smtpmail.el or download a patched smtpmail.el (be sure to place it in the right directory and byte compile it):
If you are having difficulty printing from Emacs 20.3.1, see Andrew's note.
If you set which-func-mode-global via customize, which-func-mode will not turn on automatically. You need to add the following to your startup file before the call to custom-set-variables:
(which-func-mode 1)
More from Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com> on which-func-mode.
If you install the binary distribution and runemacs.exe does not run, and then you try the undump distribution or compiling from source and temacs.exe fails to dump correctly, then download the source distribution, apply this patch to src/w32heap.c, and recompile.
If AUCTeX fails with an error that the TeX output buffer is read-only, then you will want to apply this patch posted to dejanews.
igrep 2.82 needs to have the variable grep-null-device defined; add the following to your startup file:
(defvar grep-null-device null-device)
Emacs 20.3 has a bug in window-end which crops up in various places. One of them is in the lazy-lock package. If you use lazy-lock with Emacs 20.3 and are experiencing problems, try adding the following to your startup file before it loads lazy-lock:
(when (and (= emacs-major-version 20) (= emacs-minor-version 3))
(let ((emacs-minor-version 2))
(require 'lazy-lock)))
There appear to be other problems with lazy-lock as well; Jim Corwin's <corwin@matrix-one.com> experiences.
David Koppelman <koppel@ee.lsu.edu> found that the above patch does not work for him, but he does find that setting lazy-lock-defer-on-scrolling to "t" does prevent the crashes.
Richard Stallman sent out this patch that fixes the bug in the C source. If you have the source, you can apply the patch and rebuild Emacs.
Emacs is distributed in two different forms. You can get the full source distribution of Emacs, or you can get an installed distribution of Emacs with all executables precompiled.
The latest source distribution can be found in ftp.cs.washington.edu/pub/ntemacs/latest/src. It is distributed in two formats: one large gzipped tar file (emacs*.tar.gz), and a collection of smaller zip files that can be copied to 1.44 Mbyte floppies (em-src-_?.zip).
In the same directory you should also find patch files that enable you to upgrade source distributions to the latest version. These patch files are mirrors of the ones on the FSF server at ftp://ftp.gnu.ai.mit.edu/pub/gnu.
You can also browse the source online; look in ftp://ftp.cs.washington.edu/pub/ntemacs/latest/src for a directory named "emacs-<version>".
Links to precompiled versions:
I've had numerous reports from people outside North America saying that their ftp connection aborts for no apparent reason roughly a third of the way through a transfer of a full distribution. Marc Haber (s_haber@ira.uka.de) said that he suffered from the same problem, and later found that a timeout configured into his WWW proxy would cancel the transfer when the link to the US was very busy. Going around his proxy solved the problem. Andy Moreton <ajm@atml.co.uk> describes his situation when using SOCKS:
The FAQ page mentions some people have problems downloading - I may be able to shed some light on it. Our site has a reasonably secure firewall, and so all access to the outside world requires use of SOCKS based connections via a SOCKS5 server (i.e. a circuit-level gateway). When doing an FTP transfer, two connections are up - a telnet for the control connection, and the data transfer on another. As the telnet connection is idle during the file transfer, the SOCKS server disconnects it. Some FTP servers get upset by this (especially the NT FTP server), and drop the data connection if the control connection goes down.
If you do have trouble downloading the full distribution, try downloading it in the 1.44MB chunks, or try one of the mirror sites.
Mirror sites with precompiled versions:
% gunzip -c -d emacs.tar.gz | tar xvf -
(Note: Apparently the alpha version of gunzip cannot handle long file names, so you will need to rename the file to something like "emacstar.gz" before uncompressing it.)
The "-d" flag forces gunzip to decompress (its behavior depends upon the case of the name of the executable, and sometimes it doesn't recognize that it is really gunzip), and the "-c" flag tells it to pipe its output to stdout. Similarly, the "-" flag to tar tells it to read the tar file from stdin. Unpacking the distribution this way leaves the distribution in compressed form so it takes up less space.
You may see messages from tar about not being able to change the modification time on directories, and from gunzip complaining about a broken pipe. These messages are harmless and you can ignore them.
If for some reason you also want to have the tar file gunzipped, then invoke gunzip without the -c option:
% gunzip -d emacs.tar.gz
If you have the zip version, use unzip with the "-x" flag on all of the .zip files (note that you cannot use pkunzip on these files, as pkunzip will not preserve the long filenames):
% unzip -x emacs-_1.zip % (repeat for the remaining .zip files)You can find precompiled versions of all of the compression and archive utilities in ftp.cs.washington.edu/pub/ntemacs/utilities/.
WARNING: Some utilities that handle tar files can incorrectly untar the distributions when using the default settings. If you encounter problems with Emacs, see the section below on troubleshooting these problems.
Once you have unpacked a precompiled version of Emacs, it should have the following subdirectories:
bin etc info lisp lock site-lisp
If your utility failed to create the lock directory, then you can simply create it by hand (it is initially empty).
See below for information on where to place the .emacs startup file.
You should also find a file named README as a part of the distribution. Be sure to read this file for information on installing Emacs, as well as reading the section below on installing Emacs.
See the section below on troubleshooting Emacs if, after downloading a precompiled distribution and unpacking it according to the instructions above, you have trouble running Emacs.
Download and place the source distribution in a directory (say, c:\emacs). Unpack the distribution, and go to the nt subdirectory of the emacs directory that gets created in the unpacking process. Read the README and INSTALL files included with the distribution for the full details of this process.
Emacs is just like any other Win32 application compiled and linked using MSVC, and it can be debugged using Win32 debuggers like DevStudio. By default, Emacs will compile with debugging options turned on. Once compiled, you should be able to load either temacs.exe, the undumped executable, or emacs.exe, the dumped executable, into the debugger (almost always you will want to debug emacs.exe).
Before you run it in the debugger, though, you will need to have the Emacs environment variables set in your shell so that the Emacs process uses the lisp and data files of the development tree instead of an installed version of Emacs. You can either set these variables by hand, or you can use the debug.bat batch file created in the nt subdirectory and installed in the bin directory. This batch file will set the appropriate environment variables and run msdev on the emacs.exe executable installed in the bin directory.
Note that Emacs has conventions for naming built-in C identifiers corresponding to lisp functions and variables. You will, of course, need to use the C identifier names when examining variables and setting breakpoints. The C identifier versions of lisp identifiers have dashes converted to underscores, and they are prefixed with a capital letter denoting the type of lisp object that they refer to (functions use 'F', variables use 'V', etc.). For example, the C function implementing the lisp function expand-file-name is Fexpand_file_name, and the C variable corresponding to the lisp variable load-path is Vload_path.
Below are two methods for installing Emacs. If the instructions below seem a bit confusing, Charles Curley <ccurley@trib.com> has also written a tutorial on installing Emacs that you might find useful.
Let's assume that the directory in which you have unpacked Emacs is c:\emacs (note that it can be anything you want it to be; I just want to be able to refer to something concrete at this point). First, you will want to run the program bin\addpm.exe with the Emacs directory as an argument. In this example you would invoke it as:
c:\emacs\bin\addpm.exe c:\emacsInvoking addpm.exe will do two things. First, it will create a set of registry keys that tell Emacs where to find its support files (lisp, info, etc.). Second, it will create 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.
Alternate method:
Another alternative for running Emacs is to use the emacs.bat batch file in the bin directory (this is now the old method of invoking Emacs). Edit the emacs.bat file to change the emacs_dir environment variable to point to the Emacs installation directory and invoke the emacs.bat file to run Emacs. (If you use bash as your shell, you can use an equivalent bash script to emacs.bat.)
Note that, on Win95, you are likely to get "Out of environment space" messages when invoking the emacs.bat batch file. The problem is that the console process in which the script is executed runs out of memory in which to set the Emacs environment variables. To get around this problem, create a shortcut icon to the emacs.bat script. Then right click on the icon and select Properties. In the dialog box that pops up, select the Memory tab and then change the Environment memory allocation from "Auto" to "1024". Close the dialog box and then double click on the icon to start Emacs.
The INSTALL_DIR macro in the nt\makefile.def makefile determines where Emacs will get installed from the source distribution. If you want to install Emacs in the same directory as the source tree (say, c:\src\emacs), then simply set INSTALL_DIR appropriately:
INSTALL_DIR = c:\src\emacsIf you want to install Emacs in a different directory (say, c:\emacs), then set INSTALL_DIR to this directory:
INSTALL_DIR = c:\emacsAs compared with the installation process for the precompiled version, the installation process will automatically create a bin\emacs.bat file in the installation tree with the emacs_dir variable set appropriately.
You can run Emacs in a number of ways. If you installed Emacs using addpm, then you can run Emacs via the Start Menu using the "Programs->Gnu Emacs->Emacs" menu command. From the command line, you can use the program runemacs.exe.
If you didn't install Emacs using addpm, then you can run Emacs using the emacs.bat batch file in the Emacs bin directory. See the install section above for instructions on how to do this.
Note: Starting with version 19.34.6, Emacs is linked with setargv.obj. This gives Emacs DOS-style wildcard expansion of its command-line arguments, which should handle the common use of wildcards. To suppress expansion by setarg.obj, enclose the argument in double quotes. Embedded double-quotes will have to be escaped using a backslash.
The only thing that Emacs changes in your system is the registry (if you used addpm to install it). Emacs does not, for example, install any files in your system directory. If you don't mind the registry settings remaining in the registry, then you don't need to do anything to uninstall Emacs.
If you want to remove the registry settings, then you can use the regedt32 program to remove the Emacs registry keys. Depending upon what kind of permissions you have, the registry entries could have been installed in either HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs or HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs.
If you feel certain that you have unpacked the distribution correctly, then you should check to make sure that the emacs_dir variable in the emacs.bat file is set correctly. If it is and you are still having trouble, make sure that it is an absolute path that includes the drive letter (or is in UNC format).
If Emacs produces an access violation when you run it, then it might be a problem with Emacs unsuccessfully interacting with other software such as HeapAgent and Starfish Internet Monitor. See the section below describing this problem and how to work around it.
If it is still not working, send me mail or send mail to the list.
The typical behavior people are encountering with this problem is that they invoke Emacs but either nothing happens or it produces an access violation, and yet they have changed nothing in their Emacs installation, and Emacs used to work fine before this point. Most likely, the problem is due to an interaction between Emacs and some new piece of software you have just installed (the most popular culprit seems to be HeapAgent). Due to the nature in which Emacs is designed and built, Emacs is fundamentally non-relocatable: it uses an initialized heap segment that needs to be mapped in at a particular virtual address at startup time before Emacs will work correctly. It appears that programs like HeapAgent install DLLs that intrude upon Emacs' virtual address space, preventing Emacs to load its initialized heap.
If you have HeapAgent, then you can work around the problem in three ways. You can download the source and recompile, as described below. Or, you can download a version that has already been precompiled to avoid conflicts with HeapAgent (compliments of Andrew Bishop <andrew.bishop@autodesk.com>). Or, you can use editbin to change the base address at which the haloader.dll dll will be loaded (this is the dll that gets loaded into every application's address space on startup):
Otherwise, the only other workaround is to recompile Emacs on your machine so that Emacs creates and initializes its heap at a virtual address that does not conflict with software such as HeapAgent. To do this, you will need to download the source, #define the macro NTHEAP_PROBE_BASE inside the procedure src\ntheap.c:allocate_heap(), and rebuild.editbin /rebase:base=0x20000000 haloader.dll
2. Starfish Internet Monitor
Apparently, Starfish Internet Monitor interferes with Emacs'
loading of the dumped heap in a manner similar to HeapAgent. See the
discussion on HeapAgent above on how to work around this.
3. Aventail AutoSOCKS
Ditto with AutoSOCKS.
A number of users have
reported that Dr. Solomon's WinGuard prevent shell-related
commands from working properly within Emacs. Turning off "Scan all
files" makes it work, though.
A similar report from
Charles Curley <ccurley@wyoming.com>.
In some situations, Emacs performance can degrade. The following
sections discuss these situations, why they come about, and what you
can do about them.
In 19.34 the menu bar is updated more often than it needs to be,
and each update can be a time consuming process. If you are using a
single frame, you will likely not notice this behavior; if you are
using a number of frames, you might notice slow redisplay performance.
Currently the only way of fixing this is to turn menu-bar-mode off
(e.g., typing "M-x menu-bar-mode", or invoking (menu-bar-mode
nil)).
For more background, see Andrew's messages on the
topic.
The use of transient mark mode can trigger the slow menu bar
update performance described above. When the mark is set in transient
mark mode, the menu bar is updated after every keystroke and command.
Again, turning off menu-bar-mode is the only way to prevent the slow
performance without recompiling Emacs with patches.
Kim Storm <storm@olicom.dk> tracked down the bug in the core
redisplay code that causes the performance problem with
transient-mark-mode enabled. See the patches
section below for his patch.
Emacs initializes the variable "system-name" with the name of your
computer upon startup. However, Emacs uses two different methods for
determining the computer name depending upon whether Winsock is loaded
by default when Emacs starts up. If Winsock is automatically loaded,
then Emacs uses gethostname, otherwise Emacs uses
GetComputerName. Alternatively, you can override all of this
by explicitly setting system-name in your startup file (also
look at user-mail-address for composing mail messages).
By default, Emacs does not automatically load Winsock because
doing so will cause Winsock to establish a connection to the network.
If you are connected to a LAN, then nothing will happen, but if you
dialup to an ISP then invoking Emacs (thereby loading Winsock) will
prompt you to unexpectedly dialup to your ISP.
You can have Emacs automatically load Winsock by defining the
environment variable PRELOAD_WINSOCK. You can set it to an
arbitrary value; Emacs just checks to see if it is defined.
Similarly, you can create a registry entry PRELOAD_WINSOCK
with the other Emacs registry entries (in
HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs or
HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs), which will do the same thing.
The reason for this is that Emacs now has networking support built in.
When Emacs starts, the winsock DLL automatically gets loaded and tries
to resolve the fully qualified domain name for your machine under the
name "localhost". If the system doesn't have this name mapped, it
will try to query a nameserver on the internet, which is typically
some host within your ISP and subsequently prompts to connect to your
dialup service so that it can ask a name server for the domain name of
your machine. As you know, this is very unfortunate, and was not
anticipated when the networking support was added.
This problem will be fixed when 19.32 comes out, but you can work
around the problem by giving the dialup support another method for
figuring out the domain name of your machine. To do this, you need to
edit the hosts file for your system (located in %windir%\hosts on
Win95 and %windir%\system32\drivers\etc\hosts on NT) so that localhost
becomes an alias for your machine name. If your system doesn't have a
hosts file yet, you can easily create one by copying the sample hosts
file in the same directory, hosts.sam.
For example, if my machine were named
banana-fish.cs.washington.edu, then I would edit the hosts
file from:
If this doesn't work for you, there are some other options (I have not
tried these):
For networking support, you can use the external nttcp.exe program. Download
nttcp.exe and place it in your Emacs bin directory. Also download
this version of tcp.el,
byte-compile it, and place it in your lisp directory. Then add the
following to your .emacs:
This is annoying, I know, and you shouldn't have to be dealing with
this. But please bear with me for now. If it isn't there already,
prepend "start" to the last line of the .bat file (the line that
invokes the emacs.exe executable). Then create a shortcut icon to the
emacs.bat file, and edit the Properties of the shortcut (right
click on the icon). On the Program tab, select Run: to
be Minimized and make sure the Close on exit checkbox is
checked. Double click on the icon, and Emacs should start up cleanly.
Because of the way Emacs currently tries to share the clipboard
with other Windows applications, you cannot cut and paste text with
null characters embedded in it. David Biesack
<sasdjb@unx.sas.com> describes a way to get around
this, at least for cutting and pasting text just within Emacs.
I just upgraded the operating system, and Emacs no longer works.
I have received reports that, after upgrading the operating system
(e.g., from NT 3.51 to NT 4.0), an installed Emacs will start but will
not accept keyboard or mouse input. Apparantly, running addpm.exe as
described in the installation section above
fixes the problem.
I use anti-virus software. What problems can this cause?
Some anti-virus software seems to interact badly with Emacs.
Dr. Solomon's
McAfee
Why does Emacs seem to perform slowly under certain conditions?
Menu bar updates
Transient mark mode
How does Emacs determine the name of my computer?
Why does Emacs ask me to connect to my dialup service when it starts up?
For some users, when Emacs starts up it pops up the dialog for
connecting to their dialup service, or sometimes appears to hang for a
few minutes and suddenly appear.
to
127.0.0.1 localhost
The hostname should be the value of invoking (system-name) in
the Emacs *scratch* buffer, i.e., the fully qualified domain name for
your system. Note that you may also have to tell the system to look
in the hosts file as well as using DNS.
127.0.0.1 banana-fish.cs.washington.edu localhost
(load-library "tcp")
(setq tcp-program-name "nttcp")
When I run Emacs, a console window pops up. How do I make it go away?
How do I cut & paste text with null characters?
How do I change the size, position, font, and
color attributes of Emacs?
Emacs can run in two different interface modes: the Windows interface,
which allows the flexible use and mixture of fonts and colors; and the
console interface, which constrains Emacs to the limitations of
console windows. The following two sections describe how to specify
and change the size, position, font, and color attributes of Emacs in
both interface modes. Windows Interface
To customize the size of specific frames, including the initial frame, see the section on customizing frames below.
emacs -g 80x40Note that the geometry command can be combined with the position command, as described below.
(set-frame-height (selected-frame) 40)
(set-frame-width (selected-frame) 80)
To customize the position of specific frames, including the initial frame, see the section on customizing frames below.
emacs -g +10+30To combine the size with position, first specify the size and then the position. The two examples above can be combined as follows:
emacs -g 80x40+10+30Note that you can also specify position offsets from any of the corners of the screen. See the GEOMETRY SPECIFICATIONS section of the X man page for complete details on the geometry command.
(set-frame-position (selected-frame) 10 30)
Fonts in Emacs are named using the standard X Windows format for fonts. For an explanation of what each element in a font string means and how Emacs on NT uses it, see Andrew's note.
These font names are the names that can be used as arguments on the command line or in lisp functions. To see the font name corresponding to a font chosen using the font selection dialog, execute the following elisp code in the *scratch* buffer:
(insert (prin1-to-string (win32-select-font))) ; Emacs 19 (insert (prin1-to-string (w32-select-font))) ; Emacs 20To see the complete list of fonts that Emacs has access to, execute the following elisp code in the *scratch* buffer:
(insert (prin1-to-string (x-list-fonts "*")))The font support currently is a little rough around the edges. In particular, italic fonts give Emacs some problems; see below for more info about using italic fonts. Generally it performs as expected, but occasionally you might get unexpected results (e.g., Emacs didn't quite use the font you told it to use). Work is underway to fix these problems, but for now I suggest experimenting if you encounter problems.
Also, X Windows has the luxury of a set of font aliases (such as fixed) that are convenient names for referring to specific fonts. Work is underway to provide an equivalent alias mechanism under Win32 so that naming fonts does not have to be as cumbersome as it currently is.
To customize fonts for specific frames, see the section on customizing frames below.
emacs -font "-*-Courier-normal-r-*-*-13-97-*-*-c-*-*-ansi-"
To set the font of a particular face, use the set-face-font function.(set-default-font "-*-Courier-normal-r-*-*-13-97-*-*-c-*-*-ansi-")
Value Name: Emacs.FontSince the font strings are rather cumbersome, I would suggest cutting the font string into the kill-ring (which will place it in the clipboard, too) and pasting it (Ctrl-V) into the regedit dialog. (Note that you shouldn't place quotes around the font string in the registry.)
Value Type: REG_SZ
String: -*-Courier-normal-r-*-*-13-97-*-*-c-*-*-ansi-
If you have Emacs frames with specific names, you can also specify a font for that frame. For the Value Name of the entry, use the name of the frame instead of Emacs (e.g., RMAIL.Font for your RMAIL frame).
As with other windowing attributes, Emacs uses the X Windows color names for specifying colors on the command line and in elisp. One set of these names is a set of abstract color names, e.g., red, green, and blue. These names are the ones you will typically use as arguments on the command line or in elisp functions. Emacs also supports the use of numeric color names; see the COLOR NAMES section of the X man page for complete details on how to specify numeric color names and their color spaces.
To see the abstract color names that Emacs understands and the colors that they map to, use the menu command Edit->Text Properties->Display Colors, or invoke the list-colors-display function in the *scratch* buffer:
(list-colors-display)If you would like to change the mapping of color names to RGB values, or to add new color names to Emacs, then you will want to modify the alist w32-color-map (win32-color-map in Emacs 19). To make changes, you can simply cons new mappings onto the head of the alist:
(setq win32-color-map (cons '("snow" . 16448255) win32-color-map)) ; Emacs 19 (setq w32-color-map (cons '("snow" . 16448255) w32-color-map)) ; Emacs 20The number in the element is the logical OR of three values for the red, green, and blue components: (B << 16 | G << 8 | R). In the example above, red is 255, green is 250, and blue is 250. At some point there will be support for reading in files with color mappings to make this process a little easier.
To customize colors for specific frames, see the section on customizing frames below.
To customize colors for color syntax highlighting, see the section on font-lock.
emacs -fg yellow -bg black
The following elisp changes the background color to black:
(set-background-color "black")The following elisp changes the mode line foreground to firebrick:
(set-face-foreground 'modeline "firebrick")The following elisp changes the cursor color to purple:
(set-cursor-color "purple")
Emacs uses two alists to determine the default appearances of frames, default-frame-alist and initial-frame-alist. The default-frame-alist variable sets the basic defaults of all frames. Since it is a common Emacs usage to have the initial frame have slightly different properties than other frames (e.g., its position), you can use the initial-frame-alist variable to override properties in default-frame-alist specially for the initial frame. You should definitely read the help text for these variables (C-h v) for more details on the differences between them and how they interact with each other.
Below is an example of using default-frame-alist and initial-frame-alist to configure the appearances of the initial frame and all other frames (you would place this code in your startup file). With default-frame-alist, we set the top left corner of new frames to be at pixel offset +200+400, the width and height to be 80x40, the cursor to be white, the foreground to be yellow, the background to be black, and the font to be Courier 10. With initial-frame-alist, we override the top left corner of the initial frame to be at pixel offset +10+30, and inherit the remaining properties for the initial frame from default-frame-alist.
(setq default-frame-alist
'((top . 200) (left . 400)
(width . 80) (height . 40)
(cursor-color . "white")
(cursor-type . box)
(foreground-color . "yellow")
(background-color . "black")
(font . "-*-Courier-normal-r-*-*-13-97-*-*-c-*-*-ansi-")))
(setq initial-frame-alist '((top . 10) (left . 30)))
You can use the functions x-display-pixel-width and x-display-pixel-height to determine the resolution of your screen. For example:
(and window-system
(setq screen-width (x-display-pixel-width)
screen-height (x-display-pixel-height)))
Emacs currently requires that italic versions of fonts have the same width as the normal version of the font. However, most of the default fonts have italic and italic bold versions whose character widths are larger than the normal version (the only default font that appears to have viable italic and bold versions is Courier New). Because of this, Emacs by default disables the use of italic faces.
You can still enable the use of italic faces with Emacs by setting the variable w32-enable-italics (win32-enable-italics in Emacs 19) to t in your startup file:
Although this works best with Courier New, there is still one minor glitch: the italics versions are one pixel higher than the other versions, so the line spacing is increased by a pixel when italics are enabled.(setq win32-enable-italics t) ; This must be done before font settings! (Emacs 19) (setq w32-enable-italics t) ; This must be done before font settings! (Emacs 20) (set-face-font 'italic "-*-Courier New-normal-i-*-*-11-82-c-*-*-ansi-") (set-face-font 'bold-italic "-*-Courier New-bold-i-*-*-11-82-c-*-*-ansi-")
Under NT, go to the upper left hand corner and open the "-" menu of the console window. Select "Screen Size and Position...", and use the dialog to set the window to the size you want. Be sure to check the "Save Window Size and Position" checkbox so that future invocations will retain the new window size. After closing the dialog box, resize the window itself by dragging on the edges.
Under Win95, click on the properties icon in the icon toolbar at the top of the window. Go to the "Screen" tab and select the desired window size in the "Usage" panel. Click on "OK".
To reposition Emacs, click on the title bar of the console window and drag it.
Under NT, open the "-" menu. Select "Fonts...", and use the dialog to set the window font to the one you want. Be sure to check the "Save Configuration" checkbox so that your font change will be used in future invocations. Click on "OK", and the window will get resized.
. Under Win95, simply use the popup font menu in the upper left-hand corner of the window. Or click on the font icon in the icon toolbar. Or click on the properties icon in the icon toolbar and go to the "Font" tab and choose the font that you want to use.
Under the NT interface, open the "-" menu. Select "Screen Colors...", and use the dialog to choose the colors you want to use for the window. Be sure to check the "Save Configuration" checkbox so that the colors are used in future invocations. Click on "OK". Unfortunately, the colors are not immediately used, but the changes have been made. To use the new colors, simply close the window and use the icon to start Emacs again. Emacs will then come up using the colors you chose before.
I'm not exactly sure how to change the colors on a per-console-window basis under Win95.
Older versions of Windows 95 had a bug where different filenames with a particular structure would wind up with the same short filename, and hence the different filenames would point to the same file on disk. For example, "foo.mak" and "foo.mak~" will map to the same file. Early versions of Emacs suffered from this bug, but later versions (19.34.1 and above at least) work around it.
However, disabling the registry entry HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem\NameNumericTail in Windows 95/98 (by setting it to 0) will still cause these filename conflicts. According to Microsoft, this entry should never be set to 0 for Windows 95 and 98 (see MS KnowledgeBase articles Q148594 and Q179370), but if you must have it set to 0 then you should change how backup files are created. You can do this by setting the variable backup-by-copying to t in your startup file, or by redefining the function
Your startup file can be named either _emacs or .emacs, and should be placed in your "home" directory. If you have both files in your home directory, Emacs will load the .emacs file and ignore _emacs. Also, if you have a version of Emacs older than 19.31, Emacs will only recognize _emacs as the startup file.
Your home directory is where the HOME configuration variable tells Emacs it is. As with the other Emacs configuration variables, HOME can be set in a number of ways:
If Emacs cannot find HOME set in any of the above locations, it will assume your HOME directory is "C:/".
The directory specified by HOME is also the directory substituted for tildes (~) in file names used in Emacs (so, by definition, you can always load your startup file in Emacs by doing C-x C-f "~/.emacs").
Troubleshooting: If you've set HOME to a directory using one of the above methods, and Emacs still doesn't load your startup file, the first thing you should do is check to see what Emacs thinks HOME is set to. You can do this by evaluating the following expression in the *scratch* buffer using C-x C-e:
(insert (getenv "HOME"))
Look carefully at what is printed and make sure the value is valid. For example, if the value has trailing whitespace, Emacs won't be able to find the directory. Also, be sure that the value isn't a relative drive letter (e.g., "d:" without a backslash); if it is, then HOME is going to be whatever the current directory on that drive is, which is likely not what you want to happen.
Below is a list of sample .emacs files from various people. Eventually a single sample .emacs file will be shipped with the binary distributions, but until that happens you can browse these to see what people use already.
CapsLock and Control cannot be swapped from within Emacs, and Windows does not have a convenient mechanism like xmodmap to change virtual key bindings. Instead, new keyboard layouts or device drivers can be installed, or the registry can be modified, to swap the two keys.
WARNING: If you use a new keyboard layout to switch CapsLock and Control, beware of the option to use hotkey sequences to switch keyboard layouts. This option is in Control Panel->Keyboard under the Language (Win95) or Input Locales (NT) tabs; the sequences themselves are "Left Alt+Control" and "Ctrl+Shift". If you enable one of these options, then you will likely at some point switch keyboard layouts while trying to use an Emacs key combination.
NT 4.0:
Win95: Microsoft has placed a keyboard remapping program for Win95 on their ftp site (keyremap). For more info, take a look at their Kernel Toys page.
Mark Russinovich has also written a freeware VxD that swaps CapsLock and Control under Windows 95. (I've been told that you might have to hit the real Control key once after installing the VxD to jumpstart the mapping.)
To get tab file completion in cmd.exe, use regedt32 to set the following registry entry to 0x9 (using the Edit->DWORD menu command):
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar
It has been reported that this feature can randomly crash cmd.exe on occasion.
Microsoft distributes a utility called Xmouse, part of a package of utilities called PowerToys, that lets you change the focus handling so that the focus follows the mouse. The PowerToys package can be found at http://www.microsoft.com/windows/software/powertoy.htm.
Note that not all of these utilities written on Windows 95 work on NT; reportedly, if you are on NT 4.0 you have to use the TweakUI utility to enable follow focus. Also, if you use TweakUI, reportedly it is best to set the popup delay to 0ms for focus follow to work well with Emacs.
For more info, you can flip through a collection of email messages discussing these utilities.
2) Registry
Steve Yegge <stevey@geoworks.com> reports that there is an NT registry setting that enables mouse tracking (it's unknown whether this works on versions less than 4.0). Set the following key to 0x1:
Steve also says:HKEY_CURRENT_USER\Control Panel\Mouse\ActiveWindowTracking: 0x1
The two "bugs" I've found are:
- some applications (notably Netscape and Microsoft Developer
Studio) autoraise when they get the focus.
- the mouse doesn't move into the new window when you use
alt+TAB switching, so if a vibration bumps the mouse, you
may suddenly find yourself typing in the wrong window.
Some behaviors typically found in other Windows apps, such as deleting typed-over highlighted selections, are not configured by default in Emacs. You can, however, enable them by loading various packages. If you would like to highlight the region between the point and the mark, see the help text for transient-mark-mode; if you would like highlighted selections to be deleted when you type over them, see the help text for delete-selection-mode; if you would like to change the semantics of keypad keys such as "home" and "end", see the help text for pc-selection-mode.
Theodore Jump <tjump@spgs.com> has written a utility called EMWINMSG that enables elisp code to invoke a window operation on an Emacs frame (via the Windows API routine "ShowWindow"):
If you are used to standard Windows application keybindings, such as C-c for copy, C-v for paste, and C-x for cut, or selecting text with <shift>-movement, then you probably want to use Kim Storm's <storm@olicom.dk> CUA-mode.el.
Binu Jose Philip <binu@teil.soft.net> has written the dlgopen package to use the Windows Open File dialog box for opening files. Download dlgopen.zip, unpack, and read the top of the dlgopen.el file for directions on using the package.
Although it may at first seem like the shell is buffering the output from the program, it is actually the program that is buffering output. The C runtime typically decides how to buffer output based upon whether stdout is bound to a handle to a console window or not. If bound to a console window, output is buffered line by line; if bound to a block device, such as a file, output is buffered block by block.
In a shell buffer, stdout is a pipe handle and so is buffered in blocks. If you would like the buffering behavior of your program to behave differently, the program itself is going to have to be changed; you can use setbuf and setvbuf to manipulate the buffering semantics.
Andrew Innes is working on removing this limitation. If all goes well, it should be available in 19.35.
If you are finding that running 16-bit programs as subprocesses cause your A: drive to be accessed (hanging Emacs until a timeout occurs if no floppy is in the drive), check to see if you have McAfee Virus Shield installed. Users have found that disabling Virus Shield causes the problem to go away. Also, if you have a better fix for this problem, let me know or send mail to the list.
A followup from Bill Carpenter <bill@bubblegum.net>.
Emacs cannot guarantee that a subprocess gets killed on Win95/98, and is a difficult limitation to work around. For the forseeable future, you should always let subprocesses run to completion.
19.34.4 Previously, Ctrl-C would generate a CTRL_BREAK_EVENT (SIGQUIT) in subprocesses. Now Ctrl-C generates a CTRL_C_EVENT (SIGINT). This behavior is more accurate, but may still causes problems; see Andrew's note.
19.34.1 For applications that handle Ctrl-C and Ctrl-Break events, you might notice that typing Ctrl-C in Emacs when those applications are run as subprocesses does not trigger their Ctrl-C handlers but instead triggers the Ctrl-Break handlers. Here is what is going on. Emacs in general tries to interrupt subprocesses using Unix-style kill and SIGINT. Ideally, on Win32 the kill emulation code can translate the SIGINT into a GenerateConsoleCtrlEvent with a CTRL_C_EVENT. However, doing so does not seem to propagate the CTRL_C_EVENT to the subprocess; as far as I can tell, nothing happens. So, instead of using a CTRL_C_EVENT for SIGINT, the emulation code uses a CTRL_BREAK_EVENT, which is propagated correctly to subprocesses.
If you need to handle Ctrl-C events propagated from Emacs, you'll need to use a Ctrl-Break handler for now. Andrew describes how all of this going to be handled in the future.
If you would like to specify a different shell for Emacs to use, then you should do one of two things. You should either explicitly set the environment variable SHELL to be the shell you want to use, or, if you want to have the COMSPEC environment variable determine the shell, then you need to install Emacs using the addpm.exe program and ensure that the SHELL environment variable is not defined when you start up Emacs.
Note that sh-script.el does not recognize shell names when they have the '.exe' extension on them. If you use sh-script, you should omit the '.exe' extension when specifying the SHELL variable.
Alternatively, if you do not want to mess with the SHELL or COMSPEC variables, you can explicitly place the following in your startup file:
;; For the interactive shell (setq explicit-shell-file-name "c:/bin/tcsh.exe") ;; For subprocesses invoked via the shell (e.g., "shell -c command") (setq shell-file-name "c:/bin/tcsh.exe")
You can get a version of bash with the Cygnus tools at http://www.cygnus.com/misc/gnu-win32. To use bash with Emacs, place the following in your startup file:
Emacs 19.34
(setq win32-quote-process-args ?\")
(setq shell-command-switch "-c")
(load "comint")
(fset 'original-comint-exec-1 (symbol-function 'comint-exec-1))
(defun comint-exec-1 (name buffer command switches)
(let ((binary-process-input t)
(binary-process-output nil))
(original-comint-exec-1 name buffer command switches)))
Emacs 20
(defun my-shell-setup ()
"For bash (cygwin 18) under Emacs 20"
(setq comint-scroll-show-maximum-output 'this)
(setq comint-completion-addsuffix t)
(setq comint-process-echoes t)
(setq comint-eol-on-send t)
(setq w32-quote-process-args ?\")
(make-variable-buffer-local 'comint-completion-addsuffix))
(setq shell-mode-hook 'my-shell-setup)
(setq process-coding-system-alist (cons '("bash" . raw-text-unix)
process-coding-system-alist))
Richard M. Heiberger's <rmh@fisher.stat.temple.edu> setup for Cygnus B19.
For more configuration information with bash, take a look at Jonathan Payne's <jpayne@marimba.com> setup.
WARNING:The latest version of bash sets and uses the environment variable PID. For some as yet unknown reason, if PID is set and Emacs passes it on to bash subshells, bash croaks (Emacs can inherit the PID variable if it's started from a bash shell). If you clear the PID variable in your startup file, you should be able to continue to use bash as your subshell: (12/18/97)
(setenv "PID" nil)
For a version of ksh by David Korn, take a look at http://www.research.att.com/sw/tools/uwin. I haven't tried this shell with Emacs, but I'm guessing that it works under Emacs and that you need the following for it to work properly:
(setq win32-quote-process-args t) ; Emacs 19 (setq w32-quote-process-args t) ; Emacs 20 (setq shell-command-switch "-c")
If you find out otherwise, let me know and I'll update this section.
WARNING: People have reported that UWIN 1.5 ksh doesn't work with Emacs. I do not know why yet. If you figure out why, please send mail to the list.
(setq win32-quote-process-args t) ; Emacs 19 (setq w32-quote-process-args t) ; Emacs 20 (setq shell-command-switch "-c")
You can find tcsh at ftp://ftp.blarg.net/users/amol/tcsh. To use tcsh, place the following in your startup file:
For more configuration information with tcsh, take a look at Chris McMahan's <cmcmahan@surefirev.com> setup.(setenv "SHELL" "tcsh.exe") (setq win32-quote-process-args t) ; Emacs 19 (setq w32-quote-process-args t) ; Emacs 20 (setq shell-command-switch "-cf")
You can find zsh at ftp://ftp.blarg.net/users/amol/zsh/
Apparently the sh-script package isn't finding the shell program correctly. Peter Breton <pbreton@i-kinetics.com> says that adding a call to sh-set-shell in sh-mode-hook will fix the problem:
(add-hook 'sh-mode-hook
(defun my-sh-mode-hook-set-shell ()
;; Use whatever shell is most appropriate, it doesn't matter
;; if the actual /bin/ksh file exists on the system or not
(sh-set-shell "/bin/ksh")))
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)
To prevent echoed commands from being printed, you can place the following in your startup file:
If shell-mode still is not stripping echoed commands, then you'll have to explicitly tell the shell to not echo commands. You can do this by setting the explicit-SHELL-args variable appropriately, where SHELL is the value of your shell environment variable (do a "M-: (getenv "SHELL")" to see what it is currently set to). Assuming that you are on NT and that your SHELL environment variable is set to cmd.exe, then placing the following in your startup file will tell cmd.exe to not echo commands:(defun my-comint-init () (setq comint-process-echoes t)) (add-hook 'comint-mode-hook 'my-comint-init)
(setq explicit-cmd.exe-args '("/q"))
The comint package will use the value of this variable as an argument
to cmd.exe every time it starts up a new shell (as in shell-mode); the
/q is the argument to cmd.exe that stops the echoing (in a
shell, invoking "cmd /?" will show you all of the command line
arguments to cmd.exe). Note that this variable is case sensitive; if the value of your SHELL environment variable is CMD.EXE instead, then this variable needs to be named explicit-CMD.EXE-args instead.
The character appended to directory names when completing in shell-mode is determined by the value of the variable comint-completion-addsuffix. If the value of this variable it t, then a '/' is appended to directory names. If the value of this variable is a cons pair, then the first value of the pair is appended.
In 19.34, lisp\winnt.el initializes comint-completion-addsuffix to the cons pair '("\\" . " ") using shell-mode-hook. This means that, by default, a "\" is appended to directory names during completion in shell mode. To override this behavior, you need to change the value of comint-completion-addsuffix. You can do this by resetting it in your startup file to t or by explicitly setting it to a cons pair with "/" in it:
(add-hook 'shell-mode-hook
'(lambda () (setq comint-completion-addsuffix '("/" . "")))
t)
or
(add-hook 'shell-mode-hook
'(lambda () (setq comint-completion-addsuffix t))
t)
In 19.35, the default will be to append "/". If Emacs detects that you are using command.com or cmd.exe, then it will it use "\" instead.
Multiple lines for each shell are given since variable names are case sensitive and shell names can be any case (so this only handles the most common situations). If you have an entirely different shell that also complains about being given the "-i" switch, you can initialize a similarly named variable to prevent the "-i" switch from being sent to the shell.(setq explicit-command.com-args nil) (setq explicit-COMMAND.COM-args nil) (setq explicit-cmd.exe-args nil) (setq explicit-CMD.EXE-args nil)
Note that, if you would like to always pass arguments to an interactive shell when it starts up, you would change the nil value in the appropriate assignment above to the list of arguments you would like to use with your shell. For example, if you would like to invoke command.com and tell it which directory its executable resides, you could place something like the following in your startup file:
;; Determine the directory containing the shell program, explicitly making ;; certain that the directory separator is a backslash when doing so. (let ((directory-sep-char ?\\)) (setq shell-directory (file-name-directory (getenv "SHELL")))) (setq explicit-command.com-args (list shell-directory)) (setq explicit-COMMAND.COM-args (list shell-directory))
The fix for this is to either prevent any arguments from being sent to the shell when it starts up (in which case command.com will use a default, and correct, value for COMSPEC), or to have the first argument be the directory in which the shell executable resides. Examples of how to do both of these are in shown in the previous subsection.
Chris Boucher <chris@sorted.org> reports that Dr. Solomon's WinGuard prevents any shell related commands from working. He found that turning off "Scan all files" makes it work, though.
I've only tested the outgoing and incoming RMAIL setups. If you find that the suggested code for any of the other incoming mail configurations is inaccurate, please let me know.
(setq user-full-name "Your full name") (setq user-mail-address "Your email address") (setq smtpmail-default-smtp-server "Domain name of machine with SMTP server") (setq smtpmail-local-domain nil) (setq send-mail-function 'smtpmail-send-it) (load-library "smtpmail")
Note that if you want to change the name of the smtp server after you've loaded smtpmail.el, you'll want to change the variable smtpmail-smtp-server.
If you are using GNUS to send mail, then you will also need:
If you are experiencing problems with sending large messages, check the value of the variable smtpmail-debug-info. If it is non-nil, you should set it to nil:(load-library "message") (setq message-send-mail-function 'smtpmail-send-it)
(setq smtpmail-debug-info nil)
If you would like to queue your outgoing mail so that you can then later send it all as a batch (e.g., when you are working disconnected on a laptop>
Feedmail comes with Emacs 20. If you're using 19.34, download the package from Bill's site, byte-compile it, and place it in your load path. You'll then need to customize it in your startup file; see Bill's setup for one example.
Fabio Somenzi <Fabio@Colorado.EDU> also sent the following as an example:
(setq send-mail-function 'feedmail-send-it) (autoload 'feedmail-send-it "feedmail") (autoload 'feedmail-run-the-queue "feedmail") (setq feedmail-buffer-eating-function 'feedmail-buffer-to-smtpmail) (setq feedmail-enable-queue t) ; optional (setq feedmail-queue-chatty nil) ; optional
Fabio also redefined the function make-auto-save-file-name to auto-save files in one local directory ($HOME/.save) and to strip out invalid characters in file names (this bug should be fixed in 19.35). Note that all files will auto-save to this directory; this allows Emacs to auto-save even when the folder files are on an inaccessible remote machine. Place the following definition of make-auto-save-file-name in your startup file to override the definition in winnt.el.
Lastly, if you would like to protect the primary folder from crashes while it is being written back to disk, then also place the following in your startup file (assuming you use VM):
(add-hook 'vm-mode-hook
'(lambda ()
(make-local-variable 'file-precious-flag)
(setq file-precious-flag t)))
(setenv "MAILHOST" "Domain name of machine with POP3 server")
(setq rmail-primary-inbox-list '("po:Your login") rmail-pop-password-required t)
Note that you will need to customize the Domain name of machine
with POP3 server and Your login fields to be the name of
your POP server and your login name.
(setq vm-spool-files
(list
(list "~/INBOX"
"POP3 server:110:pass:POP user name:*"
"~/INBOX.CRASH")))
Note that you will need to customize the POP3 server and POP
user name fields to be your login name and the name of your POP
server. You will also probably want to customize the name of your
inbox and crash files (~/INBOX and ~/INBOX.CRASH in
the example above.)
Be sure to customize the POP user name field appropriately.(load-library "message") ;; For sending mail (setq message-send-mail-function 'smtpmail-send-it) ;; For reading mail (other backends can be substituted for nnml) (setq gnus-secondary-select-methods '((nnml ""))) (setq nnmail-spool-file "po:POP user name") (setq nnmail-pop-password-required t)
If you want to share your rmail folders between Unix and NT/95, you'll want to handle all your mail in binary format. This includes mail stored in folders as well as incoming mail. For mail stored in folders, you'll want to treat the directory in which you store your mail as an untranslated file system; see the section on translation below on how to do this.
For incoming mail using RMAIL, you'll need to make a small patch to rmail.el. See Don Erway's <derway@ndc.com> message describing the patch and what else he did to setup sharing between Unix and NT/95.
Mail packages often provide some way to notify you when email has arrived (a la "biff" in Unix), conveniently distracting you from getting any real work done. There are myriad ways to do this, and as people tell me them I will try to mention them here.
Franklin Lee <flee@lehman.COM> has extended the pop3 package so that you can have your mail left on the server instead of always being downloaded (it also has a biff-mode with international "barks", which can be used whether or not you download or leave your mail on the server). You'll need to download a zip archive containing a patched pop3.el and some additional elisp files:
If you unpack on Unix, be sure to use "unzip -a" to strip any carriage returns.
For instructions on how to install and configure this package so that you can leave your mail on your pop3 servers, see the instructions at the top of the epop3mail.el file.
This should potentially work with other mail packages that rely upon the pop3 elisp code. If you find that it does, or implement the glue necessary to make it work, let me know and I'll update this FAQ entry.
John Dennis <jdennis@ultranet.com> has ported Metamail, a package that allows you to receive and send MIME attachments using Emacs. For details, see John's README file:
The latest version of VM works around the problems in vm-pop, but smtpmail requires a small patch. If you are encountering similar problems, then you should modify the end of smtpmail-via-smtp in smtpmail.el as follows:
;(delete-process process)
(run-at-time 3 nil 'delete-process process))))))
To read news with Emacs, you can use the Gnus package. To invoke Gnus, type "M-x gnus" and Emacs will prompt you for a news server to connect to. For more information about using Gnus, take a look at:
For more discussion and other methods of giving Gnus a password, see a discussion on the topic.(add-hook 'nntp-server-opened-hook 'nntp-send-authinfo)
See the "What other packages work with Gnus?" question of the Gnus FAQ.
To save messages untranslated (no carriage returns), you must set the default-buffer-file-type to binary:
(setq default-buffer-file-type t)
David Finucane <finucane@myri.com> has written an elisp/Java package that makes it easy to read online newspapers through Emacs:
(Note: If you use anti-virus software, see the warnings above.)
MiKTeX is a native Win32 implementation of the TeX document processing system. The MiKTeX project page is at http://www.snafu.de/~cschenk/miktex. The project page has instructions on where to download the distribution and how to install it.
AUCTeX is a package for writing LaTeX files in Emacs. The AUCTeX project page is at http://sunsite.auc.dk/auctex, and has links for downloading the distribution and reading the manual. Lars Schmidt-Thieme <lschmidt@ix.urz.uni-heidelberg.de> has written instructions on how to use AucTex with MikTex and Emacs.
Willem Minten <Willem.Minten@esat.kuleuven.ac.be> has put together a page that has everything you need to get MiKTex, AucTeX, and Emacs working together. If you're starting from scratch, look here first.
David Finucane <finucane@myri.com> has written an elisp/Java package that uses the AltaVista translation service to translate text among a number of languages.
Jari Aalto <jari.aalto@poboxes.com> is porting PGP from Unix to NT as a package called TinyPgp for use with Emacs on NT:
Feel free to send bug reports to Jari or to the ntemacs-users list. Also, if you would like to get updates directly from Jari, let Jari know that you are using TinyPgp by sending him email.
For a close coupling of Emacs and MSVC, Christopher Payne <payneca@sagian.com> wrote a Visual Studio add-in that makes Emacs the default text editor. See his page for more info on what it can do and how it works. For information on how to customize your general development environment to use Emacs with MSVC, read Charles Curley's text below. For VisEmacs alpha executables, download this VisEmacs.zip distribution.
Written by Charles Curley with a lot of help from: David Biesack, Caleb T. Deupree, John Huxoll Gardner, Anders Lindgren, and John Yates.
This is an app note on how to use Microsoft Visual C++ with Emacs. The experiments done below were done with Emacs 19.34.1 on Windows 95, using Visual C++ 4.0 Standard Edition. Your mileage may vary.
This writeup assumes minimal knowledge of Emacs hacking on the part of the reader.
rem set up for MS C++ 4.0 call d:\msdevstd\bin\vcvars32.batUnder NT, you can set the HOME and other environment variables in the System applet of the Control Panel.
John Huxoll Gardner writes that
These environment variables can be set through the control panel. Control Panel->System->Environment tab set include to d:\msdev\include;d:\msdev\mfc\include (or whatever) set lib to d:\msdev\lib;d:\msdev\mfc\lib (or whatever) set MSDevDir to d:\msdevYou should now be able to compile from Emacs. Load a source file from a VC++ project. Type M-X compile. Replace the proposed command line with:
nmake -f MyProject.makYou will find that this defaults to a win 32 debug build. You can change it to a release build with:
nmake -f MyProject.mak CFG="MyProject - Win32 Release"By the way, you can scroll in the M-X command buffer with up and down arrows. You can also scroll in the compile command buffer with the up and down arrows. Both seem to be fully editable as well.
; Set up for Visual C++ compiling
(setq compile-command '("nmake -f .mak " . 10))
If you work on the same project extensively, toss that in to the default string. You can always override it when you work on another project.By the way, many if not all Microsoft command line programs now accept a dash (-) as a switch specifier as well as a slash (/). This was true as long ago as Mess-DOS 6.0, I believe. I use it because that eliminates one area where I have to remember which OS I am using. :-)
David Biesack suggests that perhaps it's easy to define Makefile in the project directory which does
PROJECT=MyProject all: debug debug: FORCE nmake /f $(PROJECT).mak CFG="$(PROJECT) - Win32 Debug" release: FORCE nmake /f $(PROJECT).mak CFG="$(PROJECT) - Win32 Release" FORCE:and then you can simply change compile-command to "nmake".
Caleb T. Deupree reports that on VC++ 5.0 and up, "You can also set an option on Options/Build to export a makefile every time the project is saved, which you can then use to compile with 'nmake -f project.mak'." VC++ 4.0 builds the make file every time, and there is no option.
One of the things that compile.el provides is the ability to scan the output from a compile session, and move from error message to error message. This facility depends on a series of regular expressions ("regexes") which are applied to search the compiler output. Normally, you shouldn't have to do anything. However, if you have problems with this facility, you can comment out the regexes you don't need and recompile. Search the file for "compilation-error-regexp-alist" and comment out as needed.
To recompile, make the file the active buffer. Emacs will recognize it as an elisp file, and add a pull-down menu for elisp functions. One is for compiling, the other will compile and then load.
By the way, the best (and so far, only :-) book I've seen on regular expressions is Jeffrey E. F. Friedl, *Mastering Regular Expressions*, O'Reilly & Assoc, Inc, 1997. It covers regex syntax and usage for Emacs, perl and other tools that regexes.
Occasionally, you need to add a new function or variable from the Visual C++ IDE. This means that the copy of the file in your Emacs buffer is now obsolete. The simplest thing to is a two part manual effort. First, before you leave Emacs for VC++, make sure you save all your buffers (C-X S). When you return, you can revert buffers you know have been changed with M-X revert-buffer. If you try to modify a file that has been changed from outside Emacs (say, by VC++), Emacs will warn you and offer you the chance to revert the buffer, so you can safely try modifying files after making a change from VC++.
However, this depends on the user remembering to do something, always a hazard. The obvious way to handle the problem is to automate it, which Anders Lindgren has already done. He writes:
This feature will be present in the next version of Emacs. There will be two modes, `global-auto-revert-mode' that applies to all buffers while `auto-revert-mode' can be activated for individual buffers. You can get the latest version from: http://www.csd.uu.se/~andersl/emacs.shtml Please note that this feature comes with a prize: Normally Emacs acts like an extra backup system, keeping a copy of the files you are editing. Should some external program mess up a file, you can always save the copy you're editing. When using Auto-Revert mode Emacs will happily load the corrupt file, perhaps ruining you last chance to restore the original file content! -- Anders -- ;; .signature -- File added to the end of mail, containing joke or info. (defvar me '((profession . "Compiler Designer") (company . "IAR Systems") (age . 27) (country . "Sweden") (hair . "Long") (water-skier . t))) ;; .signature ends here.(Now, *that* is an elisp hacker's sig line! :-)
The next version of Emacs to which Anders refers is, I believe, 20. I don't know when it will be released.
If you can't wait, you can scarf the source for autorevert.el in from Anders' web page. However, it is dependent on another Emacs package, Custom, which is not in the version of Emacs I have (19.34.1). Custom is available at http://www.dina.kvl.dk/~abraham/custom/. Installing the Custom package is beyond my meager elisp hacking skills, so you are on your own there. The next release will also include Custom.
Caleb T. Deupree also writes, "You might also mention a package mode-compile.el, which is a wrapper around compile mode and is available from the Emacs lisp archive or from http://www.cenatls.cena.dgac.fr/~boubaker/Emacs/index.html. It detects makefiles in directories and parses them for valid targets, performing many of the same tasks which you do in your hooks."
You should now be able to go to any source file in your project. Then, use the pull-down menu Tools->Emacs. The active file in your VC++ ide should now be front and center in Emacs, all ready to edit as you wish. If you use keystrokes to work the menus, try <alt>T A to move the file into Emacs. Binding this tool to a keystroke will be left as an exercise for the student.
If you have the option of saving files before running tools, make sure this option is set. (I don't see it on VC++ 4.0.)
Jonathan Arnold's <jdarnold@buddydog.org> EmacsEdit "expert" for interfacing C++ Builder and Emacs.
The Emacs 20.3 pretests and above support the Intellimouse on both NT and Win9X. Emacs 19.34.6 supports it on NT, but not on Win95.
Clicking the mouse wheel is interpreted as a mouse-2 event, which is normally bound to mouse-yank-at-click (i.e., paste). Since it is easy to accidentally click the mouse wheel, you might find that you inadvertantly paste text as you scroll the wheel. To prevent this from happening, you can disable the mouse-2 binding in your startup file:
(global-unset-key [mouse-2])
Walt Buehring <buehring@i2.com> has extended the implementations of mouse-wheel-scroll-line and mouse-wheel-scroll-screen. To use, download and place in your startup or site-init files.
For more details on interpreting mouse-wheel events in elisp, see Michael Duggan's <md5i@schenley.com> description of the implementation.
Apparently, FlyWheel and Emacs Intellimouse support don't work together. You can selectively disable FlyWheel for Emacs using a registry entry; see the FlyWheel README for how to disable it for a specific application.
Emacs is incompatible with the latest versions of mouse wheel devices. To get your mouse wheel to work with Emacs, you'll need to select some options in the device setup panels.
A perl-mode comes with the Emacs distribution, and will be used when you load and edit Perl files.
Users have also recommended an alternate mode named cperl-mode. You can get this from ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl/.
From Jay Rogers <jay@rgrs.com>:
There are potentially two problems that cause the perl debugger to hang when started in emacs. One's an emacs problem while the other's a perl problem.
First, get Emacs 19.34.4 or later for 95/NT. It contains a fix that allows emacs to read all ASCII characters from the perl debugger, including the dreaded ^Z (aka EOF in DOS). It also groks the "drive:path" filename notation.
Second, some versions of the perl debugger itself need to be patched to work with emacs. They are perl versions 5.001 and less, and version 5.004_01. To fix, locate and change the code similar to the following code in lib/perl5db.pl
if (-e "/dev/tty") { $console = "/dev/tty"; $rcfile=".perldb"; } elsif (-e "con") { $console = ""; <---- change "con" to "" $rcfile="perldb.ini"; } else { $console = "sys\$command"; $rcfile="perldb.ini"; }
Doug Campbell <soup@ampersand.com> also has some suggestions for improving the interaction of perldb and Emacs.
On NT, you should be able to use hexl-mode as you would on Unix (e.g., M-x hexl-mode and you're off to the races). On Windows 95, however, you won't be able to use hexl-mode if you use command.com as your shell because it doesn't accept input from stdin. Instead, you will have to use one of the non-system shells (see the section below on shells for more info on some shells you can use). You might also have to explicitly set hexlify-command and dehexlify-command; for more info from users who have gotten it to work on their system, take a look at these suggestions.
If you are having trouble with hexl-mode and bash, see Andrew's comments on the topic.
The python-mode shipped with Python 1.5 requires a new custom.el before it can be used with Emacs 19.34. For more information, see the description of python-mode at http://www.python.org/emacs/python-mode/.
Emacs 20.3 comes with an ange-ftp.el that can use the standard Windows ftp.exe, so you should not need to download anything to use ange-ftp.
19.34
You will need a new version of the ftp.exe executable before ange-ftp will work with Emacs. This is due to the unfortunate fact that the ftp program shipped with Win95 and NT does not accept a password from a pipe or a redirected file (also, the version of ange-ftp.el distributed with Emacs before 19.34.6 needed some patches; if you are using a version before 19.34.6, you can upgrade or download the 19.34.6 lisp source and get ange-ftp.el from there).
Stephan Doll <stephand@vnet.IBM.COM> provided a port of the BSD ftp client. This client should work through firewalls.
Place the ftp.exe executable in a directory where you keep your local executables. Then be sure that the exec-path variable is set so that, when Emacs runs the ftp.exe program, it runs the one you downloaded (and not the default one). As an example, assuming that you placed ftp.exe in, say, %HOME%\bin, you could set exec-path as follows in your startup file:
(setq exec-path (cons (expand-file-name "~/bin") exec-path))
As another alternative, you can tell ange-ftp exactly which ftp program to use by customizing ange-ftp-ftp-program-name, e.g.:
(setq ange-ftp-ftp-program-name "c:/bin/ftp.exe")
With this method you don't have to worry about the wrong ftp program being picked up through exec-path.
You will also want to customize the temporary directory that ange-ftp uses to cache files:
(setq ange-ftp-tmp-name-template
(concat (expand-file-name (getenv "TEMP")) "/ange-ftp"))
(setq ange-ftp-gateway-tmp-name-template
(concat (expand-file-name (getenv "TEMP")) "/ange-ftp"))
Spencer Low <spencer@lowtek.com> noticed that the 19.34.6 version of ange-ftp does not handle "227 Passive mode" messages properly (Emacs 20 does). He added the following to his startup file to fix the problem:
(setq ange-ftp-skip-msgs (concat "^200 \\(PORT\\|Port\\) \\|^331 \\|^150 \\|^350 \\|^227 \\|^[0-9]+ bytes \\|" "^Connected \\|^$\\|^Remote system\\|^Using\\|^ \\|Password:\\|" "^Data connection \\|" "^local:\\|^Trying\\|^125 \\|^550-\\|^221 .*oodbye") )
A number of users have had difficulty getting ange-ftp to work on their systems (usually Emacs 20). Ted Jump <tjump@cais.com> has put together his collection of ftp client and elisp modules that works for him. If you experience problems with ange-ftp, you might want to take a look at his kit.
Before you can use telnet-mode from within Emacs, you need a telnet client other than the one found on the system; the system telnet is a windows app, and cannot be used as a subprocess since it does not use stdio for input and output.
Two possible telnet clients that you can use are:
Unfortunately, this telnet program requires that the host be specified on the command line, but telnet-mode wants to specify the host using the "open" command once telnet has started. Zoltan Kemenczy <zoltan@nabu.isg.mot.com> has written a version of the telnet-mode function that does this. To use it, place "(require 'telnet)" in your startup file, followed by Zoltan's new telnet-mode code.
If the new telnet-mode still does not work for you, then you will probably find it easiest to run telnet inside of a shell buffer (instead of using telnet-mode). If you use the Borland C compiler and want to do a little hacking, it would be great if you could change this telnet to be able to start up without requiring a host on the command line. The source is included in the above zip file, and Naftali has some tips for making this change.
The jtelnet page describes how to set it up for use with Emacs. For the other telnet client, you can either place the telnet.exe program in your exec-path (e.g., anywhere in your PATH, or in the Emacs bin directory) or set the telnet-program variable in your startup file to point to the executable.
To use grep with Emacs, you first need to obtain a version of grep. Many of the packages listed in the section below on Unix Tools come with a version of grep (and cousins egrep and fgrep). Once you have grep, be sure that it is in your system path or in Emacs' exec-path. Then you should be able grep from within Emacs using "M-x grep".
If you can't get access to grep, then you can use the findstr program that comes with NT and Win95 instead. It is much more limited in its searching ability, but if you have simple needs it may be adequate. Peter Breton <pbreton@i-kinetics.com> shows you how to do this.
Some users find the igrep package to be a more useful package for using grep (for example, it supports recursive greps directly). Here are some pointers from other users on what you need to do to get igrep working on your system. You can download igrep from the elisp archive at ftp://ftp.cis.ohio-state.edu/pub/emacs/emacs-lisp/misc/igrep.el.gz.
To do a recursive grep, you need the help of some other utilities. Probably included in the same package that has grep will be find, a program that can recursively traverse directories and invoke programs on the files it finds. To do a recusrive grep with find, invoke "M-x grep" and run the following command:
find . -name pattern -exec grep -n string NUL {} ;
The pattern argument determines which files are matched (e.g., "*.c" for all .c files). The string argument specifies the string that you are searching for. And the NUL argument is a standard way to ensure that grep reports filenames in the matches (grep reports filenames when it is invoked on more than one file, and the NUL device is simply another file that will never contain matches; on Unix, you would use /dev/null).
If you also have the xargs program, than you can make the recursive grep more efficient. Instead of the above command, use:
find . -name pattern -print | xargs grep -n string NUL
The xargs command collects lines from its input and concentates them together as one list of arguments, and invokes the specified program with the argument list (breaking the arguments up into multiple lists and invocations if necessary). The above command first uses find to print out the set of filenames that match pattern, which then gets passed to xargs. xargs concatenates the lines of filenames into lists of arguments and invokes grep on them.
The crypt++ package doesn't yet work out of the box with Emacs on Win32. David S. Rosinger <dsrosing@fed3005.reston.ingr.com> has modified crypt++.el so that it would work on Win32; see his comments for a description of what he has changed and how to use crypt++ under Win32.
Download this patched version of crypt++.el and place it somewhere in your load-path. You'll also need the compression/uncompression utilities (look in ftp.cs.washington.edu/pub/ntemacs/utilities) in your exec-path.
You can find the original crypt++.el at ftp://archive.cis.ohio-state.edu/pub/emacs-lisp/misc/crypt++.el.Z.
Download the latest version from ftp://ftp.cs.indiana.edu/pub/elisp/w3/.betas/ and follow the directions in the README.NT file.
Then add the following commands to your startup file:
This works with the default browser on your system, whether it's IE or something else. However, you must have IE3 installed on your system for it to work with other browsers as the dll that makes this all work, WININET.DLL, only gets installed when IE3 is installed.(defvar shell-execute-helper "shelex.exe") (defun shell-execute-url (url &optional new-window) "Invoke the shell-execute-helper program to call ShellExecute and launch or re-direct a web browser on the specified url." (interactive "sURL: ") (call-process shell-execute-helper nil nil nil url)) (setq browse-url-browser-function 'shell-execute-url) (setq gnus-button-url 'shell-execute-url) ; GNUS (setq vm-url-browser 'shell-execute-url) ; VM
NOTE: More work has been done to get browse-url working well in both environments, but I haven't had a chance to update this section with the latest. See the collection of messages on this topic for more information.
NOTE: If you would like to use shelex.exe to open files in your web browser, you will have to update some registry keys. See Peter Breton's note for details on which keys to change and what to change them to.
Peter Breton <pbreton@i-kinetics.com> wrote a small package for using browse-url to do dictionary lookups, internet word searches, etc. The package is called simple-web.
Theodore Jump <tjump@cais.com> has written a package that uses Windows file associations to launch applications on files from Emacs, based upon Caleb Deupree's <cdeupree@abwh.cincom.com> shellex program. See http://www.i21.com/~tjump/files/ for more information and a distribution file.
Font-lock mode is a mode that performs color syntax highlighting for other major modes in Emacs. To use font-lock, place the following in your startup file:
(cond ((fboundp 'global-font-lock-mode)
;; Turn on font-lock in all modes that support it
(global-font-lock-mode t)
;; Maximum colors
(setq font-lock-maximum-decoration t)))
The above code uses the default faces for decoration. If you would like to customize the attributes of the faces, you can use the following startup code to get started:
(cond ((fboundp 'global-font-lock-mode)
;; Customize face attributes
(setq font-lock-face-attributes
;; Symbol-for-Face Foreground Background Bold Italic Underline
'((font-lock-comment-face "DarkGreen")
(font-lock-string-face "Sienna")
(font-lock-keyword-face "RoyalBlue")
(font-lock-function-name-face "Blue")
(font-lock-variable-name-face "Black")
(font-lock-type-face "Black")
(font-lock-reference-face "Purple")
))
;; Load the font-lock package.
(require 'font-lock)
;; Maximum colors
(setq font-lock-maximum-decoration t)
;; Turn on font-lock in all modes that support it
(global-font-lock-mode t)))
Also see the help text for the function global-font-lock-mode and the variable font-lock-face-attributes.
To see a list of colors that Emacs understands by name, select the "Edit->Text Properties->Display Colors" menu command.
For font-lock settings for Java, see the section on Java.
You can use the htmlize.el package by Hrvoje Niksic <hniksic@srce.hr> to convert font-lock attributes in buffers to HTML markups. See the comments at the top of the file on how to use it.
If you are using a version of Emacs before 19.34.6 and an 8-bit display, then you should download this version of htmlize.el instead. However, this is likely to become out of date with respect to Hrvoje's version, so I would actually recommend upgrading to 19.34.6.
The format of the mode line is determined by the variable mode-line-format, a buffer-local variable. To understand how to interpret the mode line, see the Info node "C-h i m emacs RET m mode line RET". For a description of minor modes that provide additional information on the mode line (like line and column number, current time, and mail status), see the Info node "C-h i m emacs RET m optional mode line features".
You can also directly customize the format by assigning a new format string to the mode-line-format variable in your startup file. For a description of the format codes, see the help string for the variable ("C-h v mode-line-format").
Emacs 20 introduced a set of character mnemonics for the mode line to represent the end-of-line conversion being used for the current buffer (specified in the format string using %Z). Some users find the default mnemonics somewhat counter-intuitive, and prefer to customize them in their startup file. A popular customization is the following:
(setq eol-mnemonic-dos (string-to-char "\\")) (setq eol-mnemonic-unix (string-to-char "/")) (setq eol-mnemonic-mac (string-to-char ":")) (setq eol-mnemonic-undecided (string-to-char "?"))
You can use either a two- or three-button mouse with Emacs. If you have trouble with either of these working with Emacs, see below.
Emacs assumes that you have a three-button mouse by default. However, if you have a two-button mouse, you can press both buttons at once to emulate the missing middle button expected by Emacs.
Three variables control mouse button emulation under Emacs: w32-num-mouse-buttons, w32-mouse-button-tolerance, and w32-swap-mouse-buttons (win32-num-mouse-buttons, win32-mouse-button-tolerance, and win32-swap-mouse-buttons in Emacs 19). If you use help on w32-num-mouse-buttons (i.e., with "C-h v"), it will tell you how many buttons Emacs thinks your mouse has; if w32-num-mouse-buttons is less than 3, then Emacs will emulate the middle mouse button.
Emacs emulates the middle mouse button by treating simultaneous button presses of the left and right buttons as a middle button press. Since both button presses cannot really be simultaneous, Emacs compares button presses within a specified window of time to determine whether it should emulate the middle button. This window of time is controlled using w32-mouse-button-tolerance. Help on this variable will show you the value Emacs uses by default, and you can change this value to suit your needs.
Depending upon the type of two-button mouse, you may find it useful to swap the mapping of middle and right mouse buttons. By default, the middle button is mapped to mouse-2 and the right button is mapped to mouse-3. If you set w32-swap-mouse-buttons to a non-nil value, then you can swap these two mappings.
If you have a three-button mouse, Emacs should recognize and support the third (middle) button automatically. However, some people find that they have a three button mouse, but the middle mouse button does not work for them. First check to see if w32-num-mouse-buttons (win32-num-mouse-buttons in Emacs 19) is set correctly. If so, then check to see whether your mouse has been installed with the proper driver (open Control Panel->Mouse to examine the driver being used). If you have the right driver, then, on NT, check if HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Busmouse\Paramete rs\NumberOfButtons is set to 3, and change it to 3 if it is not. If nothing seems to be amiss, then at the very least you can have Emacs emulate the middle button by setting w32-num-mouse-buttons to 2.
One workaround is to right-click on the desktop, and then left-click on the desktop, and the mouse should be back in its normal state.
To run Emacs in console mode, invoke emacs.exe with the "-nw" flag:
C:\> emacs.exe -nw
With Emacs 20.3 and previous version, Emacs uses the size of the console buffer as the frame size. If your console window has buffer larger than the window (e.g., it uses a verical scrollbar), then Emacs' frame will be larger than the console window. To work around this problem, make the console buffer the size of the console window. Or, if you have source, apply this patch to src/w32console.c.
This problem has been fixed for 20.4 and later versions.
(transient-mark-mode t)
To highlight matching parentheses, add the following to your startup file:
(show-paren-mode 1)
Look up help for the function for a complete description of how to use the function and which sounds it recognizes.(set-message-beep 'ok)
GNU Emacs 20.3 on Windows does not have complete multibyte support. For information on setting up Emacs for a particular language requiring multibyte support, see Andrew's note.
First you will need to download the leim package from ftp://ftp.gnu.org/pub/gnu/. Then follow these instructions by Jason Rumney <jasonr@altavista.net>.
Erik Peterson <erik@mandarintools.com> has compiled all of the leim input methods for 20.3.1. You can download them from:
To install them, follow Erik's instructions.
You can change standard-display-table to have extended characters displayed as themselves in Emacs. Emacs has a function standard-display-european that changes standard-display-table approprialely for displaying Latin-1 (ISO 8859) characters. To use it, invoke the function with a positive argument:
(standard-display-european 1)
(require 'latin-1)
Andrew Innes <andrewi@harlequin.co.uk> also has suggestions for displaying characters sets other than Latin-1.
If you would like to display particular characters that show up in Emacs in octal form, see another suggestion by Andrew.
Anders Lindgren <andersl@csd.uu.se> has written a package that will display a buffer written using a ISO 8859/1 character set using an OEM (ms-dos) font. See http://www.csd.uu.se/~andersl/emacs.shtml to get the package.
Emacs 20.3 does not display multibyte character sets correctly, although the situation should be better for 20.4. If you are using a package that enables multibyte, you will want to turn it off (likely in the package hook):
(set-buffer-multibyte nil)
Andrew Innes on printing directly from Emacs without support from external programs.
Tim Sherrill <sherritp@sagian.com> has a very informative page on 2-up (n-up) printing from Emacs.
Holger Mueller <hmueller@hrzpub.tu-darmstadt.de> has taken over maintaining print-NT.el [V 1.14, 5/21/98] (previously maintained by Brian Gorka <gorkab@cyberpass.net>).
Ted Jump <tjump@cais.com> has also written w32-print.el, a relatively complete package for printing from Emacs on Win32 systems (Postscript, plain-text, 2- and 4-up, 19.34.X and 20.X, UNC and local device paths, etc.). [V1.4, 5/15/98]
Pascal Obry has a nice example of how to set up some variables to get printing to work on NT.
Jeff Paquette <paquette@mediaone.net> has a version of pr for use with Emacs, and instructions on how to set it up.
Vassil Peytchev <vassil@msn.fullfeed.com> has an example of how to use ghostscript to print to non-postscript printers.
Anders Lindgren <andersl@csd.uu.se> has written a lpr.bat batch file that can be subsituted transparently for lpr on NT (Win95 batch files don't redirect stdin correctly).
A number of other people have put together packages to print from Emacs. I haven't had the time to go through them and piece everything together, but I recommend that you flip through this collection of messages.
For info on 2-up printing from Emacs, take a look at these messages.
For clever tricks for specific printers, take a look at these messages.
Bill Carpenter on printing in color:
It's relatively easy to set up the ps-print package, which can
generate color PostScript output. You can then run the results
through Ghostscript if you don't happen to have a color PS printer
laying around.
To try it manually, do something like this:
(require 'ps-print)
(ps-spool-buffer-with-faces)
and then look for the buffer "*PostScript*".
You can also turn your font-locked buffers into HTML, and then use a browser to print them out. See the section on htmlize.el.
You can use a package like gnuserv to associate files with Emacs so that opening a file outside of Emacs (e.g., by double-clicking on its icon) will create a new frame in a running Emacs displaying that file. Peter Breton <pbreton@dirac.i-kinetics.com> originally ported a version of gnuserv to NT that used named pipes, and Nico Francois <nico.francois@ping.be> has continued development on gnuserv since. It now works on both NT and Win95, and has a number of useful features.
Also, be sure to place the gnuserv executables in your path (or modify your path or Emacs' exec-path to include them), and be sure that runemacs.exe is in your path if you use gnuserv to launch Emacs.
Note that you can set up file associations in Win95/NT 4.0 using Explorer by selecting the "View->Options..." menu operation, and then clicking on the "File Types" tab in the dialog that pops up. Clicking on a file type will allow you to edit it and associate the file with gnuclient.exe.
Warning: Be sure to quote the %1 in the association so that filenames with blanks in them are treated as one argument when sent to Emacs, e.g.:
C:\bin\gnuclientw.exe "%1"
[Discussion of other problems and solutions]
By default, gnuserv will load files into new frames. If you would rather have gnuserv load files into an existing frame, then evaluate the following in the chosen frame:
(setq gnuserv-frame (selected-frame))
Placing the above in your startup file, for example, will have gnuserv load files into the original Emacs frame. Note: one drawback of this approach is that if the frame associated with gnuserv is ever closed, gnuserv won't have a frame in which to place buffers.
NewsKey: HKEY_CLASSES_ROOT\mailto\shell\open\command\(Default) Value: gnudoit -q (message-mail (substring \"%1\" 7))
Edit HTMLKey: HKEY_CLASSES_ROOT\news\shell\open\command\(Default) Value: gnudoit -q (gnus-fetch-group (substring \"%1\" 5))
Thanks to Jason Rumney <jasonr@pec.co.nz> and Sigbjorn Finne <sigbjorn@cse.ogi.edu> for these tips.Key: HKEY_CLASSES_ROOT\htmlfile\shell\edit\command\(Default) Value: gnuclientw %1
You can use Emacs to view document source from Netscape 3.1. First install the gnuserv utilities, and then edit the Preferences->Apps tab. In the "View Source" field, enter "gnuclientw.exe". Amy Abascal <vhchelp@wsos.com> describes what to do with Netscape 4.
I don't know of any way to have Netscape use Emacs for mailto: and news: links as with IE above.
Jerrad Pierce <belg4mit@mit.edu> has packaged together a PIF file and batch file for associating Emacs with file-types via gnuserv.
If you would like to have Emacs prompt you before closing, add the following to your startup file:
(setq kill-emacs-query-functions
(cons (lambda () (yes-or-no-p "Really kill Emacs? "))
kill-emacs-query-functions))
From Andrew:
Obvious extensions would be to add support for querying DDE servers, which would require ddeclient to start parsing the lines from stdin etc. However, this is enough for sending simple commands to servers.
An example of use from Emacs is:
(save-excursion (set-buffer (get-buffer-create " *ddeclient*")) (erase-buffer) (insert "http://www.zdnet.com/") (call-process-region (point-min) (point-max) "ddeclient" nil nil nil "Netscape" "WWW_OpenURL"))
Files that you add to the desktop are stored in a directory somewhere under your Windows directory. On NT 4.0, this directory is %USERPROFILE%\desktop (in other words, c:\winnt\profiles\(user)\desktop if you installed NT in c:\winnt).
The default outline mode in outline.el doesn't work in the NT/95 port of Emacs, reportedly due to its use of carriage returns in hiding text. Instead, use the "noutline" package that is also distributed with Emacs (found in noutline.el in the lisp source).
Kin Cho <kin@isi.com> has noted some differences between outline and noutline. These differences apply to all platforms, though; I've just linked in Kin's message because others might find it helpful in the transition to noutline.
To use the EDT emulation package distributed with Emacs, place the following in your startup file:
(setenv "TERM" "pc") (setq term-setup-hook 'edt-emulation-on)
You might want to also browse through the EDT emulation documentation in etc/edt-user.doc. It describes which keys are emulated, how they are mapped onto the keypad and function keys, etc.
Desktop saving refers to the ability to save and restore editing sessions (state of frames and buffers) between uses of Emacs. Kevin Greiner <kgreiner@geosys.com > has collected some elisp for using the desktop saving features of Emacs that should prove useful for others interested in the feature. Jari Aalto <jari.aalto@poboxes.com> also has collected references to packages that save Emacs state and screen and window position.
There are a number of methods by which you can control automatic CR/LF translation in Emacs, a situation that reflects the fact that the default support isn't very robust. For a discussion of this issue, take a look at this collection of email messages on the topic.
The first method is by file extension using the alist file-name-buffer-file-type-alist. This alist contains pairs of regular expressions and booleans that determine whether a file is opened in binary (untranslated) or text (translated) mode. The alist already contains a number of pairs that you can use as examples for creating your own; do a "C-h v" on the variable name to see the help text and the default pairs.
You could add your own pairs to the alist, or change the alist entirely. For example, if you wanted to open every file in binary mode except for batch files, you could add the following to your startup file:
(setq file-name-buffer-file-type-alist '(("\\.bat$" . nil) (".*" . t)))
The first pair says anything ending with the .bat extension should be opened in text mode, and the second pair opens everything else that doesn't match the first pair in binary mode.
A second method for controlling translation is with the functions at the end of untranslate.el. These functions enable you to turn on and off translation on a filesystem basis (e.g., open anything on C: in translated mode, and anything on U: in untranslated mode). If you want to use these functions, download and place untranslate.el in your load-path and have it loaded from your startup file. Then you can place calls to add-untranslated-filesystem to selectively access filesystems in binary mode.
A third method for controlling translation is to have Emacs scan files and automatically determine whether they are binary or text by looking at the line breaks in the file (i.e., no line breaks or just linefeeds imply binary, carriage return/linefeed pairs imply text). A group effort by people on the mailing list put together a patch that implements this kind of automatic translation. To use it, place this patch in your startup file.
This method will likely be used by default in 19.35 once it is known how automatic line break detection will interact with the MULE support also being added to 19.35.
Now you can set key bindings using the alt modifier. For example,(setq win32-alt-is-meta nil) ; Emacs 19 (setq w32-alt-is-meta nil) ; Emacs 20
sets the key sequence Alt-e to the function forward-sentence.(global-set-key [(alt e)] 'forward-sentence)
See these key definitions from Kim Storm <storm@olicom.dk>.
See these key definitions from Elijah Daniel <Elijah.Daniel@digital.com>.
Jonathan Epstein<Jonathan_Epstein@nih.gov> has developed a demonstration of entering and debugging a Java program entirely by voice, mostly using DragonDictate. This approach makes extensive use of Emacs, and includes DragonDictate macros for Emacs, as well as a mechanism for managing variable names by voice using Emacs.
DragonDictate cannot access Emacs menus with the default Emacs configuration, but you can fix this situation in two ways. The first is to set the variable w32-pass-alt-to-system (win32-pass-alt-to-system in Emacs 19) to true in your startup file:
(setq win32-pass-alt-to-system t) ; Emacs 19 (setq w32-pass-alt-to-system t) ; Emacs 20
Setting this variable to true will have one noticeable side effect, though. If you press the Alt key and then release it, you will activate the menubar instead of sending Emacs the meta character. Depending on your typing style, this could make little or no difference, or it could be very annoying.
Another approach, suggested by Paul Rensing <paulr@dragonsys.com>, is to create a set of DragonDictate macros that send keystrokes instead of accessing the menu (e.g., "Open File" sends "C-xC-f"). For a good example of how to do this, see Eric S. Johansson's <esj@harvee.billerica.ma.us> macro set.
Tom M. Kroeger <tmk@cse.ucsc.edu> also has a page of his DragonDictate macro files and Emacs configuration files at http://www.cse.ucsc.edu/~tmk/dictation.
For a more general discussion of Emacs, DragonDictate, and SAPI, take a look at this collection of messages.
A discussion of using Emacs by visually impaired individuals.
The *Messages* buffer was introduced in 19.29 to, e.g., collect informational messages printed serially to the minibuffer. I find it rather useful, but if you want to get rid of the buffer place the following in your startup file:
(setq message-log-max nil) (kill-buffer "*Messages*")
The first expression disables message logging, and the second expression deletes the buffer. Also see the help text for the message-log-max variable for more information.
Francis Wright <F.J.Wright@qmw.ac.uk> has written a package called "WoMan" for viewing man pages without the need for an external program like man:
This library implements a SUBSET of the formatting performed by the Emacs `man' (or `manual-entry') command to format a UN*X manual `page' for display, but without calling any external programs. It emulates (almost) the WHOLE of the -man macro package, plus those ?roff requests that are commonly used in man pages. However, the emulation is modified to reflect the reformatting done by the Emacs `man' command. No hyphenation is performed.
You can download WoMan from his server. It is currently at version 0.39 (9/14/98).
David Lim <david@ndc.com> reports that there is man page viewer from the Congruent tools at ftp://ftp.cc.utexas.edu/microlib/nt/gnu/gnu-bin.tar.Z. You should be able to use this with the man package (man.el), although I haven't heard how well it works. Also, reportedly there is a hardcoded "/dev/null" in man.el that needs to be changed to "nul" before it will work correctly.
Theodore Jump <tjump@cais.com> has written a package to call WinHelp for context-based help. See http://www.i21.com/~tjump/files/ for more information and a distribution file.
Use the elp package: http://www.python.org/emacs/elp.el.
For Emacs 19.34, Peter Breton <pbreton@i-kinetics.com> has written a package called generic-mode for editing Windows specific files (such as .bat, .ini, .inf, .reg, .rc, and .rul files). Download generic-mode.el and generic-extras.el, place them somewhere in your load-path, byte-compile them, and then follow the instructions at the top of file to use them.
In Emacs 20, these packages have been incorporated into the main distribution as lisp/generic-mode.el and lisp/generic-x.el.
For Emacs 19.34, Anders Lindgren's <andersl@csd.uu.se> has a package for font-lock settings for Java. You can find it at http://www.csd.uu.se/~andersl/emacs.shtml. In Emacs 20, Anders' package has been incorporated into the main distribution.
To create TAGS files for Java source files, use Paul's JDE below.
Paul Kinnucan <paulk@mathworks.com> has also implemented a Java Development Environment:
The JDE is an Emacs Lisp package that provides a highly configurable Emacs wrapper for command-line Java development tools, such as those provided in JavaSoft's JDK. The JDE provides menu access to a Java compiler, debugger, and API doc.
His JDE can be found at http://sunsite.auc.dk/jde/ (also mirrored at http://www.geocities.com/SiliconValley/Lakes/1506/).
20.3.1: Support for jdb has been added to gud.el package.
Jacob is a Java class browser and project manager for Emacs written by Clemens Lahme <Clemens.Lahme@gmd.de>. For details, see the Jacob project page at http://mats.gmd.de:8080/clemens/jacob/.
David Fellows' <fellows@roo.cs.unb.ca> recipe for installing Emacs, JDE, and the Sun JDK: http://www.cs.unb.ca/courses/gen/getit-iz.html.
It provides emacs-19.34-6/jde-2.0.9/jdk-1.1{6,7}/rcs-5.7 plus some customizatins we feel are suitable for java begginners. Installation is supposed to be a "no-brainer"; most times it is.
A caveat: Sun has just released jdk1.1.7 (and withdrawn 1.1.6) so the install file takehome.bat needs to be revised accordingly - the comments should make it obvious what to change. I will be updating the distribution to reflect this no later than this weekend.
A VHDL mode comes with Emacs. If you would like the very latest VHDL mode package, see The official Emacs VHDL Mode Home Page
Here is a simple mode for editing programs written in The World's Most Sucessful Programming Language. It features indentation, font locking, keyword capitalization, and some other convenience functions.
Stan Lanning <lanning@PureAtria.COM> has written source-safe.el, a package for using SourceSafe from within Emacs (9/22/98).
From Tim Sherrill <sherritp@sagian.com>:
Currently, there is not a Delphi-mode which works well. The problems that are introduced by Delphi (Object Pascal, to be specific) are single-line comments (//-type comments) and especially ' in comments. Since ' starts a string in pascal, a ' in a single-line comment starts quoting until a matching ' is found. This makes contractions a real pain in the neck. Below is something posted to the list last September...
The post by Richard Schulte: mods to pascal.el.
Christian Sperr's <christian.sperr@zurich.com> pascal.el modified to support Delphi code.
Lars Marius Garshol <larsga@ifi.uio.no> has written a package called css-mode for editing CSS style-sheets:
Mike Reiss <103311.463@compuserve.com> added some commands to html-helper-mode for Cold Fusion. His comments and files are in cf-mode.txt.
See MathWorks' website for a list of places to get a matlab mode package.
Michael Richters <merlin@dimins.com> wrote a v4test-mode package on top of java-mode. Download the following, byte compile, and place in your load-path:
There are a number of RCS x86 executables floating about. There is an "official" port of GNU RCS available, but it has the semantics that files are managed in CR/LF format. This causes problems if your files are shared with programs on Unix hosts (for more info, see Kai Rommel's message). The version of RCS in the Reed Kotler toolset, on the other hand, does not change the line format. Your call.
The "official" port of GNU RCS can be found in the following places:
DOS, Win95/NT and OS/2 32-bit executables (including diff), as well as formatted documentation files:
ComponentSoftware CS-RCS is a Windows front end to GNU RCS. Single user use of their software is free, and they even have directions on how to use it with Emacs:
David Matyas <davidm@ComponentSoftware.com>: By default,
CS-RCS check-out files using the Windows line-break conventions
( The Reed Kotler toolset can be found at http://www.reedkotler.com.
You can find a free port of CVS from Cyclic Software.
If you use the pcl-cvs package, you'll need to fix a
couple of things in the elisp to make it work on NT; Michael
M. Schmitz <ms@ley.de> has some instructions describing
what you need to do. John D. Amidon <jda@jhk.com> gives an example of what he used to
set up pcl-cvs in his .emacs.
If you are having trouble getting vc-mode working with RCS or CVS,
take a look at Peter Cherna's <peter.cherna@scala.com> problem description and fix.
Andy Eskilsson <andy.eskilsson@telelogic.se> has modified
vc-mode to work with Clearcase; see
http://www.fukt.hk-r.se/~flognat/ntemacsvc.html
There is a cc-vc mode at ftp://rtfm.mit.edu/pub/cc-vc/
(reportedly written by Bill Sommerfeld). I do not know if it works on
NT, though.
Jari Aalto <jari.aalto@poboxes.com> also mentioned ftp://cs.uta.fi/pub/ssjaaa/elisp.html#clearcase_software_and_code_for,
but I did not see anything after a quick glance.
Brian Tibbetts <tibbetts@cat.rpi.edu> has done a lot of work
on making ispell more Win32 friendly, and his latest version is for
ispell 4.0. Check out his page at http://www.cat.rpi.edu/~tibbetts/ispell_toc.html.
If you have problems connecting to his web site, you should send mail
to Brian; if you send it to me, I'm just going to forward it to him
anyway.
Note that ispell 4.0 does not have the language support of ispell
3.1 (it only handles English). See Brian's page for more details.
You'll need a port of diff before you can use the ediff package in
Emacs. Each of the GNU-Win32, UWIN, and Reed-Kotler toolsets have a
port of diff that you can use with Emacs; see the Unix tools port section below. If you just
want diff and aren't in the mood for switching to a new toolset
environment, then you can download the RK toolset and use the diff
from there in isolation.
Patch 2.5 based upon mods by Tim Smith <tzs@halcyon.com> and
a few by Andrew Innes <andrewi@harlequin.co.uk>:
Anders Lindgren <andersl@csd.uu.se>, Jari Aalto
<jari.aalto@poboxes.com>, and Jack Repenning
<jackr@informix.com> maintain a folding mode for Emacs
originally written by Jamie Lokier <Jamie@imbolc.ucc.ie>. You
can download it from http://www.csd.uu.se/~andersl/emacs.shtml#folding.
There is one problem, though. If a section containing folded
lines is killed and later yanked, all line endings are removed. This
is a bug in Emacs that will eventually be fixed in later versions.
Karel Sprenger <ks@ic.uva.nl> recommends the sql-mode in sql-modes.zip, originally
written by Jim Lange <jlange@us.oracle.com>.
You can also get an sql-mode package at ftp://ftp.xemacs.org/pub/xemacs/contrib/.
It reportedly works for both Oracle and Sybase, and runs under GNU
Emacs as well as XEmacs. (Thanks to Peter Breton
<pbreton@volte.i-kinetics.com> for the info.)
Note that, if you are using Oracle SQL*Plus, you'll need to change
the command in sql-mode from sqlplus to plus32s.exe.
I don't know for certain, but it is possible you will have to do
something similar for Sybase, too.
When Emacs deletes a file, it uses the DeleteFile function. This
means that once a file is deleted, it is really deleted; in
particular, it does not use the Recycle Bin to save deleted files.
However, if you are using a development environment that has delete
and undelete support (e.g., Norton Tools, Norton Recycle, or Norton
Protect), you can modify Emacs to use this support instead of the
Win32 API. David Biesack <sasdjb@unx.sas.com> has written a package to leverage such an
environment, demonstrating how you might go about doing this.
There is also a PC Magazine utility for Win95 for redirecting
deletes to the Recycle Bin; see the article
on BigBin for details.
Emacs is Year 2000 compliant to the extent that it has been
designed and tested to be compliant. But remember that Emacs comes
with no warranty, and this applies to Y2K compliance. For more
information, see the discussion on the GNU site about
GNU software and Y2K compliance and this list of GNU
software that has undergone examination and experimentation
(including Emacs).
Emacs on NT has slightly different mappings for keypad keys than
on Unix. When NumLock is active, they have the same mappings (e.g.,
Emacs sees '4' on the keypad as 'kp-4'). When NumLock is not active,
however, they differ. On NT, the keypad keys map to the keypad
functions (e.g., Emacs sees '4' on the keypad as 'kp-left'), but on
Unix the keypad keys are the same as when NumLock is active.
In time I will grow this list to be a more comprehensive
list of bugs.
To get around this problem, create a shortcut icon to the emacs.bat
script. Then right click on the icon and select Properties. In the
dialog box that pops up, select the Memory tab and then change the
Environment memory allocation from Auto to 1024. Close
the dialog box and then double click on the icon to start Emacs.
The UWIN project at AT&T Research is another project whose goal is to
enable UNIX applications to build and run with little or no
modification on Windows NT/95. Part of the UWIN project includes a
port of ksh done by David Korn. For more information, see http://www.research.att.com/sw/tools/uwin.
An older set of the GNU tools that I have seen offered on ftp sites
for NT and Win95 have been based on the Congruent tools (I have heard
mixed reviews of these ports, so use with your own discretion). An
ftp site that seems to offer the full set of these tools is ftp.cc.utexas.edu/microlib/nt/gnu.
Microsoft also has a collection of tools for use with NT, including
Unix tools such as cron, ps, kill, and nice, as well as a number of NT
specific tools. A list of these tools is at http://www.microsoft.com/ntserver/nts/exec/vendors/freeshare/maintnce.asp.
If you're a perl user, then you probably want the port of perl to
Win32. You can download a perl distribution from any of the CPAN
mirror sites, such as ftp://ftp.cdrom.com/pub/perl/CPAN/ports/win32/Standard/.
For a complete list of CPAN mirrors, see ftp://ftp.cdrom.com/pub/perl/CPAN/SITES.html.
David Wihl is maintaining a FAQ about porting Unix applications to NT.
It can be found at http://www.nentug.org/unix-to-nt.
Chris Szurgot is also collecting and implementing Unix style tools for
Windows 95 (and presumably NT). See http://www.itribe.net/virtunix.
Jeff Paquette <paquette@mediaone.net> has a collection of the GNU text
utilities for Win32. See
http://atnetsend.ne.mediaone.net/~paquette/WinProgramming.html.
Reed Kotler <reed@reedkotler.com> and Budi Sutardja have created a
toolset of Unix tools (shells, bin and text utils, and one of his
packages even includes a precompiled version of Emacs). See http://www.reedkotler.com.
NTWare.com collects free
software for NT (Win9X?).
To unsubscribe from the list, send a message to ntemacs-users-request@cs.washington.edu
with the word "unsubscribe" in the body of the
message. Please do not send the unsubscribe message to the list
itself, but to the request alias instead. Sending the message to the
list does not unsubscribe you from it, and it tends to be annoying to
people on the list.
If you are trying to unsubscribe from the list but are encountering
problems, send me mail directly and I will manually remove you from
the list. Again, do not send mail to the list complaining that you
cannot unsubscribe from it.
From the list's "info" message:
I will also be sending announcements about new releases and bug fixes
to this list. These announcements should be relatively infrequent,
however.
FindMail
FindMail <findmail.com> started archiving the ntemacs-users
mailing list in February, 1998. FindMail has useful searching and
indexing abilities, more so than what I have done with hypermail. I
would try here first, and then go through my archives below if you
can't find what you are looking for.
http://www.findmail.com/listsaver/ntemacs-users/
Local
The ntemacs-users list is being archived in hypermail. The gaps
between archived directories are due to mail being thrown away by
hypermail.
CVS
What do I need to do to get vc-mode (version
control) working?
vc-mode and Clearcase
Is there a version of ispell for Win32?
Where can I find a port of the diff program (e.g, for ediff)?
Where can I find a port of the patch program?
Where can I find a folding mode?
Where can I find an sql-mode for Emacs?
Is there undelete support?
Is Emacs Year 2000 compliant?
The keypad
BUGS
Below is a list of the most obvious bugs that users typically
encounter. I am aware that these bugs exist, so there is no need to
send a bug report to either me or to the mailing list. If I know of a
workaround, I'll mention it along with the description of the bug. 19.34
I get these strange error messages. What's wrong?
Win95 Specific Problems
I get these "Out of environment space" messages. Why?
The emacs.bat script sets a number of environment variables that are
used by Emacs to function properly. The console process in which the
script is executed runs out of memory in which to set these
environment variables, causing a mess of problems.
Patches
Below are sets of patches that fix specific bugs, and are organized by
release. They are only useful if you have the source to Emacs. (Note
also that they do not represent the set of differences between one
major release and the next; they are typically patches to popular
problems, or patches that I've sent to the list.)
What other Unix tools have been ported to NT and/or Windows 95?
Probably the first place you should look for more GNU tools is at
Cygnus in the GNU-Win32 project, which is not only trying to port the
GNU tools to Win32, but also provide libraries that allow Unix
programs to use Win32 without modification. The project is at http://www.cygnus.com/misc/gnu-win32.
What's the name of the NT Emacs mailing list?
The name of the NT Emacs mailing list is
ntemacs-users@cs.washington.edu. It's a majordomo administered
list, so, if you would like to subscribe to the mailing list, send a
message to ntemacs-users-request@cs.washington.edu
with the word "subscribe" in the body of the message.
The list ntemacs-users@cs.washington.edu is a forum for discussion
related to using GNU Emacs on Windows NT and Windows 95. Please feel
free to ask and/or answer any questions related to Emacs on NT or
Win95 as you see fit, although I ask that questions regarding general
use of Emacs be directed to the Emacs Info files and the general Emacs
news groups, such as comp.emacs and gnu.emacs.help.
Where are there archives for ntemacs-users?
Note that I may occasionally trim the archive as it chews up
disk space.