| ||||||||||||||||||||||||||||
|
|
Combined Document | Split Document GNU Emacs FAQ For Windows 95/98/ME, and 2000
0. Notes
1. Introduction
2. Getting Emacs
3. Installing Emacs.
4. Display Settings
5. Fonts, and text translation
6. Printing
7. Sub-processes
8. Mail, News, and Network access
9. Text, and utility, modes for Emacs
10. Developing with Emacs
11. Other Unix Ports, and further information
What is Emacs?"Emacs is the extensible, customizable, self-documenting real-time display editor. " For a more detailed description, see the GNU pages at http://www.gnu.org/software/emacs/emacs.html. Which versions of Windows, (and Windows NT), are supported?This port is known to run on all versions of Windows NT - on all its supported platforms, as well as Windows 95, Windows 98, and Windows 2000. This port is built using the Windows Win32 API and supports most of the features of the Unix version. MSDOS and Windows 3.11Eli Zaretskii <eliz@is.elta.co.il> maintains the port of GNU Emacs for MSDOS and MS Windows. You can download precompiled versions with the latest DJGPP archives:
Eli strongly recommends that you start with the emacs.README file: it contains crucial info about what's in the other 10 zip files and how to install them and get started with Emacs on MSDOS/MS-Windows platforms. More from Eli: It might be of interest to Windows users that this version of Emacs supports long filenames (Windows 9x only - not Windows NT, or Windows 2000) 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. MULE/MeadowHisashi Miyashita <himi@bird.scphys.kyoto-u.ac.jp> maintains MULE, multilingual Emacs, and its descendant; Meadow. You can get distributions of MULE at ftp://ftp.tokyonet.AD.JP/pub/windows/win32/mule-win32. With the multilingual support now merged into NTEmacs in 20.4, it is no longer necessary to use a special version of Emacs for other languages, but MULE users may find upgrading to Meadow easier than to NTEmacs because of slight differences in the way they handle fonts. Meadow also has a couple of features that are still missing from NTEmacs, such as support for native IMEs and the special keys on Japanese keyboards. DJGPPThere is a version of Emacs which has been compiled using the Free compiler, DJGPP, (a version of GCC), available at http://www.delorie.com. XEmacsThere 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. MacOSOccasionally I get requests for information about ports of Emacs to the Mac. Here are the ones that I know about:
Where can I get the source distribution?The latest source distribution can be found in ftp://ftp.gnu.org/gnu/windows/emacs/latest. 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.org/gnu. You can also browse the source online; look in ftp://ftp.gnu.org/gnu/windows/emacs/latest for a directory named "emacs-<version>". For more information about the contents of the various files you should read the README file contained in the FTP directory. Where can I get precompiled versions?Starting with Emacs 20.4, precompiled distributions are being hosted at ftp.gnu.org. Distributions for the latest version are at:
Distributions for all architectures and the source are now in the same directory; look for the architecture-specific binary distribution for your machine (e.g., Intel NT and Win9X have "bin-i386" in the distribution name). Now that the precompiled distributions are hosted on ftp.gnu.org, they also take advantage of all of the gnu ftp mirrors. A list of gnu mirror sites can be found at http://www.gnu.org/order/ftp.html; once you are at one of those sites, look in the gnu/windows/emacs sudirectory to find the NT Emacs directory. There are also a number of sites that just mirror the NT Emacs distributions:
Regarding ftp.cs.washington.edu: 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). If you do have trouble downloading the full distribution, try downloading it in the 1.44MB chunks, or try one of the mirror sites. I dont want the precompiled version. How do I compile Emacs myself?To compile Emacs, you will need a Microsoft C compiler package. For NT, this can be any of the SDK compilers from NT 3.1 and up, Microsoft Visual C++ for NT (versions 1.0 and up), or Microsoft Visual C++ (versions 2.0 and up). For Windows 95, this can be Microsoft Visual C++ versions 2.0 and up. 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. How do I use a debugger on Emacs?Emacs is just like any other Windows application compiled and linked using MSVC, and it can be debugged using Windows 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).
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.
What are the differences between Emacs 19.x, and 20.xThere have been many changes from the older versions of Emacs, 19.x, to the latest versions, 20.x. These changes have been made in two main areas:
If you are using an older version of NTEmacs, and are having problems the recommended action is to upgrade to the latest version. Then if you still have problems you should send mail to the list, describing your problem in as much detail as possible. One of the biggest changes has been the mass renaming of symbols, and functions; All functions, and symbols, that used to start with the prefix "win32-" now start with the prefix "w32-". For example what was once called "win32-select-font" is now called "w32-select-font" How do I unpack the distributions?Open a command prompt (MSDOS) window. Decide on a directory in which to place Emacs. Move the distribution to that directory, and then unpack it. If you have the gzipped tar version, first use gunzip to uncompress the tar file, and then use tar with the "xvfm" flags to extract the files from the tar file: % 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 pkunzipwill 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://ftp.gnu.org/gnu/windows/emacs/utilities (ftp mirrors). How do I install Emacs, after unpacking?After unpacking the archive there's very little left to do, you have the choice of:
What do I do if Emacs does not work?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. How do I customize Emacs?At its core Emacs contains a Lisp interpreter, this engine is used to implement most of the core functionality of Emacs. To customize Emacs mostly involves writing extra functions in Lisp, or changing variables that affect the behaviour which is already present. Emacs reads a file ".emacs" when it starts up, this is where it expects to find any customizations that you have made. What is a .emacs file?When Emacs starts up it attempts to load, and execute the contents of a file called ".emacs", or "_emacs". This file is where all the customizations are saved, and restored from when you restart Emacs. All of these settings are stored as Lisp expressions, for a general introduction to Lisp you could see : http://cons.org, more Emacs Specific information can be found in the Emacs Lisp Manual. Where do I put my .emacs, (or _emacs), file?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. 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. Sample .emacs FilesIngo Koch <ingo.koch@ikoch.de> maintains a web site of sample .emacs files contributed by various users. His site is at http://www.dotemacs.de/. There is also a small selection of sample .emacs files available at http://www.dotfiles.com How can I have Emacs prompt me before closing?If you would like to have Emacs prompt you before closing, add the following to your startup file:
How do I associate files with Emacs (i.e., use Emacs as a server with gnuserv/gnuclient)?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 Windows 95, 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 Windows 95/98/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] Controlling the use of framesBy 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. For use with Internet ExplorerYou can use Emacs as the editor for composing mail for mailto: links, reading news for news: links, and editing HTML files in Internet Explorer. You first need to install the gnuserv utilities above, and then modify or create the following registry entries using regedit: 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)) Key: HKEY_CLASSES_ROOT\htmlfile\shell\edit\command(Default) Value: gnuclientw %1 Thanks to Jason Rumney <jasonr@gnu.org> and Sigbjorn Finne <sigbjorn@cse.ogi.edu> for these tips. For use with NetscapeYou 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. PIF file for gnuservJerrad Pierce <belg4mit@mit.edu> has packaged together a PIF file and batch file for associating Emacs with file-types via gnuserv. How do I use find-file to load files that are on the desktop?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). How do I make the active window follow the mouse?If you're running Emacs in a windowing mode, and not in the console you may use a package called follow-mouse to make the current frame, or buffer the one with the mouse over it. Find it here. How do I swap CapsLock and Control?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 (Windows 95) or Input Locales (Windows 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:
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.) Windows 98: I've been told that the Windows 95 keyremap utility also works on Windows 98, despite the warnings on the web page. How can I modify Emacs to be more like a Windows app?There are several differences in the way in which Emacs behaves compared to a standard Windows application, however most of the functionality is already present within Emacs, its just a matter of enabling it. Keypad keys, highlighting selections, etc.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. Standard Windows application keymaps (C-c, C-v, C-x, etc.)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 Storms <stormware@get2net.dk> CUA-mode.el. Window operations (maximize, minimize, etc.)As of Emacs 20.4.1 there is native support for maximizing, and minimizing the Emacs window from Lisp, the following functions will do the job for you:
(defun w32-restore-frame ()
"Restore a minimized frame"
(interactive)
(w32-send-sys-command 61728))
(defun w32-maximize-frame ()
"Maximize the current frame"
(interactive)
(w32-send-sys-command 61488))
Open File dialog boxBinu 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. How do I uninstall Emacs?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. When I run Emacs, nothing happens. Whats the deal?Emacs could have failed to run for a number of reasons. The most common symptom is that, when Emacs is started, the cursor changes for a second but nothing happens. If this happens to you, it is quite likely that the distribution was unpacked incorrectly. Check for the following to see if there was a problem during unpacking:
If you are in doubt about whether the utilities you used unpacked the distribution incorrectly, use the gunzip, tar, and unzip executables provided in the utilities directory. These are the ones I use to create and test the distributions. My advice would be to use these utilities from the start. If it is still not working, send mail to the list, describing what you've done, and what you are seeing. (The more information you send the more likely it is that you'll receive a helpfull response.. 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 older version of Emacs, these programs shouldn't cause any problems if you are running a version of Emacs newer than 20.3. Dr. SolomonsA 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. McAfeeA similar report from Charles Curley. <ccurley@wyoming.com> It has also been reported that you only need to select "Programming Files Only" instead of "All Files" to prevent Emacs from hanging. NortonA third report from Peter Haas about Norton Antivirus 2000 (Emacs 20.5.1, Win98): a DOS shell cannot be started within Emacs without disabling the antivirus autoprotect feature (e.g., clicking on the icon in the system tray). Does Emacs contain a virus?There have been reports from some people that the McAfee virus scanner, (versions unreported), claims that the latest version of NTEmacs contains a virus. Assuming that you are downloading from the official gnu.org site, then these are false positive's which you might see in the following files:
These warnings seem to be artifacts of the way in which Emacs is built - the process of compiling a program, then using a "dumping" process to ensure that things are pre-loaded in the emacs.exe executable - and can be safely ignored. To remove these warnings, update your virus scanner to the latest version. Sometimes when I exit Emacs, my machine hangs or crashes immediately.Have you installed an Iomega Zip drive recently? The Iomega driver and Emacs appear to have a conflict that causes this crash. At present, the only solution is to disable the driver, reboot, and then use Emacs normally. To do this, look in the Startup folder (inside the Programs folder in the taskbar), locate the Iomega-related programs, and move them to a different folder. Then reboot. Emacs will work normally. If you want to use the Zip drive, manually execute the Iomega programs you moved. Then reboot before you use Emacs again. It's not convenient, but at least ou won't crash. Thanks to Will Duquette for this information. How does Emacs determine the name of my computer?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. 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 InterfaceWith the Windows interface, you can change the size, position, font, and color attributes of Emacs using three different mechanisms: using the mouse with the user interface, by specifying them as command line arguments, or by invoking Emacs Lisp functions. You will probably find it convenient to specify command line arguments in the Properties of the shortcut to the runemacs.exe file, and to invoke the lisp functions in your startup file. For information on how to propagate attributes to new frames, see the section below on frames .
How do I enable color syntax highlighting in Emacs (font-lock)?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:
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:
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. An alternative to useing font-lock-mode is to use lazy-lock, to do this use the following:
(setq font-lock-support-mode 'lazy-lock-mode)
Converting font-lock buffers into HTML markupYou 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. Font-locking embedded code (e.g., ASP) in HTML documentsGian Uberto Lauri <lauri@mail.eng.it> has modified html-helper-mode to enable font-locking and mode editing of code embedded in HTML documents (ASP, PHP). How do I change the format of the mode line?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"). What do I do if I have problems with Emacs and my mouse buttons?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. How do I use Emacs with a two-button mouse?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. 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. How do I get Emacs to recognize the third button on my mouse?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 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. Strange two-button mouse behavior on Windows 95.Some people have reported that using a two-button mouse with Emacs sometimes causes problems when they go to click in other windows or the desktop (e.g., double left-clicks are interpreted as a right-click); apparently this is a known bug in Windows 95, and is not confined to using Emacs. If this is happening to you, you might want to flip through a discussion on the topic. 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. How do I highlight the region between the point and the mark?To highlight the region between the point and the mark, use the function transient-mark-mode: (transient-mark-mode t) How do I highlight matching parentheses?To highlight matching parentheses, add the following to your startup file: (show-paren-mode 1) How do I cut & paste text with null characters?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. How do I change the sound of the Emacs beep?You can use the function set-message-beep to change the sound that Emacs uses for its beep. Emacs allows you to specify one of the Windows system sounds for the beep. For example, to use the ok system sound, place the following in your startup file: (set-message-beep 'ok) Look up help for the function for a complete description of how to use the function and which sounds it recognizes. When I yank previously copied or killed text into a buffer, it appears garbled. How can I fix this?`selection-coding-system' is most likely still at it's default of `iso-latin-1-dos'. You can change this to a more appropriate coding system using `set-selection-coding-system' (C-x RET x), or temporarily with `set-next-selection-coding-system' (C-x RET X). If you NEVER cut and paste between Emacs and other programs, you can make Emacs behave for all languages with: (set-selection-coding-system 'emacs-mule) To copy between Emacs and other apps, you may need to use the appropriate Windows codepage as your coding system. To do this, you need to set up the codepage first: (codepage-setup 1251) (set-selection-coding-system 'cp1251) FONTSFonts 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 (w32-select-font))) ; Emacs 20 To 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 Windows 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 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 to t in your startup file: (setq w32-enable-italics t) ; This must be done before font settings! (Emacs 20.x) (set-face-font 'italic "-*-Courier New-normal-i-*-*-11-*-*-*-c-*-iso8859-1") (set-face-font 'bold-italic "-*-Courier New-bold-i-*-*-11-*-*-*-c-*-iso8859-1") 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. FONT 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 Windows 95/98, 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. Emacs multilingual font support(Applies to version 20.4 and later) Is it now possible to display correctly the sample of various scripts and languages accessible from the MULE menu?If you have a Windows font for the script or language, then you should be able to display it using Emacs 20.4. Emacs 20.4 also supports the bdf fonts that were used with the older MULE for Windows version of Emacs and the more recent Meadow versions (as well as the X Windows versions of Emacs). For details on using the bdf fonts with Emacs, see below . More about using Windows fonts: There are a number of languages for which Windows fonts are not yet available, or are not in an appropriate format for Emacs to use, so you will not get every language to display. I also had some problem getting Japanese, Chinese, Cantonese and Korean to display all at once, but this was on Windows 95, and I suspect is a limitation of the OS, rather than a bug in Emacs, as those languages look fine when displayed one at a time (there is a note on the Microsoft language packs that only one may be installed at a time, which I suspect is because of this limitation). How do I get Emacs to display characters other than ISO-8859-1 (West European)?If you are content with the size and style of font that Emacs uses at startup (Courier New 10), you could try using `fontset-standard', which will give you most languages that you have fonts for and Emacs supports. To use `fontset-standard' for all frames, place the following in your startup file:
or, to change for the current frame only: (set-frame-font "fontset-startup") To have more control over which fonts are used in a fontset, you need to specify the fontset manually. If only one character set is needed, the easiest way to do this is to use `create-fontset-from-ascii-font' whereever you define a font.
If you require support for a number of languages, you should use `create-fontset-from-fontset-spec'. Note that installing more than one of the East Asian language packs is not supported by Microsoft, and does not work on Windows 95 at least. It is very difficult to get your system stable again after trying, so it is recommended that you only install the one that you will use the most, and use BDF fonts for the other languages: (create-fontset-from-fontset-spec "-*-Courier New-normal-r-*-*-12-*-*-*-c-*-fontset-most, latin-iso8859-2:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-2, latin-iso8859-3:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-3, latin-iso8859-4:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-4, cyrillic-iso8859-5:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-5, greek-iso8859-7:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-7, latin-iso8859-9:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-9, japanese-jisx0208:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, katakana-jisx0201:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, latin-jisx0201:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, japanese-jisx0208-1978:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, korean-ksc5601:-*-Gulim-normal-r-*-*-12-*-*-*-c-*-ksc5601-*, chinese-gb2312:-*-MS Song-normal-r-*-*-12-*-*-*-c-*-gb2312-*, chinese-big5-1:-*-MingLiU-normal-r-*-*-12-*-*-*-c-*-big5-*, chinese-big5-2:-*-MingLiU-normal-r-*-*-12-*-*-*-c-*-big5-*" t) If you leave character sets out of the fontset-spec above, a font will be chosen at random (not necessarily matching any of the other fonts in the fontset). The fontset name is used to generate the "default" font, which covers ASCII and iso8859-1. To get a full list of character-sets use "M-x describe-fontset" to describe `fontset-standard'. Where can I find fonts for other languages?MS Windows fonts The Windows installation CDROM contains fonts for most European languages. If you did not install "Multilanguage Support" when you installed Windows, you can install it from the "Add Programs" Control Panel. East Asian Language (Chinese, Japanese, Korean) support for Microsoft Word and Internet Explorer can also be used by Emacs. These are available from http://www.microsoft.com, or on the installation CDROMs. IE5 also has fonts for Thai, Vietnamese and other languages, although it is not known how well these work with Emacs. Fonts for many other languages are available on the WWW; a good starting point is http://babel.uoregon.edu/yamada/guides.html. X Windows fonts There is a collection of international fonts for use with X Windows, and a set can be found at ftp.gnu.org. They are distributed in the bdf font file format, a format that can be handled by Emacs starting with version 20.3.5.1. For details on how to use these fonts with Emacs, see the section below on using bdf fonts with Emacs. How do I use third party programs for displaying multibyte characters with Emacs?Define a fontset ( see above ) listing any font of an appropriate size which works with the third party program for the appropriate character set(s). Change the character set to the character set you want displayed so Emacs knows how to display it. For example: (create-fontset-from-fontset-spec "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-fontset-asian, korean-ksc5601:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-ksc5601-*, chinese-gb2312:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-gb2312-*, chinese-big5-1:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-big5-*, chinese-big5-2:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-big5-*, japanese-jisx0208:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-jisx0208-sjis, katakana-jisx0201:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-jisx0201-sjis, latin-jisx0201:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-jisx0201-sjis, japanese-jisx0208-1978:-*-Courier New-normal-r-*-*-13-*-*-*-c-*-jisx0208-sjis") If this doesn't work, you may need to set `w32-enable-unicode-output' to nil. How do I use a font with a name in my language?This is most applicable to East Asian users. Others can probably get their fonts working (with a strange looking name), but it is nice to have the names of fonts displayed correctly. You need to use the function `set-w32-system-coding-system' before the font is specified. If you are setting the font from your .emacs, you will need to make sure the coding-system of your .emacs supports the character set for the font name. An example (for Traditional Chinese) follows: ;; Top line of .emacs: -*- coding: chinese-big-5; -*- (set-w32-system-coding-system 'chinese-big-5) For Japanese, you would use japanese-shift-jis; for Simplified Chinese, chinese-iso-8bit; for Korean, korean-iso-8bit. How can I use bdf fonts with Emacs?To use bdf fonts with Emacs, you need to tell Emacs where the fonts are located, create fontsets for them, and then use them. We'll use the 16 dot international fonts from ftp.gnu.org/intlfonts as an example put together by Jason Rumney <jasonr@gnu.org> Download the 16dots.tar.gz file and unpack it; I'll assume that they are in "c:\intlfonts". Then set w32-bdf-filename-alist to the list of fonts returned by using w32-find-bdf-fonts to enumerate all of the font files. It is a good idea to set the variable bdf-directory-list at the same time so ps-print knows where to find the fonts:
Then create fontsets for the BDF fonts: (create-fontset-from-fontset-spec "-*-fixed-medium-r-normal-*-16-*-*-*-c-*-fontset-bdf, japanese-jisx0208:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1983-*, katakana-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*, latin-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*, japanese-jisx0208-1978:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1978-*, thai-tis620:-misc-fixed-medium-r-normal--16-160-72-72-m-80-tis620.2529-1, lao:-misc-fixed-medium-r-normal--16-160-72-72-m-80-MuleLao-1, tibetan-1-column:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-80-MuleTibetan-1, ethiopic:-Admas-Ethiomx16f-Medium-R-Normal--16-150-100-100-M-160-Ethiopic-Unicode, tibetan:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-160-MuleTibetan-0") Many of the international bdf fonts from gnu.org are type 0, and therefore need to be added to font-encoding-alist:
You can now use the Emacs font menu (not the popup dialog; see below ) to select the "bdf: 16-dot medium" fontset, or you can select it by setting the default font: (set-default-font "fontset-bdf") Try loading the file etc/HELLO, and you should be able to see the various international fonts displayed (except for Hindi, which is not included in the 16-dot font distribution). How can I have Emacs use a font menu similar to the one it uses on Unix (with fonts and fontsets listed)?Place the following in your startup file:
(setq w32-use-w32-font-dialog nil) The font I want to use is not in the font menu, how can I put it there?If you have set w32-use-w32-font-dialog to nil, you can add fonts to the font menu by changing `w32-fixed-font-alist'. For example:
How can I control CR/LF translation (e.g., to access UNIX files via NFS)?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. By file extensionThe 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:
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. By file systemA 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. AutomaticA 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. How do I print from Emacs?20.4Please read Andrew's note on how to print from Emacs in 20.4. What you need to do depends upon how you connect your printer to your machine. Tim Sherrill <sherritp@sagian.com> has a very informative page on 2-up (n-up) printing from Emacs. Holger Mueller <hmueller@bigfoot.com> has taken over maintaining print-NT.el [V 1.15, 6/29/98] (previously maintained by Brian Gorka <gorkab@cyberpass.net>). Theodore Jump <tjump@tertius.com> has also written w32-print.el, a relatively complete package for printing from Emacs on Windows systems (Postscript, plain-text, 2- and 4-up, 19.34.X and 20.X, UNC and local device paths, etc.). [V1.11, 12/7/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. Anders Lindgren <andersl@csd.uu.se> has written a lpr.bat batch file that can be subsituted transparently for lpr on NT (Windows 95 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:
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. Printing via GhostscriptAlec Clews reports success at using Ghostscript to perform his printing - using gsview version 3.4, and Ghostscript version 6.01 The configuration is straightforward, here's his settings, (which you should modify to suit).
(setq ps-lpr-command "c:\\Ghostgum\\gsview\\gsprint.exe")
;; THis line causes ghostscript to query which printer to
;; use - which you may not need if, for example, you only
;; have one printer.
(setq ps-lpr-switches '("-query"))
(setq ps-printer-name t)
The commandline options are documented in the gsprint.htm file which comes with Ghostscript. How do I print all these languages that Emacs is now displaying?Emacs 20.4 has the ability to print non Western languages in two ways. Both use the "Postscript Print" functions, so if you do not have a Postscript printer, you will need to configure Emacs to print through Ghostscript.
The variable `ps-multibyte-buffer' controls how non-latin characters are printed. If you are using built in support in the printer or Ghostscript, then setting this variable appropriately is all that needs to be done. To use BDF fonts, you will need to tell ps-print where to find them. This is done by setting `bdf-directory-list'. For example:
By default, Emacs uses 24 dot BDF fonts for normal text, 16 dot for bold and italic and 40 dot for some (uncommon) Chinese and Japanese character sets. Quoting issuesThe quoting rules for Windows shells and Cygnus shells have some subtle differences. When Emacs spawns subprocesses, it tries to determine whether the process is a Cygnus program and changes its quoting mechanism appropriately. [Discussion] Programs reading input hangPrograms that explicitly use a handle to the console ("CON" or "CON:") instead of stdin and stdout cannot be used as subprocesses to Emacs, and they will also not work in shell-mode (the default ftp clients on Windows 95 and NT are examples of such programs - this ftp program is fine for use with ange-ftp, but not for M-x ftp). There is no convenient way for either Emacs or any shell used in shell-mode to redirect the input and output of such processes from the console to input and output pipes. The only workaround is to use a different implementation of the program that does not use the console directly (see the discussion on ange-ftp for a replacement for the default ftp clients). Buffering in shellsYou may notice that some programs, when run in a shell in shell-mode, have their output buffered (e.g., people have found this happening to them with sql-mode). When the program has a lot of output, it overflows the buffering and gets printed to the shell buffer; however, if the program only outputs a small amount of text, it will remain buffered and won't appear in the shell buffer. 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. Some programs handle this by having an explicit flag to control their buffering behaviour, typically "-i". Other programs manage to detect that they are running under Emacs, by using getenve("emacs") internally. Perl script buffering.A handy solution for Perl scripts is to use:
# Turn all buffering off.
select((select(STDOUT), $| = 1)[0]);
select((select(STDERR), $| = 1)[0]);
select((select(STDIN), $| = 1)[0]);
DOS subprocessesYou can run DOS subprocesses under Emacs, with either the native command shell, or one of the alternatives, such as bash, tcsh, or 4NT, instead of command.com/cmd.exe; see the section below on other tools for pointers to other sites. 16-bit subprocesses accessing the A: drive.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>. Killing subprocesses on Windows 95/98Emacs cannot guarantee that a subprocess gets killed on Windows 95/98, and is a difficult limitation to work around. For the forseeable future, you should always let subprocesses run to completion, including explicitly exiting interactive shells. If you find that shutting down Windows 95/98 complains that there is a running cmdproxy even though you've exited all programs and it doesn't show up in the Task Manager until you shutdown, this could be a bad interaction with Norton VirusChecker. Francis Wright has written a nice little package which tries to automatically tell shell buffer(s) to "exit" if you try to kill them, it is called msdos-shell-fix.el, and can be found at : http://centaur.maths.qmw.ac.uk/Emacs/. Sending eof to subprocesses in Emacs (e.g., C-c C-d in shell buffers)When an eof is sent to a subprocess running in an interactive shell via process-send-eof, the shell terminates unexpectedly as if its input were closed. See this description for more info and an example. How do I use a shell in Emacs?You can use an interactive subshell in Emacs by typing "M-x shell". Emacs uses the SHELL configuration variable to determine which program to use as the shell. If you installed Emacs using the addpm.exe program, then addpm.exe will associate the value %COMSPEC% with SHELL in the registry. Emacs will then use the value of the COMSPEC environment variable when it starts up, unless the SHELL environment variable is explicitly defined (as when using the emacs.bat batch file). 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. Any replacement shell should follow Unix convention for the -c option, or else be invoked via cmdproxy.exe if it follows the DOS convention. 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") bashYou 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: (defun my-shell-setup () "For Cygwin bash under Emacs 20" (setq comint-scroll-show-maximum-output 'this) (setq comint-completion-addsuffix t) ;; (setq comint-process-echoes t) ;; reported that this is no longer needed (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) 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. If you find that you are having trouble with Emacs tracking drive changes with bash, see Mike Fabian's note <mike.fabian@it-mannesmann.de> The package cygwin32-mount.el teaches Emacs about cygwin32 mount points. 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: (setenv "PID" nil) kshFor 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 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. MKS kshTo use MKS ksh, place the following in your startup file: (setq w32-quote-process-args t) ; Emacs 20 (setq shell-command-switch "-c") tcshYou can find tcsh at ftp://ftp.blarg.net/users/amol/tcsh. To use tcsh, place the following in your startup file: (setenv "SHELL" "tcsh.exe") (setq w32-quote-process-args t) ; Emacs 20 (setq shell-command-switch "-cf") For more configuration information with tcsh, take a look at Chris McMahan's <cmcmahan@surefirev.com> setup. zshYou can find zsh at ftp://ftp.blarg.net/users/amol/zsh/ How do I prevent shell commands from being echoed |