1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
3 @c See file emacs.texi for copying conditions.
4 @node MS-DOS, Manifesto, Antinews, Top
5 @appendix Emacs and MS-DOS
7 @cindex MS-DOS peculiarities
9 This section briefly describes the peculiarities of using Emacs under
10 the MS-DOS ``operating system'' (also known as ``MS-DOG''). If you
11 build Emacs for MS-DOS, the binary will also run on Windows 3.X, Windows
12 NT, Windows 9X, or OS/2 as a DOS application; the information in this
13 chapter applies for all of those systems, if you use an Emacs that was
16 Note that it is possible to build Emacs specifically for Windows NT or
17 Windows 9X. If you do that, most of this chapter does not apply;
18 instead, you get behavior much closer to what is documented in the rest
19 of the manual, including support for long file names, multiple frames,
20 scroll bars, mouse menus, and subprocesses. However, the section on
21 text files and binary files does still apply. There are also two
22 sections at the end of this chapter which apply specifically for Windows
26 * Input: MS-DOS Input. Keyboard and mouse usage on MS-DOS.
27 * Display: MS-DOS Display. Fonts, frames and display size on MS-DOS.
28 * Files: MS-DOS File Names. File name conventions on MS-DOS.
29 * Text and Binary:: Text files on MS-DOS use CRLF to separate lines.
30 * Printing: MS-DOS Printing. How to specify the printer on MS-DOS.
31 * I18N: MS-DOS and MULE. Support for internationalization on MS-DOS.
32 * Processes: MS-DOS Processes. Running subprocesses on MS-DOS.
33 * Windows Processes:: Running subprocesses on Windows.
34 * Windows System Menu:: Controlling what the ALT key does.
38 @section Keyboard and Mouse on MS-DOS
40 @cindex Meta (under MS-DOS)
41 @cindex Hyper (under MS-DOS)
42 @cindex Super (under MS-DOS)
45 The PC keyboard maps use the left @key{ALT} key as the @key{META} key.
46 You have two choices for emulating the @key{SUPER} and @key{HYPER} keys:
47 choose either the right @key{CTRL} key or the right @key{ALT} key by
48 setting the variables @code{dos-hyper-key} and @code{dos-super-key} to 1
49 or 2 respectively. If neither @code{dos-super-key} nor
50 @code{dos-hyper-key} is 1, then by default the right @key{ALT} key is
51 also mapped to the @key{META} key. However, if the MS-DOS international
52 keyboard support program @file{KEYB.COM} is installed, Emacs will
53 @emph{not} map the right @key{ALT} to @key{META}, since it is used for
54 accessing characters like @kbd{~} and @kbd{@@} on non-US keyboard
55 layouts; in this case, you may only use the left @key{ALT} as @key{META}
58 @kindex C-j @r{(MS-DOS)}
59 @vindex dos-keypad-mode
60 The variable @code{dos-keypad-mode} is a flag variable that controls
61 what key codes are returned by keys in the numeric keypad. You can also
62 define the keypad @key{ENTER} key to act like @kbd{C-j}, by putting the
63 following line into your @file{_emacs} file:
66 ;; Make the Enter key from the Numeric keypad act as C-j.
67 (define-key function-key-map [kp-enter] [?\C-j])
70 @kindex DEL @r{(MS-DOS)}
71 @kindex BS @r{(MS-DOS)}
72 The key that is called @key{DEL} in Emacs (because that's how it is
73 designated on most workstations) is known as @key{BS} (backspace) on a
74 PC. That is why the PC-specific terminal initialization remaps the
75 @key{BS} key to act as @key{DEL}; the @key{DEL} key is remapped to act
76 as @kbd{C-d} for the same reasons.
78 @kindex C-g @r{(MS-DOS)}
79 @kindex C-BREAK @r{(MS-DOS)}
80 @cindex quitting on MS-DOS
81 Emacs built for MS-DOS recognizes @kbd{C-@key{BREAK}} as a quit
82 character, just like @kbd{C-g}. This is because Emacs cannot detect
83 that you have typed @kbd{C-g} until it is ready for more input. As a
84 consequence, you cannot use @kbd{C-g} to stop a running command
85 (@pxref{Quitting}). By contrast, @kbd{C-@key{BREAK}} @emph{is} detected
86 as soon as you type it (as @kbd{C-g} is on other systems), so it can be
87 used to stop a running command and for emergency escape
88 (@pxref{Emergency Escape}).
90 @cindex mouse support under MS-DOS
91 Emacs on MS-DOS supports a mouse (on the default terminal only).
92 The mouse commands work as documented, including those that use menus
93 and the menu bar (@pxref{Menu Bar}). Scroll bars don't work in
94 MS-DOS Emacs. PC mice usually have only two buttons; these act as
95 @kbd{Mouse-1} and @kbd{Mouse-2}, but if you press both of them
96 together, that has the effect of @kbd{Mouse-3}.
98 @cindex Windows clipboard support
99 Emacs built for MS-DOS supports clipboard operations when it runs on
100 Windows. Commands that put text on the kill ring, or yank text from the
101 ring, check the Windows clipboard first, just as Emacs does on X Windows
102 (@pxref{Mouse Commands}). Only the primary selection and the cut buffer
103 are supported by MS-DOS Emacs on Windows; the secondary selection always
106 Due to the way clipboard access is implemented by Windows, the
107 length of text you can put into the clipboard is limited by the amount
108 of free DOS memory that is available to Emacs. Usually, up to 620KB of
109 text can be put into the clipboard, but this limit depends on the system
110 configuration and is lower if you run Emacs as a subprocess of
111 another program. If the killed text does not fit, Emacs prints a
112 message saying so, and does not put the text into the clipboard.
114 Null characters also cannot be put into the Windows clipboard. If the
115 killed text includes null characters, Emacs does not put such text into
116 the clipboard, and prints in the echo area a message to that effect.
118 @vindex dos-display-scancodes
119 The variable @code{dos-display-scancodes}, when non-@code{nil},
120 directs Emacs to display the ASCII value and the keyboard scan code of
121 each keystroke; this feature serves as a complement to the
122 @code{view-lossage} command, for debugging.
125 @section Display on MS-DOS
126 @cindex faces under MS-DOS
127 @cindex fonts, emulating under MS-DOS
129 Display on MS-DOS cannot use font variants, like bold or italic,
131 multiple faces, each of which can specify a foreground and a background
132 color. Therefore, you can get the full functionality of Emacs packages
133 that use fonts (such as @code{font-lock}, Enriched Text mode, and
134 others) by defining the relevant faces to use different colors. Use the
135 @code{list-colors-display} command (@pxref{Frame Parameters}) and the
136 @code{list-faces-display} command (@pxref{Faces}) to see what colors and
137 faces are available and what they look like.
139 The section @ref{MS-DOS and MULE}, later in this chapter, describes
140 how Emacs displays glyphs and characters which aren't supported by the
141 native font built into the DOS display.
143 @cindex cursor shape on MS-DOS
144 When Emacs starts, it changes the cursor shape to a solid box. This
145 is for compatibility with the Unix version, where the box cursor is the
146 default. This default shape can be changed to a bar by specifying the
147 @code{cursor-type} parameter in the variable @code{default-frame-alist}
148 (@pxref{Creating Frames}). The MS-DOS terminal doesn't support a
149 vertical-bar cursor, so the bar cursor is horizontal, and the its
150 @code{@var{width}} parameter, if specified by the frame parameters,
151 actually determines its height. As an extension, the bar cursor
152 specification can include the starting scan line of the cursor as well
153 as its width, like this:
156 '(cursor-type bar @var{width} . @var{start})
160 In addition, if the @var{width} parameter is negative, the cursor bar
161 begins at the top of the character cell.
163 @cindex frames on MS-DOS
164 Multiple frames (@pxref{Frames}) are supported on MS-DOS, but they all
165 overlap, so you only see a single frame at any given moment. That
166 single visible frame occupies the entire screen. When you run Emacs
167 from MS-Windows DOS box, you can make the visible frame smaller than
168 the full screen, but Emacs still cannot display more than a single
171 @cindex frame size under MS-DOS
174 The @code{mode4350} command switches the display to 43 or 50
175 lines, depending on your hardware; the @code{mode25} command switches
176 to the default 80x25 screen size.
178 By default, Emacs only knows how to set screen sizes of 80 columns by
179 25, 28, 35, 40, 43 or 50 rows. However, if your video adapter has
180 special video modes that will switch the display to other sizes, you can
181 have Emacs support those too. When you ask Emacs to switch the frame to
182 @var{n} rows by @var{m} columns dimensions, it checks if there is a
183 variable called @code{screen-dimensions-@var{n}x@var{m}}, and if so,
184 uses its value (which must be an integer) as the video mode to switch
185 to. (Emacs switches to that video mode by calling the BIOS @code{Set
186 Video Mode} function with the value of
187 @code{screen-dimensions-@var{n}x@var{m}} in the @code{AL} register.)
188 For example, suppose your adapter will switch to 66x80 dimensions when
189 put into video mode 85. Then you can make Emacs support this screen
190 size by putting the following into your @file{_emacs} file:
193 (setq screen-dimensions-66x80 85)
196 Since Emacs on MS-DOS can only set the frame size to specific
197 supported dimensions, it cannot honor every possible frame resizing
198 request. When an unsupported size is requested, Emacs chooses the next
199 larger supported size beyond the specified size. For example, if you
200 ask for 36x80 frame, you will get 40x80 instead.
202 The variables @code{screen-dimensions-@var{n}x@var{m}} are used only
203 when they exactly match the specified size; the search for the next
204 larger supported size ignores them. In the above example, even if your
205 VGA supports 38x80 dimensions and you define a variable
206 @code{screen-dimensions-38x80} with a suitable value, you will still get
207 40x80 screen when you ask for a 36x80 frame. If you want to get the
208 38x80 size in this case, you can do it by setting the variable named
209 @code{screen-dimensions-36x80} with the same video mode value as
210 @code{screen-dimensions-38x80}.
212 Changing frame dimensions on MS-DOS has the effect of changing all the
213 other frames to the new dimensions.
215 @node MS-DOS File Names
216 @section File Names on MS-DOS
217 @cindex file names under MS-DOS
218 @cindex init file, default name under MS-DOS
220 MS-DOS normally uses a backslash, @samp{\}, to separate name units
221 within a file name, instead of the slash used on other systems. Emacs
222 on MS-DOS permits use of either slash or backslash, and also knows
223 about drive letters in file names.
225 On MS-DOS, file names are case-insensitive and limited to eight
226 characters, plus optionally a period and three more characters. Emacs
227 knows enough about these limitations to handle file names that were
228 meant for other operating systems. For instance, leading dots @samp{.}
229 in file names are invalid in MS-DOS, so Emacs transparently converts
230 them to underscores @samp{_}; thus your default init file (@pxref{Init
231 File}) is called @file{_emacs} on MS-DOS. Excess characters before or
232 after the period are generally ignored by MS-DOS itself; thus, if you
233 visit the file @file{LongFileName.EvenLongerExtension}, you will
234 silently get @file{longfile.eve}, but Emacs will still display the long
235 file name on the mode line. Other than that, it's up to you to specify
236 file names which are valid under MS-DOS; the transparent conversion as
237 described above only works on file names built into Emacs.
239 @cindex backup file names on MS-DOS
240 The above restrictions on the file names on MS-DOS make it almost
241 impossible to construct the name of a backup file (@pxref{Backup
242 Names}) without losing some of the original file name characters. For
243 example, the name of a backup file for @file{docs.txt} is
244 @file{docs.tx~} even if single backup is used.
246 @cindex file names under Windows 95/NT
247 @cindex long file names in DOS box under Windows 95/NT
248 If you run Emacs as a DOS application under Windows 9X, you can
249 turn on support for long file names. If you do that, Emacs doesn't
250 truncate file names or convert them to lower case; instead, it uses the
251 file names that you specify, verbatim. To enable long file name
252 support, set the environment variable @code{LFN} to @samp{y} before
253 starting Emacs. Unfortunately, Windows NT doesn't allow DOS programs to
254 access long file names, so Emacs built for MS-DOS will only see their
257 @cindex @code{HOME} directory under MS-DOS
258 MS-DOS has no notion of home directory, so Emacs on MS-DOS pretends
259 that the directory where it is installed is the value of @code{HOME}
260 environment variable. That is, if your Emacs binary,
261 @file{emacs.exe}, is in the directory @file{c:/utils/emacs/bin}, then
262 Emacs acts as if @code{HOME} were set to @samp{c:/utils/emacs}. In
263 particular, that is where Emacs looks for the init file @file{_emacs}.
264 With this in mind, you can use @samp{~} in file names as an alias for
265 the home directory, as you would in Unix. You can also set @code{HOME}
266 variable in the environment before starting Emacs; its value will then
267 override the above default behavior.
269 Emacs on MS-DOS handles the directory name @file{/dev} specially,
270 because of a feature in the emulator libraries of DJGPP that pretends
271 I/O devices have names in that directory. We recommend that you avoid
272 using an actual directory named @file{/dev} on any disk.
274 @node Text and Binary
275 @section Text Files and Binary Files
276 @cindex text and binary files on MS-DOS/MS-Windows
278 GNU Emacs uses newline characters to separate text lines. This is the
279 convention used on Unix, on which GNU Emacs was developed, and on GNU
280 systems since they are modeled on Unix.
282 @cindex end-of-line conversion on MS-DOS/MS-Windows
283 MS-DOS and MS-Windows normally use carriage-return linefeed, a
284 two-character sequence, to separate text lines. (Linefeed is the same
285 character as newline.) Therefore, convenient editing of typical files
286 with Emacs requires conversion of these end-of-line (EOL) sequences.
287 And that is what Emacs normally does: it converts carriage-return
288 linefeed into newline when reading files, and converts newline into
289 carriage-return linefeed when writing files. The same mechanism that
290 handles conversion of international character codes does this conversion
291 also (@pxref{Coding Systems}).
293 @cindex cursor location, under MS-DOS
294 @cindex point location, under MS-DOS
295 One consequence of this special format-conversion of most files is
296 that character positions as reported by Emacs (@pxref{Position Info}) do
297 not agree with the file size information known to the operating system.
299 @vindex file-name-buffer-file-type-alist
300 Some kinds of files should not be converted, because their contents
301 are not really text. Therefore, Emacs on MS-DOS distinguishes certain
302 files as @dfn{binary files}, and reads and writes them verbatim. (This
303 distinction is not part of MS-DOS; it is made by Emacs only.) These
304 include executable programs, compressed archives, etc. Emacs uses the
305 file name to decide whether to treat a file as binary: the variable
306 @code{file-name-buffer-file-type-alist} defines the file-name patterns
307 that indicate binary files. Note that if a file name matches one of the
308 patterns for binary files in @code{file-name-buffer-file-type-alist},
309 Emacs uses the @code{no-conversion} coding system (@pxref{Coding
310 Systems}) which turns off @emph{all} coding-system conversions, not only
313 In addition, if Emacs recognizes from a file's contents that it uses
314 newline rather than carriage-return linefeed as its line separator, it
315 does not perform conversion when reading or writing that file. Thus,
316 you can read and edit files from Unix or GNU systems on MS-DOS with no
317 special effort, and they will be left with their Unix-style EOLs.
319 @findex find-file-text
320 @findex find-file-binary
321 You can visit a file and specify whether to treat a file as text or
322 binary using the commands @code{find-file-text} and
323 @code{find-file-binary}. End-of-line conversion is part of the general
324 coding system conversion mechanism, so another way to control whether to
325 treat a file as text or binary is with the commands for specifying a
326 coding system (@pxref{Specify Coding}). For example,
327 @kbd{C-x @key{RET} c undecided-unix @key{RET} C-x C-f foobar.txt}
328 visits the file @file{foobar.txt} without converting the EOLs.
330 The mode line indicates whether end-of-line translation was used for
331 the current buffer. Normally a colon appears after the coding system
332 letter near the beginning of the mode line. If MS-DOS end-of-line
333 translation is in use for the buffer, this character changes to a
336 @cindex untranslated file system
337 @findex add-untranslated-filesystem
338 When you use NFS or Samba to access file systems that reside on
339 computers using Unix or GNU systems, Emacs should not perform
340 end-of-line translation on any files in these file systems--not even
341 when you create a new file. To request this, designate these file
342 systems as @dfn{untranslated} file systems by calling the function
343 @code{add-untranslated-filesystem}. It takes one argument: the file
344 system name, including a drive letter and optionally a directory. For
348 (add-untranslated-filesystem "Z:")
352 designates drive Z as an untranslated file system, and
355 (add-untranslated-filesystem "Z:\\foo")
359 designates directory @file{\foo} on drive Z as an untranslated file
362 Most often you would use @code{add-untranslated-filesystem} in your
363 @file{_emacs} file, or in @file{site-start.el} so that all the users at
364 your site get the benefit of it.
366 @findex remove-untranslated-filesystem
367 To countermand the effect of @code{add-untranslated-filesystem}, use
368 the function @code{remove-untranslated-filesystem}. This function takes
369 one argument, which should be a string just like the one that was used
370 previously with @code{add-untranslated-filesystem}.
372 @node MS-DOS Printing
373 @section Printing and MS-DOS
375 Printing commands, such as @code{lpr-buffer} (@pxref{Hardcopy}) and
376 @code{ps-print-buffer} (@pxref{PostScript}) can work in MS-DOS and
377 MS-Windows by sending the output to one of the printer ports, if a
378 Unix-style @code{lpr} program is unavailable. This behaviour is
379 controlled by the same variables that control printing with @code{lpr}
380 on Unix (@pxref{Hardcopy}, @pxref{PostScript Variables}), but the
381 defaults for these variables on MS-DOS and MS-Windows are not the same
382 as the defaults on Unix.
384 @vindex printer-name @r{(MS-DOS)}
385 If you want to use your local printer, printing on it in the usual DOS
386 manner, then set the Lisp variable @code{lpr-command} to @code{""} (its
387 default value) and @code{printer-name} to the name of the printer
388 port---for example, @code{"PRN"}, the usual local printer port (that's
389 the default), or @code{"LPT2"}, or @code{"COM1"} for a serial printer.
390 You can also set @code{printer-name} to a file name, in which case
391 ``printed'' output is actually appended to that file. If you set
392 @code{printer-name} to @code{"NUL"}, printed output is silently
393 discarded (sent to the system null device).
395 On MS-Windows, when the Windows network software is installed, you can
396 also use a printer shared by another machine by setting
397 @code{printer-name} to the UNC share name for that printer--for example,
398 @code{"//joes_pc/hp4si"}. (It doesn't matter whether you use forward
399 slashes or backslashes here.) To find out the names of shared printers,
400 run the command @samp{net view} at a DOS command prompt to obtain a list
401 of servers, and @samp{net view @var{server-name}} to see the names of printers
402 (and directories) shared by that server.
404 If you set @code{printer-name} to a file name, it's best to use an
405 absolute file name. Emacs changes the working directory according to
406 the default directory of the current buffer, so if the file name in
407 @code{printer-name} is relative, you will end up with several such
408 files, each one in the directory of the buffer from which the printing
411 @findex print-buffer @r{(MS-DOS)}
412 @findex print-region @r{(MS-DOS)}
413 @vindex lpr-headers-switches @r{(MS-DOS)}
414 The commands @code{print-buffer} and @code{print-region} call the
415 @code{pr} program, or use special switches to the @code{lpr} program, to
416 produce headers on each printed page. MS-DOS and MS-Windows don't
417 normally have these programs, so by default, the variable
418 @code{lpr-headers-switches} is set so that the requests to print page
419 headers are silently ignored. Thus, @code{print-buffer} and
420 @code{print-region} produce the same output as @code{lpr-buffer} and
421 @code{lpr-region}, respectively. If you do have a suitable @code{pr}
422 program (for example, from GNU Textutils), set
423 @code{lpr-headers-switches} to @code{nil}; Emacs will then call
424 @code{pr} to produce the page headers, and print the resulting output as
425 specified by @code{printer-name}.
427 @vindex print-region-function @r{(MS-DOS)}
428 @cindex lpr usage under MS-DOS
429 @vindex lpr-command @r{(MS-DOS)}
430 @vindex lpr-switches @r{(MS-DOS)}
431 Finally, if you do have an @code{lpr} work-alike, you can set the
432 variable @code{lpr-command} to @code{"lpr"}. Then Emacs will use
433 @code{lpr} for printing, as on other systems. (If the name of the
434 program isn't @code{lpr}, set @code{lpr-command} to specify where to
435 find it.) The variable @code{lpr-switches} has its standard meaning
436 when @code{lpr-command} is not @code{""}. If the variable
437 @code{printer-name} has a string value, it is used as the value for the
438 @code{-P} option to @code{lpr}, as on Unix.
440 @findex ps-print-buffer @r{(MS-DOS)}
441 @findex ps-spool-buffer @r{(MS-DOS)}
442 @vindex ps-printer-name @r{(MS-DOS)}
443 @vindex ps-lpr-command @r{(MS-DOS)}
444 @vindex ps-lpr-switches @r{(MS-DOS)}
445 A parallel set of variables, @code{ps-lpr-command},
446 @code{ps-lpr-switches}, and @code{ps-printer-name} (@pxref{PostScript
447 Variables}), defines how PostScript files should be printed. These
448 variables are used in the same way as the corresponding variables
449 described above for non-PostScript printing. Thus, the value of
450 @code{ps-printer-name} is used as the name of the device (or file) to
451 which PostScript output is sent, just as @code{printer-name} is used for
452 non-PostScript printing. (There are two distinct sets of variables in
453 case you have two printers attached to two different ports, and only one
454 of them is a PostScript printer.)
456 The default value of the variable @code{ps-lpr-command} is @code{""},
457 which causes PostScript output to be sent to the printer port specified
458 by @code{ps-printer-name}, but @code{ps-lpr-command} can also be set to
459 the name of a program which will accept PostScript files. Thus, if you
460 have a non-PostScript printer, you can set this variable to the name of
461 a PostScript interpreter program (such as Ghostscript). Any switches
462 that need to be passed to the interpreter program are specified using
463 @code{ps-lpr-switches}. (If the value of @code{ps-printer-name} is a
464 string, it will be added to the list of switches as the value for the
465 @code{-P} option. This is probably only useful if you are using
466 @code{lpr}, so when using an interpreter typically you would set
467 @code{ps-printer-name} to something other than a string so it is
470 For example, to use Ghostscript for printing on an Epson printer
471 connected to the @samp{LPT2} port, put this in your @file{_emacs} file:
474 (setq ps-printer-name t) ; Ghostscript doesn't understand -P
475 (setq ps-lpr-command "c:/gs/gs386")
476 (setq ps-lpr-switches '("-q" "-dNOPAUSE"
484 (This assumes that Ghostscript is installed in the @file{"c:/gs"}
488 @vindex dos-ps-printer
489 For backwards compatibility, the value of @code{dos-printer}
490 (@code{dos-ps-printer}), if it has a value, overrides the value of
491 @code{printer-name} (@code{ps-printer-name}), on MS-DOS and MS-Windows
495 @node MS-DOS and MULE
496 @section International Support on MS-DOS
497 @cindex international support @r{(MS-DOS)}
499 Emacs on MS-DOS supports the same international character sets as it
500 does on Unix and other platforms (@pxref{International}), including
501 coding systems for converting between the different character sets.
502 However, due to incompatibilities between MS-DOS/MS-Windows and Unix,
503 there are several DOS-specific aspects of this support that users should
504 be aware of. This section describes these aspects.
507 @item M-x dos-codepage-setup
508 Set up Emacs display and coding systems as appropriate for the current
511 @item M-x codepage-setup
512 Create a coding system for a certain DOS codepage.
515 @cindex codepage, MS-DOS
516 @cindex DOS codepages
517 MS-DOS is designed to support one character set of 256 characters at
518 any given time, but gives you a variety of character sets to choose
519 from. The alternative character sets are known as @dfn{DOS codepages}.
520 Each codepage includes all 128 ASCII characters, but the other 128
521 characters (codes 128 through 255) vary from one codepage to another.
522 Each DOS codepage is identified by a 3-digit number, such as 850, 862,
525 In contrast to X Windows, which lets you use several fonts at the same
526 time, MS-DOS doesn't allow use of several codepages in a single session.
527 Instead, MS-DOS loads a single codepage at system startup, and you must
528 reboot MS-DOS to change it@footnote{Normally, one particular codepage is
529 burnt into the display memory, while other codepages can be installed by
530 modifying system configuration files, such as @file{CONFIG.SYS}, and
531 rebooting.}. Much the same limitation applies when you run DOS
532 executables on other systems such as MS-Windows.
534 @cindex unibyte operation @r{(MS-DOS)}
535 If you invoke Emacs on MS-DOS with the @samp{--unibyte} option
536 (@pxref{Initial Options}), Emacs does not perform any conversion of
537 non-ASCII characters. Instead, it reads and writes any non-ASCII
538 characters verbatim, and sends their 8-bit codes to the display
539 verbatim. Thus, unibyte Emacs on MS-DOS supports the current codepage,
540 whatever it may be, but cannot even represent any other characters.
543 For multibyte operation on MS-DOS, Emacs needs to know which
544 characters the chosen DOS codepage can display. So it queries the
545 system shortly after startup to get the chosen codepage number, and
546 stores the number in the variable @code{dos-codepage}. Some systems
547 return the default value 437 for the current codepage, even though the
548 actual codepage is different. (This typically happens when you use the
549 codepage built into the display hardware.) You can specify a different
550 codepage for Emacs to use by setting the variable @code{dos-codepage} in
553 @cindex language environment, automatic selection on @r{MS-DOS}
554 Multibyte Emacs supports only certain DOS codepages: those which can
555 display Far-Eastern scripts, like the Japanese codepage 932, and those
556 that encode a single ISO 8859 character set.
558 The Far-Eastern codepages can directly display one of the MULE
559 character sets for these countries, so Emacs simply sets up to use the
560 appropriate terminal coding system that is supported by the codepage.
561 The special features described in the rest of this section mostly
562 pertain to codepages that encode ISO 8859 character sets.
564 For the codepages which correspond to one of the ISO character sets,
565 Emacs knows the character set name based on the codepage number. Emacs
566 automatically creates a coding system to support reading and writing
567 files that use the current codepage, and uses this coding system by
568 default. The name of this coding system is @code{cp@var{nnn}}, where
569 @var{nnn} is the codepage number.@footnote{The standard Emacs coding
570 systems for ISO 8859 are not quite right for the purpose, because
571 typically the DOS codepage does not match the standard ISO character
572 codes. For example, the letter @samp{@,{c}} (@samp{c} with cedilla) has
573 code 231 in the standard Latin-1 character set, but the corresponding
574 DOS codepage 850 uses code 135 for this glyph.}
576 @cindex mode line @r{(MS-DOS)}
577 All the @code{cp@var{nnn}} coding systems use the letter @samp{D} (for
578 ``DOS'') as their mode-line mnemonic. Since both the terminal coding
579 system and the default coding system for file I/O are set to the proper
580 @code{cp@var{nnn}} coding system at startup, it is normal for the mode
581 line on MS-DOS to begin with @samp{-DD\-}. @xref{Mode Line}.
582 Far-Eastern DOS terminals do not use the @code{cp@var{nnn}} coding
583 systems, and thus their initial mode line looks like on Unix.
585 Since the codepage number also indicates which script you are using,
586 Emacs automatically runs @code{set-language-environment} to select the
587 language environment for that script (@pxref{Language Environments}).
589 If a buffer contains a character belonging to some other ISO 8859
590 character set, not the one that the chosen DOS codepage supports, Emacs
591 displays it using a sequence of ASCII characters. For example, if the
592 current codepage doesn't have a glyph for the letter @samp{@`o} (small
593 @samp{o} with a grave accent), it is displayed as @samp{@{`o@}}, where
594 the braces serve as a visual indication that this is a single character.
595 (This may look awkward for some non-Latin characters, such as those from
596 Greek or Hebrew alphabets, but it is still readable by a person who
597 knows the language.) Even though the character may occupy several
598 columns on the screen, it is really still just a single character, and
599 all Emacs commands treat it as one.
601 @vindex dos-unsupported-character-glyph
602 Not all characters in DOS codepages correspond to ISO 8859
603 characters---some are used for other purposes, such as box-drawing
604 characters and other graphics. Emacs cannot represent these characters
605 internally, so when you read a file that uses these characters, they are
606 converted into a particular character code, specified by the variable
607 @code{dos-unsupported-character-glyph}.
609 Emacs supports many other characters sets aside from ISO 8859, but it
610 cannot display them on MS-DOS. So if one of these multibyte characters
611 appears in a buffer, Emacs on MS-DOS displays them as specified by the
612 @code{dos-unsupported-character-glyph} variable; by default, this glyph
613 is an empty triangle. Use the @kbd{C-u C-x =} command to display the
614 actual code and character set of such characters. @xref{Position Info}.
616 @findex codepage-setup
617 By default, Emacs defines a coding system to support the current
618 codepage. To define a coding system for some other codepage (e.g., to
619 visit a file written on a DOS machine in another country), use the
620 @kbd{M-x codepage-setup} command. It prompts for the 3-digit code of
621 the codepage, with completion, then creates the coding system for the
622 specified codepage. You can then use the new coding system to read and
623 write files, but you must specify it explicitly for the file command
624 when you want to use it (@pxref{Specify Coding}).
626 These coding systems are also useful for visiting a file encoded using
627 a DOS codepage, using Emacs running on some other operating system.
629 @node MS-DOS Processes
630 @section Subprocesses on MS-DOS
632 @cindex compilation under MS-DOS
633 @cindex inferior processes under MS-DOS
634 @findex compile @r{(MS-DOS)}
635 @findex grep @r{(MS-DOS)}
636 Because MS-DOS is a single-process ``operating system,''
637 asynchronous subprocesses are not available. In particular, Shell
638 mode and its variants do not work. Most Emacs features that use
639 asynchronous subprocesses also don't work on MS-DOS, including
640 spelling correction and GUD. When in doubt, try and see; commands that
641 don't work print an error message saying that asynchronous processes
644 Compilation under Emacs with @kbd{M-x compile}, searching files with
645 @kbd{M-x grep} and displaying differences between files with @kbd{M-x
646 diff} do work, by running the inferior processes synchronously. This
647 means you cannot do any more editing until the inferior process
650 By contrast, Emacs compiled as native Windows application
651 @strong{does} support asynchronous subprocesses. @xref{Windows
654 @cindex printing under MS-DOS
655 Printing commands, such as @code{lpr-buffer} (@pxref{Hardcopy}) and
656 @code{ps-print-buffer} (@pxref{PostScript}), work in MS-DOS by sending
657 the output to one of the printer ports. @xref{MS-DOS Printing}.
659 When you run a subprocess synchronously on MS-DOS, make sure the
660 program terminates and does not try to read keyboard input. If the
661 program does not terminate on its own, you will be unable to terminate
662 it, because MS-DOS provides no general way to terminate a process.
663 Pressing @kbd{C-c} or @kbd{C-@key{BREAK}} might sometimes help in these
666 Accessing files on other machines is not supported on MS-DOS. Other
667 network-oriented commands such as sending mail, Web browsing, remote
668 login, etc., don't work either, unless network access is built into
669 MS-DOS with some network redirector.
671 @cindex directory listing on MS-DOS
672 @vindex dired-listing-switches @r{(MS-DOS)}
673 Dired on MS-DOS uses the @code{ls-lisp} package where other
674 platforms use the system @code{ls} command. Therefore, Dired on
675 MS-DOS supports only some of the possible options you can mention in
676 the @code{dired-listing-switches} variable. The options that work are
677 @samp{-A}, @samp{-a}, @samp{-c}, @samp{-i}, @samp{-r}, @samp{-S},
678 @samp{-s}, @samp{-t}, and @samp{-u}.
680 @node Windows Processes
681 @section Subprocesses on Windows 95 and NT
683 Emacs compiled as a native Windows application (as opposed to the DOS
684 version) includes full support for asynchronous subprocesses.
685 In the Windows version, synchronous and asynchronous subprocesses work
687 Windows 95 and Windows NT as long as you run only 32-bit Windows
688 applications. However, when you run a DOS application in a subprocess,
689 you may encounter problems or be unable to run the application at all;
690 and if you run two DOS applications at the same time in two
691 subprocesses, you may have to reboot your system.
693 Since the standard command interpreter (and most command line utilities)
694 on Windows 95 are DOS applications, these problems are significant when
695 using that system. But there's nothing we can do about them; only
696 Microsoft can fix them.
698 If you run just one DOS application subprocess, the subprocess should
699 work as expected as long as it is ``well-behaved'' and does not perform
700 direct screen access or other unusual actions. If you have a CPU
701 monitor application, your machine will appear to be 100% busy even when
702 the DOS application is idle, but this is only an artifact of the way CPU
703 monitors measure processor load.
705 You must terminate the DOS application before you start any other DOS
706 application in a different subprocess. Emacs is unable to interrupt or
707 terminate a DOS subprocess. The only way you can terminate such a
708 subprocess is by giving it a command that tells its program to exit.
710 If you attempt to run two DOS applications at the same time in separate
711 subprocesses, the second one that is started will be suspended until the
712 first one finishes, even if either or both of them are asynchronous.
714 If you can go to the first subprocess, and tell it to exit, the second
715 subprocess should continue normally. However, if the second subprocess
716 is synchronous, Emacs itself will be hung until the first subprocess
717 finishes. If it will not finish without user input, then you have no
718 choice but to reboot if you are running on Windows 95. If you are
719 running on Windows NT, you can use a process viewer application to kill
720 the appropriate instance of ntvdm instead (this will terminate both DOS
723 If you have to reboot Windows 95 in this situation, do not use the
724 @code{Shutdown} command on the @code{Start} menu; that usually hangs the
725 system. Instead, type @kbd{CTL-ALT-@key{DEL}} and then choose
726 @code{Shutdown}. That usually works, although it may take a few minutes
729 @node Windows System Menu
730 @section Using the System Menu on Windows
732 Emacs compiled as a native Windows application normally turns off the
733 Windows feature that tapping the @key{ALT}
734 key invokes the Windows menu. The reason is that the @key{ALT} also
735 serves as @key{META} in Emacs. When using Emacs, users often press the
736 @key{META} key temporarily and then change their minds; if this has the
737 effect of bringing up the Windows menu, it alters the meaning of
738 subsequent commands. Many users find this frustrating.
740 @vindex w32-pass-alt-to-system
741 You can reenable Windows's default handling of tapping the @key{ALT} key
742 by setting @code{w32-pass-alt-to-system} to a non-@code{nil} value.