Mercurial > emacs
comparison man/msdog.texi @ 24095:8983dda2d520
Initial revision
author | Andrew Innes <andrewi@gnu.org> |
---|---|
date | Sun, 17 Jan 1999 19:06:41 +0000 |
parents | |
children | 083c21910c49 |
comparison
equal
deleted
inserted
replaced
24094:1a575df191bb | 24095:8983dda2d520 |
---|---|
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 | |
8 | |
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. | |
15 | |
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. | |
24 | |
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 | |
36 | |
37 @node MS-DOS Input | |
38 @section Keyboard and Mouse on MS-DOS | |
39 | |
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. | |
57 | |
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: | |
64 | |
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 | |
69 | |
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. | |
77 | |
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}). | |
89 | |
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}. | |
97 | |
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 | |
104 appears as empty. | |
105 | |
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. | |
113 | |
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. | |
117 | |
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. | |
123 | |
124 @node MS-DOS Display | |
125 @section Display on MS-DOS | |
126 @cindex faces under MS-DOS | |
127 @cindex fonts, emulating under MS-DOS | |
128 | |
129 Display on MS-DOS cannot use font variants, like bold or italic, | |
130 but it does support | |
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. | |
138 | |
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. | |
142 | |
143 @cindex frames on MS-DOS | |
144 Multiple frames (@pxref{Frames}) are supported on MS-DOS, but they all | |
145 overlap, so you only see a single frame at any given moment. That | |
146 single visible frame occupies the entire screen. When you run Emacs | |
147 from MS-Windows DOS box, you can make the visible frame smaller than | |
148 the full screen, but Emacs still cannot display more than a single | |
149 frame at a time. | |
150 | |
151 @cindex frame size under MS-DOS | |
152 @findex mode4350 | |
153 @findex mode25 | |
154 The @code{mode4350} command switches the display to 43 or 50 | |
155 lines, depending on your hardware; the @code{mode25} command switches | |
156 to the default 80x25 screen size. | |
157 | |
158 By default, Emacs only knows how to set screen sizes of 80 columns by | |
159 25, 28, 35, 40, 43 or 50 rows. However, if your video adapter has | |
160 special video modes that will switch the display to other sizes, you can | |
161 have Emacs support those too. When you ask Emacs to switch the frame to | |
162 @var{n} rows by @var{m} columns dimensions, it checks if there is a | |
163 variable called @code{screen-dimensions-@var{n}x@var{m}}, and if so, | |
164 uses its value (which must be an integer) as the video mode to switch | |
165 to. (Emacs switches to that video mode by calling the BIOS @code{Set | |
166 Video Mode} function with the value of | |
167 @code{screen-dimensions-@var{n}x@var{m}} in the @code{AL} register.) | |
168 For example, suppose your adapter will switch to 66x80 dimensions when | |
169 put into video mode 85. Then you can make Emacs support this screen | |
170 size by putting the following into your @file{_emacs} file: | |
171 | |
172 @example | |
173 (setq screen-dimensions-66x80 85) | |
174 @end example | |
175 | |
176 Since Emacs on MS-DOS can only set the frame size to specific | |
177 supported dimensions, it cannot honor every possible frame resizing | |
178 request. When an unsupported size is requested, Emacs chooses the next | |
179 larger supported size beyond the specified size. For example, if you | |
180 ask for 36x80 frame, you will get 40x80 instead. | |
181 | |
182 The variables @code{screen-dimensions-@var{n}x@var{m}} are used only | |
183 when they exactly match the specified size; the search for the next | |
184 larger supported size ignores them. In the above example, even if your | |
185 VGA supports 38x80 dimensions and you define a variable | |
186 @code{screen-dimensions-38x80} with a suitable value, you will still get | |
187 40x80 screen when you ask for a 36x80 frame. If you want to get the | |
188 38x80 size in this case, you can do it by setting the variable named | |
189 @code{screen-dimensions-36x80} with the same video mode value as | |
190 @code{screen-dimensions-38x80}. | |
191 | |
192 Changing frame dimensions on MS-DOS has the effect of changing all the | |
193 other frames to the new dimensions. | |
194 | |
195 @node MS-DOS File Names | |
196 @section File Names on MS-DOS | |
197 @cindex file names under MS-DOS | |
198 @cindex init file, default name under MS-DOS | |
199 | |
200 MS-DOS normally uses a backslash, @samp{\}, to separate name units | |
201 within a file name, instead of the slash used on other systems. Emacs | |
202 on MS-DOS permits use of either slash or backslash, and also knows | |
203 about drive letters in file names. | |
204 | |
205 On MS-DOS, file names are case-insensitive and limited to eight | |
206 characters, plus optionally a period and three more characters. Emacs | |
207 knows enough about these limitations to handle file names that were | |
208 meant for other operating systems. For instance, leading dots @samp{.} | |
209 in file names are invalid in MS-DOS, so Emacs transparently converts | |
210 them to underscores @samp{_}; thus your default init file (@pxref{Init | |
211 File}) is called @file{_emacs} on MS-DOS. Excess characters before or | |
212 after the period are generally ignored by MS-DOS itself; thus, if you | |
213 visit the file @file{LongFileName.EvenLongerExtension}, you will | |
214 silently get @file{longfile.eve}, but Emacs will still display the long | |
215 file name on the mode line. Other than that, it's up to you to specify | |
216 file names which are valid under MS-DOS; the transparent conversion as | |
217 described above only works on file names built into Emacs. | |
218 | |
219 @cindex backup file names on MS-DOS | |
220 The above restrictions on the file names on MS-DOS make it almost | |
221 impossible to construct the name of a backup file (@pxref{Backup | |
222 Names}) without losing some of the original file name characters. For | |
223 example, the name of a backup file for @file{docs.txt} is | |
224 @file{docs.tx~} even if single backup is used. | |
225 | |
226 @cindex file names under Windows 95/NT | |
227 @cindex long file names in DOS box under Windows 95/NT | |
228 If you run Emacs as a DOS application under Windows 9X, you can | |
229 turn on support for long file names. If you do that, Emacs doesn't | |
230 truncate file names or convert them to lower case; instead, it uses the | |
231 file names that you specify, verbatim. To enable long file name | |
232 support, set the environment variable @code{LFN} to @samp{y} before | |
233 starting Emacs. Unfortunately, Windows NT doesn't allow DOS programs to | |
234 access long file names, so Emacs built for MS-DOS will only see their | |
235 short 8+3 aliases. | |
236 | |
237 @cindex @code{HOME} directory under MS-DOS | |
238 MS-DOS has no notion of home directory, so Emacs on MS-DOS pretends | |
239 that the directory where it is installed is the value of @code{HOME} | |
240 environment variable. That is, if your Emacs binary, | |
241 @file{emacs.exe}, is in the directory @file{c:/utils/emacs/bin}, then | |
242 Emacs acts as if @code{HOME} were set to @samp{c:/utils/emacs}. In | |
243 particular, that is where Emacs looks for the init file @file{_emacs}. | |
244 With this in mind, you can use @samp{~} in file names as an alias for | |
245 the home directory, as you would in Unix. You can also set @code{HOME} | |
246 variable in the environment before starting Emacs; its value will then | |
247 override the above default behavior. | |
248 | |
249 Emacs on MS-DOS handles the directory name @file{/dev} specially, | |
250 because of a feature in the emulator libraries of DJGPP that pretends | |
251 I/O devices have names in that directory. We recommend that you avoid | |
252 using an actual directory named @file{/dev} on any disk. | |
253 | |
254 @node Text and Binary | |
255 @section Text Files and Binary Files | |
256 @cindex text and binary files on MS-DOS/MS-Windows | |
257 | |
258 GNU Emacs uses newline characters to separate text lines. This is the | |
259 convention used on Unix, on which GNU Emacs was developed, and on GNU | |
260 systems since they are modeled on Unix. | |
261 | |
262 @cindex end-of-line conversion on MS-DOS/MS-Windows | |
263 MS-DOS and MS-Windows normally use carriage-return linefeed, a | |
264 two-character sequence, to separate text lines. (Linefeed is the same | |
265 character as newline.) Therefore, convenient editing of typical files | |
266 with Emacs requires conversion of these end-of-line (EOL) sequences. | |
267 And that is what Emacs normally does: it converts carriage-return | |
268 linefeed into newline when reading files, and converts newline into | |
269 carriage-return linefeed when writing files. The same mechanism that | |
270 handles conversion of international character codes does this conversion | |
271 also (@pxref{Coding Systems}). | |
272 | |
273 @cindex cursor location, under MS-DOS | |
274 @cindex point location, under MS-DOS | |
275 One consequence of this special format-conversion of most files is | |
276 that character positions as reported by Emacs (@pxref{Position Info}) do | |
277 not agree with the file size information known to the operating system. | |
278 | |
279 @vindex file-name-buffer-file-type-alist | |
280 Some kinds of files should not be converted, because their contents | |
281 are not really text. Therefore, Emacs on MS-DOS distinguishes certain | |
282 files as @dfn{binary files}, and reads and writes them verbatim. (This | |
283 distinction is not part of MS-DOS; it is made by Emacs only.) These | |
284 include executable programs, compressed archives, etc. Emacs uses the | |
285 file name to decide whether to treat a file as binary: the variable | |
286 @code{file-name-buffer-file-type-alist} defines the file-name patterns | |
287 that indicate binary files. Note that if a file name matches one of the | |
288 patterns for binary files in @code{file-name-buffer-file-type-alist}, | |
289 Emacs uses the @code{no-conversion} coding system (@pxref{Coding | |
290 Systems}) which turns off @emph{all} coding-system conversions, not only | |
291 the EOL conversion. | |
292 | |
293 In addition, if Emacs recognizes from a file's contents that it uses | |
294 newline rather than carriage-return linefeed as its line separator, it | |
295 does not perform conversion when reading or writing that file. Thus, | |
296 you can read and edit files from Unix or GNU systems on MS-DOS with no | |
297 special effort, and they will be left with their Unix-style EOLs. | |
298 | |
299 @findex find-file-text | |
300 @findex find-file-binary | |
301 You can visit a file and specify whether to treat a file as text or | |
302 binary using the commands @code{find-file-text} and | |
303 @code{find-file-binary}. End-of-line conversion is part of the general | |
304 coding system conversion mechanism, so another way to control whether to | |
305 treat a file as text or binary is with the commands for specifying a | |
306 coding system (@pxref{Specify Coding}). For example, | |
307 @kbd{C-x @key{RET} c undecided-unix @key{RET} C-x C-f foobar.txt} | |
308 visits the file @file{foobar.txt} without converting the EOLs. | |
309 | |
310 The mode line indicates whether end-of-line translation was used for | |
311 the current buffer. Normally a colon appears after the coding system | |
312 letter near the beginning of the mode line. If MS-DOS end-of-line | |
313 translation is in use for the buffer, this character changes to a | |
314 backslash. | |
315 | |
316 @cindex untranslated file system | |
317 @findex add-untranslated-filesystem | |
318 When you use NFS or Samba to access file systems that reside on | |
319 computers using Unix or GNU systems, Emacs should not perform | |
320 end-of-line translation on any files in these file systems--not even | |
321 when you create a new file. To request this, designate these file | |
322 systems as @dfn{untranslated} file systems by calling the function | |
323 @code{add-untranslated-filesystem}. It takes one argument: the file | |
324 system name, including a drive letter and optionally a directory. For | |
325 example, | |
326 | |
327 @example | |
328 (add-untranslated-filesystem "Z:") | |
329 @end example | |
330 | |
331 @noindent | |
332 designates drive Z as an untranslated file system, and | |
333 | |
334 @example | |
335 (add-untranslated-filesystem "Z:\\foo") | |
336 @end example | |
337 | |
338 @noindent | |
339 designates directory @file{\foo} on drive Z as an untranslated file | |
340 system. | |
341 | |
342 Most often you would use @code{add-untranslated-filesystem} in your | |
343 @file{_emacs} file, or in @file{site-start.el} so that all the users at | |
344 your site get the benefit of it. | |
345 | |
346 @findex remove-untranslated-filesystem | |
347 To countermand the effect of @code{add-untranslated-filesystem}, use | |
348 the function @code{remove-untranslated-filesystem}. This function takes | |
349 one argument, which should be a string just like the one that was used | |
350 previously with @code{add-untranslated-filesystem}. | |
351 | |
352 @node MS-DOS Printing | |
353 @section Printing and MS-DOS | |
354 | |
355 Printing commands, such as @code{lpr-buffer} (@pxref{Hardcopy}) and | |
356 @code{ps-print-buffer} (@pxref{Postscript}) can work in MS-DOS by | |
357 sending the output to one of the printer ports, if a Unix-style @code{lpr} | |
358 program is unavailable. A few DOS-specific variables control how this | |
359 works. | |
360 | |
361 @vindex dos-printer | |
362 If you want to use your local printer, printing on it in the usual DOS | |
363 manner, then set the Lisp variable @code{dos-printer} to the name of the | |
364 printer port---for example, @code{"PRN"}, the usual local printer port | |
365 (that's the default), or @code{"LPT2"} or @code{"COM1"} for a serial | |
366 printer. You can also set @code{dos-printer} to a file name, in which | |
367 case ``printed'' output is actually appended to that file. If you set | |
368 @code{dos-printer} to @code{"NUL"}, printed output is silently | |
369 discarded (sent to the system null device). | |
370 | |
371 If you set @code{dos-printer} to a file name, it's best to use an | |
372 absolute file name. Emacs changes the working directory according to | |
373 the default directory of the current buffer, so if the file name in | |
374 @code{dos-printer} is relative, you will end up with several such files, | |
375 each one in the directory of the buffer from which the printing was | |
376 done. | |
377 | |
378 @findex print-buffer @r{(MS-DOS)} | |
379 @findex print-region @r{(MS-DOS)} | |
380 @vindex lpr-headers-switches @r{(MS-DOS)} | |
381 The commands @code{print-buffer} and @code{print-region} call the | |
382 @code{pr} program, or use special switches to the @code{lpr} program, to | |
383 produce headers on each printed page. MS-DOS doesn't normally have | |
384 these programs, so by default, the variable @code{lpr-headers-switches} | |
385 is set so that the requests to print page headers are silently ignored. | |
386 Thus, @code{print-buffer} and @code{print-region} produce the same | |
387 output as @code{lpr-buffer} and @code{lpr-region}, respectively. If you | |
388 do have a suitable @code{pr} program (for example, from GNU Textutils), | |
389 set @code{lpr-headers-switches} to @code{nil}; Emacs will then call | |
390 @code{pr} to produce the page headers, and print the resulting output as | |
391 specified by @code{dos-printer}. | |
392 | |
393 @vindex print-region-function @r{(MS-DOS)} | |
394 @cindex lpr usage under MS-DOS | |
395 @vindex lpr-command @r{(MS-DOS)} | |
396 @vindex lpr-switches @r{(MS-DOS)} | |
397 Finally, if you do have an @code{lpr} work-alike, you can set | |
398 @code{print-region-function} to @code{nil}. Then Emacs uses @code{lpr} | |
399 for printing, as on other systems. (If the name of the program isn't | |
400 @code{lpr}, set the @code{lpr-command} variable to specify where to find | |
401 it.) | |
402 | |
403 @findex ps-print-buffer @r{(MS-DOS)} | |
404 @findex ps-spool-buffer @r{(MS-DOS)} | |
405 @vindex dos-ps-printer | |
406 @vindex ps-lpr-command @r{(MS-DOS)} | |
407 @vindex ps-lpr-switches @r{(MS-DOS)} | |
408 A separate variable, @code{dos-ps-printer}, defines how PostScript | |
409 files should be printed. If its value is a string, it is used as the | |
410 name of the device (or file) to which PostScript output is sent, just as | |
411 @code{dos-printer} is used for non-PostScript printing. (These are two | |
412 distinct variables in case you have two printers attached to two | |
413 different ports, and only one of them is a PostScript printer.) If the | |
414 value of @code{dos-ps-printer} is not a string, then the variables | |
415 @code{ps-lpr-command} and @code{ps-lpr-switches} (@pxref{Postscript}) | |
416 control how to print PostScript files. Thus, if you have a | |
417 non-PostScript printer, you can set these variables to the name and the | |
418 switches appropriate for a PostScript interpreter program (such as | |
419 Ghostscript). | |
420 | |
421 For example, to use Ghostscript for printing on an Epson printer | |
422 connected to @samp{LPT2} port, put this on your @file{.emacs} file: | |
423 | |
424 @example | |
425 (setq dos-ps-printer t) ; @r{Anything but a string.} | |
426 (setq ps-lpr-command "c:/gs/gs386") | |
427 (setq ps-lpr-switches '("-q" "-dNOPAUSE" | |
428 "-sDEVICE=epson" | |
429 "-r240x72" | |
430 "-sOutputFile=LPT2" | |
431 "-Ic:/gs" | |
432 "-")) | |
433 @end example | |
434 | |
435 @noindent | |
436 (This assumes that Ghostscript is installed in the @file{"c:/gs"} | |
437 directory.) | |
438 | |
439 @node MS-DOS and MULE | |
440 @section International Support on MS-DOS | |
441 @cindex international support @r{(MS-DOS)} | |
442 | |
443 Emacs on MS-DOS supports the same international character sets as it | |
444 does on Unix and other platforms (@pxref{International}), including | |
445 coding systems for converting between the different character sets. | |
446 However, due to incompatibilities between MS-DOS/MS-Windows and Unix, | |
447 there are several DOS-specific aspects of this support that users should | |
448 be aware of. This section describes these aspects. | |
449 | |
450 @table @kbd | |
451 @item M-x dos-codepage-setup | |
452 Set up Emacs display and coding systems as appropriate for the current | |
453 DOS codepage. | |
454 | |
455 @item M-x codepage-setup | |
456 Create a coding system for a certain DOS codepage. | |
457 @end table | |
458 | |
459 @cindex codepage, MS-DOS | |
460 @cindex DOS codepages | |
461 MS-DOS is designed to support one character set of 256 characters at | |
462 any given time, but gives you a variety of character sets to choose | |
463 from. The alternative character sets are known as @dfn{DOS codepages}. | |
464 Each codepage includes all 128 ASCII characters, but the other 128 | |
465 characters (codes 128 through 255) vary from one codepage to another. | |
466 Each DOS codepage is identified by a 3-digit number, such as 850, 862, | |
467 etc. | |
468 | |
469 In contrast to X Windows, which lets you use several fonts at the same | |
470 time, MS-DOS doesn't allow use of several codepages in a single session. | |
471 Instead, MS-DOS loads a single codepage at system startup, and you must | |
472 reboot MS-DOS to change it@footnote{Normally, one particular codepage is | |
473 burnt into the display memory, while other codepages can be installed by | |
474 modifying system configuration files, such as @file{CONFIG.SYS}, and | |
475 rebooting.}. Much the same limitation applies when you run DOS | |
476 executables on other systems such as MS-Windows. | |
477 | |
478 @cindex unibyte operation @r{(MS-DOS)} | |
479 If you invoke Emacs on MS-DOS with the @samp{--unibyte} option | |
480 (@pxref{Initial Options}), Emacs does not perform any conversion of | |
481 non-ASCII characters. Instead, it reads and writes any non-ASCII | |
482 characters verbatim, and sends their 8-bit codes to the display | |
483 verbatim. Thus, unibyte Emacs on MS-DOS supports the current codepage, | |
484 whatever it may be, but cannot even represent any other characters. | |
485 | |
486 @vindex dos-codepage | |
487 For multibyte operation on MS-DOS, Emacs needs to know which | |
488 characters the chosen DOS codepage can display. So it queries the | |
489 system shortly after startup to get the chosen codepage number, and | |
490 stores the number in the variable @code{dos-codepage}. Some systems | |
491 return the default value 437 for the current codepage, even though the | |
492 actual codepage is different. (This typically happens when you use the | |
493 codepage built into the display hardware.) You can specify a different | |
494 codepage for Emacs to use by setting the variable @code{dos-codepage} in | |
495 your init file. | |
496 | |
497 @cindex language environment, automatic selection on @r{MS-DOS} | |
498 Multibyte Emacs supports only certain DOS codepages, those that encode | |
499 a single ISO 8859 character set, and it knows which ISO character set | |
500 based on the codepage number. Emacs automatically creates a coding | |
501 system to support reading and writing files that use the current | |
502 codepage, and uses this coding system by default. The name of this | |
503 coding system is @code{cp@var{nnn}}, where @var{nnn} is the codepage | |
504 number.@footnote{The standard Emacs coding systems for ISO 8859 are not | |
505 quite right for the purpose, because typically the DOS codepage does not | |
506 match the standard ISO character codes. For example, the | |
507 letter @samp{@,{c}} (@samp{c} with cedilla) has code 231 in the standard | |
508 Latin-1 character set, but the corresponding DOS codepage 850 uses code | |
509 135 for this glyph.} | |
510 | |
511 @cindex mode line @r{(MS-DOS)} | |
512 All the @code{cp@var{nnn}} coding systems use the letter @samp{D} (for | |
513 ``DOS'') as their mode-line mnemonic. Since both the terminal coding | |
514 system and the default coding system for file I/O are set to the proper | |
515 @code{cp@var{nnn}} coding system at startup, it is normal for the mode | |
516 line on MS-DOS to begin with @samp{-DD\-}. @xref{Mode Line}. | |
517 | |
518 Since the codepage number also indicates which script you are using, | |
519 Emacs automatically runs @code{set-language-environment} to select the | |
520 language environment for that script (@pxref{Language Environments}). | |
521 | |
522 If a buffer contains a character belonging to some other ISO 8859 | |
523 character set, not the one that the chosen DOS codepage supports, Emacs | |
524 displays it using a sequence of ASCII characters. For example, if the | |
525 current codepage doesn't have a glyph for the letter @samp{@`o} (small | |
526 @samp{o} with a grave accent), it is displayed as @samp{@{`o@}}, where | |
527 the braces serve as a visual indication that this is a single character. | |
528 (This may look awkward for some non-Latin characters, such as those from | |
529 Greek or Hebrew alphabets, but it is still readable by a person who | |
530 knows the language.) Even though the character may occupy several | |
531 columns on the screen, it is really still just a single character, and | |
532 all Emacs commands treat it as one. | |
533 | |
534 @vindex dos-unsupported-character-glyph | |
535 Not all characters in DOS codepages correspond to ISO 8859 | |
536 characters---some are used for other purposes, such as box-drawing | |
537 characters and other graphics. Emacs cannot represent these characters | |
538 internally, so when you read a file that uses these characters, they are | |
539 converted into a particular character code, specified by the variable | |
540 @code{dos-unsupported-character-glyph}. | |
541 | |
542 Emacs supports many other characters sets aside from ISO 8859, but it | |
543 cannot display them on MS-DOS. So if one of these multibyte characters | |
544 appears in a buffer, Emacs on MS-DOS displays a solid box instead of the | |
545 character. | |
546 | |
547 @findex codepage-setup | |
548 By default, Emacs defines a coding system to support the current | |
549 codepage. To define a coding system for some other codepage (e.g., to | |
550 visit a file written on a DOS machine in another country), use the | |
551 @kbd{M-x codepage-setup} command. It prompts for the 3-digit code of | |
552 the codepage, with completion, then creates the coding system for the | |
553 specified codepage. You can then use the new coding system to read and | |
554 write files, but you must specify it explicitly for the file command | |
555 when you want to use it (@pxref{Specify Coding}). | |
556 | |
557 These coding systems are also useful for visiting a file encoded using | |
558 a DOS codepage, using Emacs running on some other operating system. | |
559 | |
560 @node MS-DOS Processes | |
561 @section Subprocesses on MS-DOS | |
562 | |
563 @cindex compilation under MS-DOS | |
564 @cindex inferior processes under MS-DOS | |
565 @findex compile @r{(MS-DOS)} | |
566 @findex grep @r{(MS-DOS)} | |
567 Because MS-DOS is a single-process ``operating system,'' | |
568 asynchronous subprocesses are not available. In particular, Shell | |
569 mode and its variants do not work. Most Emacs features that use | |
570 asynchronous subprocesses also don't work on MS-DOS, including | |
571 spelling correction and GUD. When in doubt, try and see; commands that | |
572 don't work print an error message saying that asynchronous processes | |
573 aren't supported. | |
574 | |
575 Compilation under Emacs with @kbd{M-x compile}, searching files with | |
576 @kbd{M-x grep} and displaying differences between files with @kbd{M-x | |
577 diff} do work, by running the inferior processes synchronously. This | |
578 means you cannot do any more editing until the inferior process | |
579 finishes. | |
580 | |
581 By contrast, Emacs compiled as native Windows application | |
582 @strong{does} support asynchronous subprocesses. @xref{Windows | |
583 Processes}. | |
584 | |
585 @cindex printing under MS-DOS | |
586 Printing commands, such as @code{lpr-buffer} (@pxref{Hardcopy}) and | |
587 @code{ps-print-buffer} (@pxref{Postscript}), work in MS-DOS by sending | |
588 the output to one of the printer ports. @xref{MS-DOS Printing}. | |
589 | |
590 When you run a subprocess synchronously on MS-DOS, make sure the | |
591 program terminates and does not try to read keyboard input. If the | |
592 program does not terminate on its own, you will be unable to terminate | |
593 it, because MS-DOS provides no general way to terminate a process. | |
594 Pressing @kbd{C-c} or @kbd{C-@key{BREAK}} might sometimes help in these | |
595 cases. | |
596 | |
597 Accessing files on other machines is not supported on MS-DOS. Other | |
598 network-oriented commands such as sending mail, Web browsing, remote | |
599 login, etc., don't work either, unless network access is built into | |
600 MS-DOS with some network redirector. | |
601 | |
602 @cindex directory listing on MS-DOS | |
603 @vindex dired-listing-switches @r{(MS-DOS)} | |
604 Dired on MS-DOS uses the @code{ls-lisp} package where other | |
605 platforms use the system @code{ls} command. Therefore, Dired on | |
606 MS-DOS supports only some of the possible options you can mention in | |
607 the @code{dired-listing-switches} variable. The options that work are | |
608 @samp{-A}, @samp{-a}, @samp{-c}, @samp{-i}, @samp{-r}, @samp{-S}, | |
609 @samp{-s}, @samp{-t}, and @samp{-u}. | |
610 | |
611 @node Windows Processes | |
612 @section Subprocesses on Windows 95 and NT | |
613 | |
614 Emacs compiled as a native Windows application (as opposed to the DOS | |
615 version) includes full support for asynchronous subprocesses. | |
616 In the Windows version, synchronous and asynchronous subprocesses work | |
617 fine on both | |
618 Windows 95 and Windows NT as long as you run only 32-bit Windows | |
619 applications. However, when you run a DOS application in a subprocess, | |
620 you may encounter problems or be unable to run the application at all; | |
621 and if you run two DOS applications at the same time in two | |
622 subprocesses, you may have to reboot your system. | |
623 | |
624 Since the standard command interpreter (and most command line utilities) | |
625 on Windows 95 are DOS applications, these problems are significant when | |
626 using that system. But there's nothing we can do about them; only | |
627 Microsoft can fix them. | |
628 | |
629 If you run just one DOS application subprocess, the subprocess should | |
630 work as expected as long as it is ``well-behaved'' and does not perform | |
631 direct screen access or other unusual actions. If you have a CPU | |
632 monitor application, your machine will appear to be 100% busy even when | |
633 the DOS application is idle, but this is only an artifact of the way CPU | |
634 monitors measure processor load. | |
635 | |
636 You must terminate the DOS application before you start any other DOS | |
637 application in a different subprocess. Emacs is unable to interrupt or | |
638 terminate a DOS subprocess. The only way you can terminate such a | |
639 subprocess is by giving it a command that tells its program to exit. | |
640 | |
641 If you attempt to run two DOS applications at the same time in separate | |
642 subprocesses, the second one that is started will be suspended until the | |
643 first one finishes, even if either or both of them are asynchronous. | |
644 | |
645 If you can go to the first subprocess, and tell it to exit, the second | |
646 subprocess should continue normally. However, if the second subprocess | |
647 is synchronous, Emacs itself will be hung until the first subprocess | |
648 finishes. If it will not finish without user input, then you have no | |
649 choice but to reboot if you are running on Windows 95. If you are | |
650 running on Windows NT, you can use a process viewer application to kill | |
651 the appropriate instance of ntvdm instead (this will terminate both DOS | |
652 subprocesses). | |
653 | |
654 If you have to reboot Windows 95 in this situation, do not use the | |
655 @code{Shutdown} command on the @code{Start} menu; that usually hangs the | |
656 system. Instead, type @kbd{CTL-ALT-@key{DEL}} and then choose | |
657 @code{Shutdown}. That usually works, although it may take a few minutes | |
658 to do its job. | |
659 | |
660 @node Windows System Menu | |
661 @section Using the System Menu on Windows | |
662 | |
663 Emacs compiled as a native Windows application normally turns off the | |
664 Windows feature that tapping the @key{ALT} | |
665 key invokes the Windows menu. The reason is that the @key{ALT} also | |
666 serves as @key{META} in Emacs. When using Emacs, users often press the | |
667 @key{META} key temporarily and then change their minds; if this has the | |
668 effect of bringing up the Windows menu, it alters the meaning of | |
669 subsequent commands. Many users find this frustrating. | |
670 | |
671 @vindex w32-pass-alt-to-system | |
672 You can reenable Windows's default handling of tapping the @key{ALT} key | |
673 by setting @code{w32-pass-alt-to-system} to a non-@code{nil} value. | |
674 |