C-x 5 1
[emacs.git] / man / msdog.texi
blobc793d8bc481d6ac586b4ea133040c366f657df6a
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 
6 @cindex MS-DOG
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
14 built for MS-DOS.
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
23 NT and 9X.
25 @menu
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.
35 @end menu
37 @node MS-DOS Input
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)
43 @vindex dos-super-key
44 @vindex dos-hyper-key
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}
56 key.
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:
65 @smallexample
66 ;; Make the Enter key from the Numeric keypad act as C-j.
67 (define-key function-key-map [kp-enter] [?\C-j])
68 @end smallexample
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}.  If the mouse does have
97 3 buttons, Emacs detects that at startup, and all the 3 buttons function
98 normally, as on X.
100 @cindex mouse, set number of buttons
101 @findex msdos-set-mouse-buttons
102   Some versions of mouse drivers don't report the number of mouse
103 buttons correctly.  For example, mice with a wheel report that they have
104 3 buttons, but only 2 of them are passed to Emacs; the clicks on the
105 wheel, which serves as the middle button, are not passed.  In these
106 cases, you can use the @kbd{M-x msdos-set-mouse-buttons} command to set
107 the notion of number of buttons used by Emacs.  This command prompts for
108 the number of buttons, and forces Emacs to behave as if your mouse had
109 that number of buttons.  You could make such a setting permanent by
110 adding this fragment to your @file{_emacs} init file:
112 @example
113  ;; Force Emacs to behave as if the mouse had 
114  ;; only 2 buttons
115  (msdos-set-mouse-buttons 2)
116 @end example
118 @cindex Windows clipboard support
119   Emacs built for MS-DOS supports clipboard operations when it runs on
120 Windows.  Commands that put text on the kill ring, or yank text from the
121 ring, check the Windows clipboard first, just as Emacs does on X Windows
122 (@pxref{Mouse Commands}).  Only the primary selection and the cut buffer
123 are supported by MS-DOS Emacs on Windows; the secondary selection always
124 appears as empty.
126   Due to the way clipboard access is implemented by Windows, the
127 length of text you can put into the clipboard is limited by the amount
128 of free DOS memory that is available to Emacs.  Usually, up to 620KB of
129 text can be put into the clipboard, but this limit depends on the system
130 configuration and is lower if you run Emacs as a subprocess of
131 another program.  If the killed text does not fit, Emacs prints a
132 message saying so, and does not put the text into the clipboard.
134   Null characters also cannot be put into the Windows clipboard.  If the
135 killed text includes null characters, Emacs does not put such text into
136 the clipboard, and prints in the echo area a message to that effect.
138 @vindex dos-display-scancodes
139   The variable @code{dos-display-scancodes}, when non-@code{nil},
140 directs Emacs to display the ASCII value and the keyboard scan code of
141 each keystroke; this feature serves as a complement to the
142 @code{view-lossage} command, for debugging.
144 @node MS-DOS Display
145 @section Display on MS-DOS
146 @cindex faces under MS-DOS
147 @cindex fonts, emulating under MS-DOS
149   Display on MS-DOS cannot use font variants, like bold or italic,
150 but it does support
151 multiple faces, each of which can specify a foreground and a background
152 color.  Therefore, you can get the full functionality of Emacs packages
153 that use fonts (such as @code{font-lock}, Enriched Text mode, and
154 others) by defining the relevant faces to use different colors.  Use the
155 @code{list-colors-display} command (@pxref{Frame Parameters}) and the
156 @code{list-faces-display} command (@pxref{Faces}) to see what colors and
157 faces are available and what they look like.
159   The section @ref{MS-DOS and MULE}, later in this chapter, describes
160 how Emacs displays glyphs and characters which aren't supported by the
161 native font built into the DOS display.
163 @cindex cursor shape on MS-DOS
164   When Emacs starts, it changes the cursor shape to a solid box.  This
165 is for compatibility with the Unix version, where the box cursor is the
166 default.  This default shape can be changed to a bar by specifying the
167 @code{cursor-type} parameter in the variable @code{default-frame-alist}
168 (@pxref{Creating Frames}).  The MS-DOS terminal doesn't support a
169 vertical-bar cursor, so the bar cursor is horizontal, and the
170 @code{@var{width}} parameter, if specified by the frame parameters,
171 actually determines its height.  As an extension, the bar cursor
172 specification can include the starting scan line of the cursor as well
173 as its width, like this:
175 @example
176  '(cursor-type bar @var{width} . @var{start})
177 @end example
179 @noindent
180 In addition, if the @var{width} parameter is negative, the cursor bar
181 begins at the top of the character cell.
183 @cindex frames on MS-DOS
184   Multiple frames (@pxref{Frames}) are supported on MS-DOS, but they all
185 overlap, so you only see a single frame at any given moment.  That
186 single visible frame occupies the entire screen.  When you run Emacs
187 from MS-Windows DOS box, you can make the visible frame smaller than
188 the full screen, but Emacs still cannot display more than a single
189 frame at a time.
191 @cindex frame size under MS-DOS
192 @findex mode4350
193 @findex mode25
194   The @code{mode4350} command switches the display to 43 or 50
195 lines, depending on your hardware; the @code{mode25} command switches
196 to the default 80x25 screen size.
198   By default, Emacs only knows how to set screen sizes of 80 columns by
199 25, 28, 35, 40, 43 or 50 rows.  However, if your video adapter has
200 special video modes that will switch the display to other sizes, you can
201 have Emacs support those too.  When you ask Emacs to switch the frame to
202 @var{n} rows by @var{m} columns dimensions, it checks if there is a
203 variable called @code{screen-dimensions-@var{n}x@var{m}}, and if so,
204 uses its value (which must be an integer) as the video mode to switch
205 to.  (Emacs switches to that video mode by calling the BIOS @code{Set
206 Video Mode} function with the value of
207 @code{screen-dimensions-@var{n}x@var{m}} in the @code{AL} register.)
208 For example, suppose your adapter will switch to 66x80 dimensions when
209 put into video mode 85.  Then you can make Emacs support this screen
210 size by putting the following into your @file{_emacs} file:
212 @example
213 (setq screen-dimensions-66x80 85)
214 @end example
216   Since Emacs on MS-DOS can only set the frame size to specific
217 supported dimensions, it cannot honor every possible frame resizing
218 request.  When an unsupported size is requested, Emacs chooses the next
219 larger supported size beyond the specified size.  For example, if you
220 ask for 36x80 frame, you will get 40x80 instead.
222   The variables @code{screen-dimensions-@var{n}x@var{m}} are used only
223 when they exactly match the specified size; the search for the next
224 larger supported size ignores them.  In the above example, even if your
225 VGA supports 38x80 dimensions and you define a variable
226 @code{screen-dimensions-38x80} with a suitable value, you will still get
227 40x80 screen when you ask for a 36x80 frame.  If you want to get the
228 38x80 size in this case, you can do it by setting the variable named
229 @code{screen-dimensions-36x80} with the same video mode value as
230 @code{screen-dimensions-38x80}.
232   Changing frame dimensions on MS-DOS has the effect of changing all the
233 other frames to the new dimensions.
235 @node MS-DOS File Names
236 @section File Names on MS-DOS
237 @cindex file names under MS-DOS
238 @cindex init file, default name under MS-DOS
240   MS-DOS normally uses a backslash, @samp{\}, to separate name units
241 within a file name, instead of the slash used on other systems.  Emacs
242 on MS-DOS permits use of either slash or backslash, and also knows
243 about drive letters in file names.
245   On MS-DOS, file names are case-insensitive and limited to eight
246 characters, plus optionally a period and three more characters.  Emacs
247 knows enough about these limitations to handle file names that were
248 meant for other operating systems.  For instance, leading dots @samp{.}
249 in file names are invalid in MS-DOS, so Emacs transparently converts
250 them to underscores @samp{_}; thus your default init file (@pxref{Init
251 File}) is called @file{_emacs} on MS-DOS.  Excess characters before or
252 after the period are generally ignored by MS-DOS itself; thus, if you
253 visit the file @file{LongFileName.EvenLongerExtension}, you will
254 silently get @file{longfile.eve}, but Emacs will still display the long
255 file name on the mode line.  Other than that, it's up to you to specify
256 file names which are valid under MS-DOS; the transparent conversion as
257 described above only works on file names built into Emacs.
259 @cindex backup file names on MS-DOS
260   The above restrictions on the file names on MS-DOS make it almost
261 impossible to construct the name of a backup file (@pxref{Backup
262 Names}) without losing some of the original file name characters.  For
263 example, the name of a backup file for @file{docs.txt} is
264 @file{docs.tx~} even if single backup is used.
266 @cindex file names under Windows 95/NT
267 @cindex long file names in DOS box under Windows 95/NT
268   If you run Emacs as a DOS application under Windows 9X, you can
269 turn on support for long file names.  If you do that, Emacs doesn't
270 truncate file names or convert them to lower case; instead, it uses the
271 file names that you specify, verbatim.  To enable long file name
272 support, set the environment variable @env{LFN} to @samp{y} before
273 starting Emacs.  Unfortunately, Windows NT doesn't allow DOS programs to
274 access long file names, so Emacs built for MS-DOS will only see their
275 short 8+3 aliases.
277 @cindex @env{HOME} directory under MS-DOS
278   MS-DOS has no notion of home directory, so Emacs on MS-DOS pretends
279 that the directory where it is installed is the value of @env{HOME}
280 environment variable.  That is, if your Emacs binary,
281 @file{emacs.exe}, is in the directory @file{c:/utils/emacs/bin}, then
282 Emacs acts as if @env{HOME} were set to @samp{c:/utils/emacs}.  In
283 particular, that is where Emacs looks for the init file @file{_emacs}.
284 With this in mind, you can use @samp{~} in file names as an alias for
285 the home directory, as you would in Unix.  You can also set @env{HOME}
286 variable in the environment before starting Emacs; its value will then
287 override the above default behavior.
289   Emacs on MS-DOS handles the directory name @file{/dev} specially,
290 because of a feature in the emulator libraries of DJGPP that pretends
291 I/O devices have names in that directory.  We recommend that you avoid
292 using an actual directory named @file{/dev} on any disk.
294 @node Text and Binary
295 @section Text Files and Binary Files
296 @cindex text and binary files on MS-DOS/MS-Windows
298   GNU Emacs uses newline characters to separate text lines.  This is the
299 convention used on Unix, on which GNU Emacs was developed, and on GNU
300 systems since they are modeled on Unix.
302 @cindex end-of-line conversion on MS-DOS/MS-Windows
303   MS-DOS and MS-Windows normally use carriage-return linefeed, a
304 two-character sequence, to separate text lines.  (Linefeed is the same
305 character as newline.)  Therefore, convenient editing of typical files
306 with Emacs requires conversion of these end-of-line (EOL) sequences.
307 And that is what Emacs normally does: it converts carriage-return
308 linefeed into newline when reading files, and converts newline into
309 carriage-return linefeed when writing files.  The same mechanism that
310 handles conversion of international character codes does this conversion
311 also (@pxref{Coding Systems}).
313 @cindex cursor location, on MS-DOS
314 @cindex point location, on MS-DOS
315   One consequence of this special format-conversion of most files is
316 that character positions as reported by Emacs (@pxref{Position Info}) do
317 not agree with the file size information known to the operating system.
319   In addition, if Emacs recognizes from a file's contents that it uses
320 newline rather than carriage-return linefeed as its line separator, it
321 does not perform EOL conversion when reading or writing that file.  Thus,
322 you can read and edit files from Unix or GNU systems on MS-DOS with no
323 special effort, and they will be left with their Unix-style EOLs.
325   The mode line indicates whether end-of-line translation was used for
326 the current buffer.  If MS-DOS end-of-line translation is in use for the
327 buffer, a backslash @samp{\} is displayed after the coding system
328 mnemonic near the beginning of the mode line (@pxref{Mode Line}).  If no
329 EOL translation was performed, the string @samp{(Unix)} is displayed
330 instead of the backslash, to alert you that the file's EOL format is not
331 the usual carriage-return linefeed.
333 @cindex DOS-to-Unix conversion of files
334 @pindex dos2unix
335   End-of-line conversion is part of the general coding system conversion
336 mechanism, so the way to control whether to treat a text file as
337 DOS-style or Unix-style is with the commands for specifying a coding
338 system (@pxref{Specify Coding}).  For example, @kbd{C-x @key{RET} c unix
339 @key{RET} C-x C-f foobar.txt} visits the file @file{foobar.txt} without
340 converting the EOLs; if that file has carriage-return linefeed pairs at
341 the end of its lines, Emacs will display @samp{^M} at the end of each
342 line.  Similarly, you can force Emacs to save a buffer with specific EOL
343 format with the @kbd{C-x @key{RET} f} command.  For example, to save a
344 buffer with Unix EOL format, type @kbd{C-x @key{RET} f unix @key{RET}
345 C-x C-s}.  Thus, visiting a file with DOS EOL conversion, then saving it
346 with Unix EOL format effectively converts the file to Unix text style,
347 like the popular program @code{dos2unix} does.
349 @cindex untranslated file system
350 @findex add-untranslated-filesystem
351   When you use NFS or Samba to access file systems that reside on
352 computers using Unix or GNU systems, Emacs should not perform
353 end-of-line translation on any files in these file systems--not even
354 when you create a new file.  To request this, designate these file
355 systems as @dfn{untranslated} file systems by calling the function
356 @code{add-untranslated-filesystem}.  It takes one argument: the file
357 system name, including a drive letter and optionally a directory.  For
358 example,
360 @example
361 (add-untranslated-filesystem "Z:")
362 @end example
364 @noindent
365 designates drive Z as an untranslated file system, and
367 @example
368 (add-untranslated-filesystem "Z:\\foo")
369 @end example
371 @noindent
372 designates directory @file{\foo} on drive Z as an untranslated file
373 system.
375   Most often you would use @code{add-untranslated-filesystem} in your
376 @file{_emacs} file, or in @file{site-start.el} so that all the users at
377 your site get the benefit of it.
379 @findex remove-untranslated-filesystem
380   To countermand the effect of @code{add-untranslated-filesystem}, use
381 the function @code{remove-untranslated-filesystem}.  This function takes
382 one argument, which should be a string just like the one that was used
383 previously with @code{add-untranslated-filesystem}.
385   Designating a file system as untranslated does @strong{not} disable
386 code conversions as specified by the coding systems set up by your
387 language environment, it only affects the EOL conversions, by forcing
388 Emacs to create new files with Unix-style newline-only EOLs.
390 @vindex file-name-buffer-file-type-alist
391 @cindex binary files, on MS-DOS/MS-Windows
392   Some kinds of files should not be converted at all, because their
393 contents are not really text.  Therefore, Emacs on MS-DOS distinguishes
394 certain files as @dfn{binary files}.  (This distinction is not part of
395 MS-DOS; it is made by Emacs only.)  Binary files include executable
396 programs, compressed archives, etc.  Emacs uses the file name to decide
397 whether to treat a file as binary: the variable
398 @code{file-name-buffer-file-type-alist} defines the file-name patterns
399 that indicate binary files.  If a file name matches one of the patterns
400 for binary files (those whose associations are of the type
401 @code{(@var{pattern} . t)}, Emacs reads and writes that file using the
402 @code{no-conversion} coding system (@pxref{Coding Systems}) which turns
403 off @emph{all} coding-system conversions, not only the EOL conversion.
404 @code{file-name-buffer-file-type-alist} also includes file-name patterns
405 for files which are known to be DOS-style text files with
406 carriage-return linefeed EOL format, such as @file{CONFIG.SYS}; Emacs
407 always writes those files with DOS-style EOLs.
409   If a file which belongs to an untranslated file system matches one of
410 the file-name patterns in @code{file-name-buffer-file-type-alist}, the
411 EOL conversion is determined by @code{file-name-buffer-file-type-alist}.
413 @findex find-file-text
414 @findex find-file-binary
415   You can visit a file and specify whether to treat it as text or binary
416 using the commands @code{find-file-text} and @code{find-file-binary}.
417 @code{find-file-text} specifies DOS EOL conversions, but leaves the
418 other coding conversions unspecified (Emacs determines the required
419 conversions via the usual defaults and coding-detection mechanisms).  On
420 the other hand, @code{find-file-binary} turns off @emph{all}
421 coding-system conversions.
423 @findex find-file-literally@r{, and binary files}
424   The @code{find-file-text} and @code{find-file-binary} commands are
425 only available when Emacs runs on MS-DOS or MS-Windows.  The command
426 @code{find-file-literally}, which is available on all platforms,
427 produces the same effect as @code{find-file-binary}.
429 @node MS-DOS Printing
430 @section Printing and MS-DOS
432   Printing commands, such as @code{lpr-buffer} (@pxref{Hardcopy}) and
433 @code{ps-print-buffer} (@pxref{PostScript}) can work in MS-DOS and
434 MS-Windows by sending the output to one of the printer ports, if a
435 Unix-style @code{lpr} program is unavailable.  This behaviour is
436 controlled by the same variables that control printing with @code{lpr}
437 on Unix (@pxref{Hardcopy}, @pxref{PostScript Variables}), but the
438 defaults for these variables on MS-DOS and MS-Windows are not the same
439 as the defaults on Unix.
441 @vindex printer-name @r{(MS-DOS)}
442   If you want to use your local printer, printing on it in the usual DOS
443 manner, then set the Lisp variable @code{lpr-command} to @code{""} (its
444 default value) and @code{printer-name} to the name of the printer
445 port---for example, @code{"PRN"}, the usual local printer port (that's
446 the default), or @code{"LPT2"}, or @code{"COM1"} for a serial printer.
447 You can also set @code{printer-name} to a file name, in which case
448 ``printed'' output is actually appended to that file.  If you set
449 @code{printer-name} to @code{"NUL"}, printed output is silently
450 discarded (sent to the system null device).
452   On MS-Windows, when the Windows network software is installed, you can
453 also use a printer shared by another machine by setting
454 @code{printer-name} to the UNC share name for that printer--for example,
455 @code{"//joes_pc/hp4si"}.  (It doesn't matter whether you use forward
456 slashes or backslashes here.)  To find out the names of shared printers,
457 run the command @samp{net view} at a DOS command prompt to obtain a list
458 of servers, and @samp{net view @var{server-name}} to see the names of printers
459 (and directories) shared by that server.
461   If you set @code{printer-name} to a file name, it's best to use an
462 absolute file name.  Emacs changes the working directory according to
463 the default directory of the current buffer, so if the file name in
464 @code{printer-name} is relative, you will end up with several such
465 files, each one in the directory of the buffer from which the printing
466 was done.
468 @findex print-buffer @r{(MS-DOS)}
469 @findex print-region @r{(MS-DOS)}
470 @vindex lpr-headers-switches @r{(MS-DOS)}
471   The commands @code{print-buffer} and @code{print-region} call the
472 @code{pr} program, or use special switches to the @code{lpr} program, to
473 produce headers on each printed page.  MS-DOS and MS-Windows don't
474 normally have these programs, so by default, the variable
475 @code{lpr-headers-switches} is set so that the requests to print page
476 headers are silently ignored.  Thus, @code{print-buffer} and
477 @code{print-region} produce the same output as @code{lpr-buffer} and
478 @code{lpr-region}, respectively.  If you do have a suitable @code{pr}
479 program (for example, from GNU Textutils), set
480 @code{lpr-headers-switches} to @code{nil}; Emacs will then call
481 @code{pr} to produce the page headers, and print the resulting output as
482 specified by @code{printer-name}.
484 @vindex print-region-function @r{(MS-DOS)}
485 @cindex lpr usage under MS-DOS
486 @vindex lpr-command @r{(MS-DOS)}
487 @vindex lpr-switches @r{(MS-DOS)}
488   Finally, if you do have an @code{lpr} work-alike, you can set the
489 variable @code{lpr-command} to @code{"lpr"}.  Then Emacs will use
490 @code{lpr} for printing, as on other systems.  (If the name of the
491 program isn't @code{lpr}, set @code{lpr-command} to specify where to
492 find it.)  The variable @code{lpr-switches} has its standard meaning
493 when @code{lpr-command} is not @code{""}.  If the variable
494 @code{printer-name} has a string value, it is used as the value for the
495 @code{-P} option to @code{lpr}, as on Unix.
497 @findex ps-print-buffer @r{(MS-DOS)}
498 @findex ps-spool-buffer @r{(MS-DOS)}
499 @vindex ps-printer-name @r{(MS-DOS)}
500 @vindex ps-lpr-command @r{(MS-DOS)}
501 @vindex ps-lpr-switches @r{(MS-DOS)}
502   A parallel set of variables, @code{ps-lpr-command},
503 @code{ps-lpr-switches}, and @code{ps-printer-name} (@pxref{PostScript
504 Variables}), defines how PostScript files should be printed.  These
505 variables are used in the same way as the corresponding variables
506 described above for non-PostScript printing.  Thus, the value of
507 @code{ps-printer-name} is used as the name of the device (or file) to
508 which PostScript output is sent, just as @code{printer-name} is used for
509 non-PostScript printing.  (There are two distinct sets of variables in
510 case you have two printers attached to two different ports, and only one
511 of them is a PostScript printer.)
513   The default value of the variable @code{ps-lpr-command} is @code{""},
514 which causes PostScript output to be sent to the printer port specified
515 by @code{ps-printer-name}, but @code{ps-lpr-command} can also be set to
516 the name of a program which will accept PostScript files.  Thus, if you
517 have a non-PostScript printer, you can set this variable to the name of
518 a PostScript interpreter program (such as Ghostscript).  Any switches
519 that need to be passed to the interpreter program are specified using
520 @code{ps-lpr-switches}.  (If the value of @code{ps-printer-name} is a
521 string, it will be added to the list of switches as the value for the
522 @code{-P} option.  This is probably only useful if you are using
523 @code{lpr}, so when using an interpreter typically you would set
524 @code{ps-printer-name} to something other than a string so it is
525 ignored.)
527   For example, to use Ghostscript for printing on an Epson printer
528 connected to the @samp{LPT2} port, put this in your @file{_emacs} file:
530 @example
531 (setq ps-printer-name t)  ; Ghostscript doesn't understand -P
532 (setq ps-lpr-command "c:/gs/gs386")
533 (setq ps-lpr-switches '("-q" "-dNOPAUSE"
534                         "-sDEVICE=epson"
535                         "-r240x72"
536                         "-sOutputFile=LPT2"
537                         "-Ic:/gs"))
538 @end example
540 @noindent
541 (This assumes that Ghostscript is installed in the @file{"c:/gs"}
542 directory.)
544 @vindex dos-printer
545 @vindex dos-ps-printer
546   For backwards compatibility, the value of @code{dos-printer}
547 (@code{dos-ps-printer}), if it has a value, overrides the value of
548 @code{printer-name} (@code{ps-printer-name}), on MS-DOS and MS-Windows
549 only.
552 @node MS-DOS and MULE
553 @section International Support on MS-DOS
554 @cindex international support @r{(MS-DOS)}
556   Emacs on MS-DOS supports the same international character sets as it
557 does on Unix and other platforms (@pxref{International}), including
558 coding systems for converting between the different character sets.
559 However, due to incompatibilities between MS-DOS/MS-Windows and Unix,
560 there are several DOS-specific aspects of this support that users should
561 be aware of.  This section describes these aspects.
563 @table @kbd
564 @item M-x dos-codepage-setup
565 Set up Emacs display and coding systems as appropriate for the current
566 DOS codepage.
568 @item M-x codepage-setup
569 Create a coding system for a certain DOS codepage.
570 @end table
572 @cindex codepage, MS-DOS
573 @cindex DOS codepages
574   MS-DOS is designed to support one character set of 256 characters at
575 any given time, but gives you a variety of character sets to choose
576 from.  The alternative character sets are known as @dfn{DOS codepages}.
577 Each codepage includes all 128 ASCII characters, but the other 128
578 characters (codes 128 through 255) vary from one codepage to another.
579 Each DOS codepage is identified by a 3-digit number, such as 850, 862,
580 etc.
582   In contrast to X Windows, which lets you use several fonts at the same
583 time, MS-DOS doesn't allow use of several codepages in a single session.
584 Instead, MS-DOS loads a single codepage at system startup, and you must
585 reboot MS-DOS to change it@footnote{Normally, one particular codepage is
586 burnt into the display memory, while other codepages can be installed by
587 modifying system configuration files, such as @file{CONFIG.SYS}, and
588 rebooting.}.  Much the same limitation applies when you run DOS
589 executables on other systems such as MS-Windows.
591 @cindex unibyte operation @r{(MS-DOS)}
592   If you invoke Emacs on MS-DOS with the @samp{--unibyte} option
593 (@pxref{Initial Options}), Emacs does not perform any conversion of
594 non-ASCII characters.  Instead, it reads and writes any non-ASCII
595 characters verbatim, and sends their 8-bit codes to the display
596 verbatim.  Thus, unibyte Emacs on MS-DOS supports the current codepage,
597 whatever it may be, but cannot even represent any other characters.
599 @vindex dos-codepage
600   For multibyte operation on MS-DOS, Emacs needs to know which
601 characters the chosen DOS codepage can display.  So it queries the
602 system shortly after startup to get the chosen codepage number, and
603 stores the number in the variable @code{dos-codepage}.  Some systems
604 return the default value 437 for the current codepage, even though the
605 actual codepage is different.  (This typically happens when you use the
606 codepage built into the display hardware.)  You can specify a different
607 codepage for Emacs to use by setting the variable @code{dos-codepage} in
608 your init file.
610 @cindex language environment, automatic selection on @r{MS-DOS}
611   Multibyte Emacs supports only certain DOS codepages: those which can
612 display Far-Eastern scripts, like the Japanese codepage 932, and those
613 that encode a single ISO 8859 character set.
615   The Far-Eastern codepages can directly display one of the MULE
616 character sets for these countries, so Emacs simply sets up to use the
617 appropriate terminal coding system that is supported by the codepage.
618 The special features described in the rest of this section mostly
619 pertain to codepages that encode ISO 8859 character sets.
621   For the codepages which correspond to one of the ISO character sets,
622 Emacs knows the character set name based on the codepage number.  Emacs
623 automatically creates a coding system to support reading and writing
624 files that use the current codepage, and uses this coding system by
625 default.  The name of this coding system is @code{cp@var{nnn}}, where
626 @var{nnn} is the codepage number.@footnote{The standard Emacs coding
627 systems for ISO 8859 are not quite right for the purpose, because
628 typically the DOS codepage does not match the standard ISO character
629 codes.  For example, the letter @samp{@,{c}} (@samp{c} with cedilla) has
630 code 231 in the standard Latin-1 character set, but the corresponding
631 DOS codepage 850 uses code 135 for this glyph.}
633 @cindex mode line @r{(MS-DOS)}
634   All the @code{cp@var{nnn}} coding systems use the letter @samp{D} (for
635 ``DOS'') as their mode-line mnemonic.  Since both the terminal coding
636 system and the default coding system for file I/O are set to the proper
637 @code{cp@var{nnn}} coding system at startup, it is normal for the mode
638 line on MS-DOS to begin with @samp{-DD\-}.  @xref{Mode Line}.
639 Far-Eastern DOS terminals do not use the @code{cp@var{nnn}} coding
640 systems, and thus their initial mode line looks like on Unix.
642   Since the codepage number also indicates which script you are using,
643 Emacs automatically runs @code{set-language-environment} to select the
644 language environment for that script (@pxref{Language Environments}).
646   If a buffer contains a character belonging to some other ISO 8859
647 character set, not the one that the chosen DOS codepage supports, Emacs
648 displays it using a sequence of ASCII characters.  For example, if the
649 current codepage doesn't have a glyph for the letter @samp{@`o} (small
650 @samp{o} with a grave accent), it is displayed as @samp{@{`o@}}, where
651 the braces serve as a visual indication that this is a single character.
652 (This may look awkward for some non-Latin characters, such as those from
653 Greek or Hebrew alphabets, but it is still readable by a person who
654 knows the language.)  Even though the character may occupy several
655 columns on the screen, it is really still just a single character, and
656 all Emacs commands treat it as one.
658 @vindex dos-unsupported-character-glyph
659   Not all characters in DOS codepages correspond to ISO 8859
660 characters---some are used for other purposes, such as box-drawing
661 characters and other graphics.  Emacs cannot represent these characters
662 internally, so when you read a file that uses these characters, they are
663 converted into a particular character code, specified by the variable
664 @code{dos-unsupported-character-glyph}.
666   Emacs supports many other characters sets aside from ISO 8859, but it
667 cannot display them on MS-DOS.  So if one of these multibyte characters
668 appears in a buffer, Emacs on MS-DOS displays them as specified by the
669 @code{dos-unsupported-character-glyph} variable; by default, this glyph
670 is an empty triangle.  Use the @kbd{C-u C-x =} command to display the
671 actual code and character set of such characters.  @xref{Position Info}.
673 @findex codepage-setup
674   By default, Emacs defines a coding system to support the current
675 codepage.  To define a coding system for some other codepage (e.g., to
676 visit a file written on a DOS machine in another country), use the
677 @kbd{M-x codepage-setup} command.  It prompts for the 3-digit code of
678 the codepage, with completion, then creates the coding system for the
679 specified codepage.  You can then use the new coding system to read and
680 write files, but you must specify it explicitly for the file command
681 when you want to use it (@pxref{Specify Coding}).
683   These coding systems are also useful for visiting a file encoded using
684 a DOS codepage, using Emacs running on some other operating system.
686 @node MS-DOS Processes
687 @section Subprocesses on MS-DOS
689 @cindex compilation under MS-DOS
690 @cindex inferior processes under MS-DOS
691 @findex compile @r{(MS-DOS)}
692 @findex grep @r{(MS-DOS)}
693   Because MS-DOS is a single-process ``operating system,''
694 asynchronous subprocesses are not available.  In particular, Shell
695 mode and its variants do not work.  Most Emacs features that use
696 asynchronous subprocesses also don't work on MS-DOS, including
697 spelling correction and GUD.  When in doubt, try and see; commands that
698 don't work print an error message saying that asynchronous processes
699 aren't supported.
701   Compilation under Emacs with @kbd{M-x compile}, searching files with
702 @kbd{M-x grep} and displaying differences between files with @kbd{M-x
703 diff} do work, by running the inferior processes synchronously.  This
704 means you cannot do any more editing until the inferior process
705 finishes.
707   By contrast, Emacs compiled as native Windows application
708 @strong{does} support asynchronous subprocesses.  @xref{Windows
709 Processes}.
711 @cindex printing under MS-DOS
712   Printing commands, such as @code{lpr-buffer} (@pxref{Hardcopy}) and
713 @code{ps-print-buffer} (@pxref{PostScript}), work in MS-DOS by sending
714 the output to one of the printer ports.  @xref{MS-DOS Printing}.
716   When you run a subprocess synchronously on MS-DOS, make sure the
717 program terminates and does not try to read keyboard input.  If the
718 program does not terminate on its own, you will be unable to terminate
719 it, because MS-DOS provides no general way to terminate a process.
720 Pressing @kbd{C-c} or @kbd{C-@key{BREAK}} might sometimes help in these
721 cases.
723   Accessing files on other machines is not supported on MS-DOS.  Other
724 network-oriented commands such as sending mail, Web browsing, remote
725 login, etc., don't work either, unless network access is built into
726 MS-DOS with some network redirector.
728 @cindex directory listing on MS-DOS
729 @vindex dired-listing-switches @r{(MS-DOS)}
730   Dired on MS-DOS uses the @code{ls-lisp} package where other
731 platforms use the system @code{ls} command.  Therefore, Dired on
732 MS-DOS supports only some of the possible options you can mention in
733 the @code{dired-listing-switches} variable.  The options that work are
734 @samp{-A}, @samp{-a}, @samp{-c}, @samp{-i}, @samp{-r}, @samp{-S},
735 @samp{-s}, @samp{-t}, and @samp{-u}.
737 @node Windows Processes
738 @section Subprocesses on Windows 95 and NT
740 Emacs compiled as a native Windows application (as opposed to the DOS
741 version) includes full support for asynchronous subprocesses.
742 In the Windows version, synchronous and asynchronous subprocesses work
743 fine on both
744 Windows 95 and Windows NT as long as you run only 32-bit Windows
745 applications.  However, when you run a DOS application in a subprocess,
746 you may encounter problems or be unable to run the application at all;
747 and if you run two DOS applications at the same time in two
748 subprocesses, you may have to reboot your system.
750 Since the standard command interpreter (and most command line utilities)
751 on Windows 95 are DOS applications, these problems are significant when
752 using that system.  But there's nothing we can do about them; only
753 Microsoft can fix them.
755 If you run just one DOS application subprocess, the subprocess should
756 work as expected as long as it is ``well-behaved'' and does not perform
757 direct screen access or other unusual actions.  If you have a CPU
758 monitor application, your machine will appear to be 100% busy even when
759 the DOS application is idle, but this is only an artifact of the way CPU
760 monitors measure processor load.
762 You must terminate the DOS application before you start any other DOS
763 application in a different subprocess.  Emacs is unable to interrupt or
764 terminate a DOS subprocess.  The only way you can terminate such a
765 subprocess is by giving it a command that tells its program to exit.
767 If you attempt to run two DOS applications at the same time in separate
768 subprocesses, the second one that is started will be suspended until the
769 first one finishes, even if either or both of them are asynchronous.
771 If you can go to the first subprocess, and tell it to exit, the second
772 subprocess should continue normally.  However, if the second subprocess
773 is synchronous, Emacs itself will be hung until the first subprocess
774 finishes.  If it will not finish without user input, then you have no
775 choice but to reboot if you are running on Windows 95.  If you are
776 running on Windows NT, you can use a process viewer application to kill
777 the appropriate instance of ntvdm instead (this will terminate both DOS
778 subprocesses).
780 If you have to reboot Windows 95 in this situation, do not use the
781 @code{Shutdown} command on the @code{Start} menu; that usually hangs the
782 system.  Instead, type @kbd{CTL-ALT-@key{DEL}} and then choose
783 @code{Shutdown}.  That usually works, although it may take a few minutes
784 to do its job.
786 @node Windows System Menu
787 @section Using the System Menu on Windows
789 Emacs compiled as a native Windows application normally turns off the
790 Windows feature that tapping the @key{ALT}
791 key invokes the Windows menu.  The reason is that the @key{ALT} also
792 serves as @key{META} in Emacs.  When using Emacs, users often press the
793 @key{META} key temporarily and then change their minds; if this has the
794 effect of bringing up the Windows menu, it alters the meaning of
795 subsequent commands.  Many users find this frustrating. 
797 @vindex w32-pass-alt-to-system
798 You can reenable Windows's default handling of tapping the @key{ALT} key
799 by setting @code{w32-pass-alt-to-system} to a non-@code{nil} value.