Commit | Line | Data |
---|---|---|
ca2565b0 AI |
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 | |
9d9d68ed AI |
356 | @code{ps-print-buffer} (@pxref{Postscript}) can work in MS-DOS and |
357 | MS-Windows by sending the output to one of the printer ports, if a | |
358 | Unix-style @code{lpr} program is unavailable. This behaviour is | |
359 | controlled by the same variables that control printing with @code{lpr} | |
360 | on Unix (@pxref{Hardcopy}, @pxref{Postscript Variables}), but the | |
361 | defaults for these variables on MS-DOS and MS-Windows are not the same | |
362 | as the defaults on Unix. | |
363 | ||
7ada9313 | 364 | @vindex printer-name @r{(MS-DOS)} |
ca2565b0 | 365 | If you want to use your local printer, printing on it in the usual DOS |
9d9d68ed AI |
366 | manner, then set the Lisp variable @code{lpr-command} to @code{""} (its |
367 | default value) and @code{printer-name} to the name of the printer | |
368 | port---for example, @code{"PRN"}, the usual local printer port (that's | |
369 | the default), or @code{"LPT2"}, or @code{"COM1"} for a serial printer. | |
370 | You can also set @code{printer-name} to a file name, in which case | |
371 | ``printed'' output is actually appended to that file. If you set | |
372 | @code{printer-name} to @code{"NUL"}, printed output is silently | |
ca2565b0 AI |
373 | discarded (sent to the system null device). |
374 | ||
9d9d68ed AI |
375 | On MS-Windows, when the Windows network software is installed, you can |
376 | also use a printer shared by another machine by setting | |
377 | @code{printer-name} to the UNC share name for that printer--for example, | |
378 | @code{"//joes_pc/hp4si"}. (It doesn't matter whether you use forward | |
379 | slashes or backslashes here.) To find out the names of shared printers, | |
380 | run the command @samp{net view} at a DOS command prompt to obtain a list | |
5f6fbc5f | 381 | of servers, and @samp{net view @var{server-name}} to see the names of printers |
9d9d68ed AI |
382 | (and directories) shared by that server. |
383 | ||
384 | If you set @code{printer-name} to a file name, it's best to use an | |
ca2565b0 AI |
385 | absolute file name. Emacs changes the working directory according to |
386 | the default directory of the current buffer, so if the file name in | |
9d9d68ed AI |
387 | @code{printer-name} is relative, you will end up with several such |
388 | files, each one in the directory of the buffer from which the printing | |
389 | was done. | |
ca2565b0 AI |
390 | |
391 | @findex print-buffer @r{(MS-DOS)} | |
392 | @findex print-region @r{(MS-DOS)} | |
393 | @vindex lpr-headers-switches @r{(MS-DOS)} | |
394 | The commands @code{print-buffer} and @code{print-region} call the | |
395 | @code{pr} program, or use special switches to the @code{lpr} program, to | |
9d9d68ed AI |
396 | produce headers on each printed page. MS-DOS and MS-Windows don't |
397 | normally have these programs, so by default, the variable | |
398 | @code{lpr-headers-switches} is set so that the requests to print page | |
399 | headers are silently ignored. Thus, @code{print-buffer} and | |
400 | @code{print-region} produce the same output as @code{lpr-buffer} and | |
401 | @code{lpr-region}, respectively. If you do have a suitable @code{pr} | |
402 | program (for example, from GNU Textutils), set | |
403 | @code{lpr-headers-switches} to @code{nil}; Emacs will then call | |
ca2565b0 | 404 | @code{pr} to produce the page headers, and print the resulting output as |
9d9d68ed | 405 | specified by @code{printer-name}. |
ca2565b0 AI |
406 | |
407 | @vindex print-region-function @r{(MS-DOS)} | |
408 | @cindex lpr usage under MS-DOS | |
409 | @vindex lpr-command @r{(MS-DOS)} | |
410 | @vindex lpr-switches @r{(MS-DOS)} | |
9d9d68ed AI |
411 | Finally, if you do have an @code{lpr} work-alike, you can set the |
412 | variable @code{lpr-command} to @code{"lpr"}. Then Emacs will use | |
413 | @code{lpr} for printing, as on other systems. (If the name of the | |
414 | program isn't @code{lpr}, set @code{lpr-command} to specify where to | |
415 | find it.) The variable @code{lpr-switches} has its standard meaning | |
416 | when @code{lpr-command} is not @code{""}. If the variable | |
417 | @code{printer-name} has a string value, it is used as the value for the | |
418 | @code{-P} option to @code{lpr}, as on Unix. | |
ca2565b0 AI |
419 | |
420 | @findex ps-print-buffer @r{(MS-DOS)} | |
421 | @findex ps-spool-buffer @r{(MS-DOS)} | |
4251fcec | 422 | @vindex ps-printer-name @r{(MS-DOS)} |
ca2565b0 AI |
423 | @vindex ps-lpr-command @r{(MS-DOS)} |
424 | @vindex ps-lpr-switches @r{(MS-DOS)} | |
9d9d68ed AI |
425 | A parallel set of variables, @code{ps-lpr-command}, |
426 | @code{ps-lpr-switches}, and @code{ps-printer-name} (@pxref{Postscript | |
5d66c9e1 | 427 | Variables}), defines how PostScript files should be printed. These |
9d9d68ed AI |
428 | variables are used in the same way as the corresponding variables |
429 | described above for non-PostScript printing. Thus, the value of | |
430 | @code{ps-printer-name} is used as the name of the device (or file) to | |
431 | which PostScript output is sent, just as @code{printer-name} is used for | |
432 | non-PostScript printing. (There are two distinct sets of variables in | |
433 | case you have two printers attached to two different ports, and only one | |
434 | of them is a PostScript printer.) | |
435 | ||
436 | The default value of the variable @code{ps-lpr-command} is @code{""}, | |
437 | which causes PostScript output to be sent to the printer port specified | |
438 | by @code{ps-printer-name}, but @code{ps-lpr-command} can also be set to | |
439 | the name of a program which will accept PostScript files. Thus, if you | |
440 | have a non-PostScript printer, you can set this variable to the name of | |
441 | a PostScript interpreter program (such as Ghostscript). Any switches | |
442 | that need to be passed to the interpreter program are specified using | |
443 | @code{ps-lpr-switches}. (If the value of @code{ps-printer-name} is a | |
444 | string, it will be added to the list of switches as the value for the | |
445 | @code{-P} option. This is probably only useful if you are using | |
446 | @code{lpr}, so when using an interpreter typically you would set | |
447 | @code{ps-printer-name} to something other than a string so it is | |
448 | ignored.) | |
ca2565b0 AI |
449 | |
450 | For example, to use Ghostscript for printing on an Epson printer | |
4251fcec | 451 | connected to the @samp{LPT2} port, put this in your @file{_emacs} file: |
ca2565b0 AI |
452 | |
453 | @example | |
9d9d68ed | 454 | (setq ps-printer-name t) ; Ghostscript doesn't understand -P |
ca2565b0 AI |
455 | (setq ps-lpr-command "c:/gs/gs386") |
456 | (setq ps-lpr-switches '("-q" "-dNOPAUSE" | |
457 | "-sDEVICE=epson" | |
458 | "-r240x72" | |
459 | "-sOutputFile=LPT2" | |
9d9d68ed | 460 | "-Ic:/gs")) |
ca2565b0 AI |
461 | @end example |
462 | ||
463 | @noindent | |
464 | (This assumes that Ghostscript is installed in the @file{"c:/gs"} | |
465 | directory.) | |
466 | ||
9d9d68ed AI |
467 | @vindex dos-printer |
468 | @vindex dos-ps-printer | |
469 | For backwards compatibility, the value of @code{dos-printer} | |
470 | (@code{dos-ps-printer}), if it has a value, overrides the value of | |
471 | @code{printer-name} (@code{ps-printer-name}), on MS-DOS and MS-Windows | |
472 | only. | |
473 | ||
474 | ||
ca2565b0 AI |
475 | @node MS-DOS and MULE |
476 | @section International Support on MS-DOS | |
477 | @cindex international support @r{(MS-DOS)} | |
478 | ||
479 | Emacs on MS-DOS supports the same international character sets as it | |
480 | does on Unix and other platforms (@pxref{International}), including | |
481 | coding systems for converting between the different character sets. | |
482 | However, due to incompatibilities between MS-DOS/MS-Windows and Unix, | |
483 | there are several DOS-specific aspects of this support that users should | |
484 | be aware of. This section describes these aspects. | |
485 | ||
486 | @table @kbd | |
487 | @item M-x dos-codepage-setup | |
488 | Set up Emacs display and coding systems as appropriate for the current | |
489 | DOS codepage. | |
490 | ||
491 | @item M-x codepage-setup | |
492 | Create a coding system for a certain DOS codepage. | |
493 | @end table | |
494 | ||
495 | @cindex codepage, MS-DOS | |
496 | @cindex DOS codepages | |
497 | MS-DOS is designed to support one character set of 256 characters at | |
498 | any given time, but gives you a variety of character sets to choose | |
499 | from. The alternative character sets are known as @dfn{DOS codepages}. | |
500 | Each codepage includes all 128 ASCII characters, but the other 128 | |
501 | characters (codes 128 through 255) vary from one codepage to another. | |
502 | Each DOS codepage is identified by a 3-digit number, such as 850, 862, | |
503 | etc. | |
504 | ||
505 | In contrast to X Windows, which lets you use several fonts at the same | |
506 | time, MS-DOS doesn't allow use of several codepages in a single session. | |
507 | Instead, MS-DOS loads a single codepage at system startup, and you must | |
508 | reboot MS-DOS to change it@footnote{Normally, one particular codepage is | |
509 | burnt into the display memory, while other codepages can be installed by | |
510 | modifying system configuration files, such as @file{CONFIG.SYS}, and | |
511 | rebooting.}. Much the same limitation applies when you run DOS | |
512 | executables on other systems such as MS-Windows. | |
513 | ||
514 | @cindex unibyte operation @r{(MS-DOS)} | |
515 | If you invoke Emacs on MS-DOS with the @samp{--unibyte} option | |
516 | (@pxref{Initial Options}), Emacs does not perform any conversion of | |
517 | non-ASCII characters. Instead, it reads and writes any non-ASCII | |
518 | characters verbatim, and sends their 8-bit codes to the display | |
519 | verbatim. Thus, unibyte Emacs on MS-DOS supports the current codepage, | |
520 | whatever it may be, but cannot even represent any other characters. | |
521 | ||
522 | @vindex dos-codepage | |
523 | For multibyte operation on MS-DOS, Emacs needs to know which | |
524 | characters the chosen DOS codepage can display. So it queries the | |
525 | system shortly after startup to get the chosen codepage number, and | |
526 | stores the number in the variable @code{dos-codepage}. Some systems | |
527 | return the default value 437 for the current codepage, even though the | |
528 | actual codepage is different. (This typically happens when you use the | |
529 | codepage built into the display hardware.) You can specify a different | |
530 | codepage for Emacs to use by setting the variable @code{dos-codepage} in | |
531 | your init file. | |
532 | ||
533 | @cindex language environment, automatic selection on @r{MS-DOS} | |
48870849 | 534 | Multibyte Emacs supports only certain DOS codepages: those which can |
36e20969 EZ |
535 | display Far-Eastern scripts, like the Japanese codepage 932, and those |
536 | that encode a single ISO 8859 character set. | |
537 | ||
538 | The Far-Eastern codepages can directly display one of the MULE | |
539 | character sets for these countries, so Emacs simply sets up to use the | |
540 | appropriate terminal coding system that is supported by the codepage. | |
541 | The special features described in the rest of this section mostly | |
542 | pertain to codepages that encode ISO 8859 character sets. | |
543 | ||
544 | For the codepages which correspond to one of the ISO character sets, | |
48870849 EZ |
545 | Emacs knows the character set name based on the codepage number. Emacs |
546 | automatically creates a coding system to support reading and writing | |
547 | files that use the current codepage, and uses this coding system by | |
548 | default. The name of this coding system is @code{cp@var{nnn}}, where | |
549 | @var{nnn} is the codepage number.@footnote{The standard Emacs coding | |
550 | systems for ISO 8859 are not quite right for the purpose, because | |
551 | typically the DOS codepage does not match the standard ISO character | |
552 | codes. For example, the letter @samp{@,{c}} (@samp{c} with cedilla) has | |
553 | code 231 in the standard Latin-1 character set, but the corresponding | |
554 | DOS codepage 850 uses code 135 for this glyph.} | |
ca2565b0 AI |
555 | |
556 | @cindex mode line @r{(MS-DOS)} | |
557 | All the @code{cp@var{nnn}} coding systems use the letter @samp{D} (for | |
558 | ``DOS'') as their mode-line mnemonic. Since both the terminal coding | |
559 | system and the default coding system for file I/O are set to the proper | |
560 | @code{cp@var{nnn}} coding system at startup, it is normal for the mode | |
561 | line on MS-DOS to begin with @samp{-DD\-}. @xref{Mode Line}. | |
36e20969 EZ |
562 | Far-Eastern DOS terminals do not use the @code{cp@var{nnn}} coding |
563 | systems, and thus their initial mode line looks like on Unix. | |
ca2565b0 AI |
564 | |
565 | Since the codepage number also indicates which script you are using, | |
566 | Emacs automatically runs @code{set-language-environment} to select the | |
567 | language environment for that script (@pxref{Language Environments}). | |
568 | ||
569 | If a buffer contains a character belonging to some other ISO 8859 | |
570 | character set, not the one that the chosen DOS codepage supports, Emacs | |
571 | displays it using a sequence of ASCII characters. For example, if the | |
572 | current codepage doesn't have a glyph for the letter @samp{@`o} (small | |
573 | @samp{o} with a grave accent), it is displayed as @samp{@{`o@}}, where | |
574 | the braces serve as a visual indication that this is a single character. | |
575 | (This may look awkward for some non-Latin characters, such as those from | |
576 | Greek or Hebrew alphabets, but it is still readable by a person who | |
577 | knows the language.) Even though the character may occupy several | |
578 | columns on the screen, it is really still just a single character, and | |
579 | all Emacs commands treat it as one. | |
580 | ||
581 | @vindex dos-unsupported-character-glyph | |
582 | Not all characters in DOS codepages correspond to ISO 8859 | |
583 | characters---some are used for other purposes, such as box-drawing | |
584 | characters and other graphics. Emacs cannot represent these characters | |
585 | internally, so when you read a file that uses these characters, they are | |
586 | converted into a particular character code, specified by the variable | |
587 | @code{dos-unsupported-character-glyph}. | |
588 | ||
589 | Emacs supports many other characters sets aside from ISO 8859, but it | |
590 | cannot display them on MS-DOS. So if one of these multibyte characters | |
01f767b7 EZ |
591 | appears in a buffer, Emacs on MS-DOS displays them as specified by the |
592 | @code{dos-unsupported-character-glyph} variable; by default, this glyph | |
593 | is an empty triangle. Use the @kbd{C-u C-x =} command to display the | |
594 | actual code and character set of such characters. @xref{Position Info}. | |
ca2565b0 AI |
595 | |
596 | @findex codepage-setup | |
597 | By default, Emacs defines a coding system to support the current | |
598 | codepage. To define a coding system for some other codepage (e.g., to | |
599 | visit a file written on a DOS machine in another country), use the | |
600 | @kbd{M-x codepage-setup} command. It prompts for the 3-digit code of | |
601 | the codepage, with completion, then creates the coding system for the | |
602 | specified codepage. You can then use the new coding system to read and | |
603 | write files, but you must specify it explicitly for the file command | |
604 | when you want to use it (@pxref{Specify Coding}). | |
605 | ||
606 | These coding systems are also useful for visiting a file encoded using | |
607 | a DOS codepage, using Emacs running on some other operating system. | |
608 | ||
609 | @node MS-DOS Processes | |
610 | @section Subprocesses on MS-DOS | |
611 | ||
612 | @cindex compilation under MS-DOS | |
613 | @cindex inferior processes under MS-DOS | |
614 | @findex compile @r{(MS-DOS)} | |
615 | @findex grep @r{(MS-DOS)} | |
616 | Because MS-DOS is a single-process ``operating system,'' | |
617 | asynchronous subprocesses are not available. In particular, Shell | |
618 | mode and its variants do not work. Most Emacs features that use | |
619 | asynchronous subprocesses also don't work on MS-DOS, including | |
620 | spelling correction and GUD. When in doubt, try and see; commands that | |
621 | don't work print an error message saying that asynchronous processes | |
622 | aren't supported. | |
623 | ||
624 | Compilation under Emacs with @kbd{M-x compile}, searching files with | |
625 | @kbd{M-x grep} and displaying differences between files with @kbd{M-x | |
626 | diff} do work, by running the inferior processes synchronously. This | |
627 | means you cannot do any more editing until the inferior process | |
628 | finishes. | |
629 | ||
630 | By contrast, Emacs compiled as native Windows application | |
631 | @strong{does} support asynchronous subprocesses. @xref{Windows | |
632 | Processes}. | |
633 | ||
634 | @cindex printing under MS-DOS | |
635 | Printing commands, such as @code{lpr-buffer} (@pxref{Hardcopy}) and | |
636 | @code{ps-print-buffer} (@pxref{Postscript}), work in MS-DOS by sending | |
637 | the output to one of the printer ports. @xref{MS-DOS Printing}. | |
638 | ||
639 | When you run a subprocess synchronously on MS-DOS, make sure the | |
640 | program terminates and does not try to read keyboard input. If the | |
641 | program does not terminate on its own, you will be unable to terminate | |
642 | it, because MS-DOS provides no general way to terminate a process. | |
643 | Pressing @kbd{C-c} or @kbd{C-@key{BREAK}} might sometimes help in these | |
644 | cases. | |
645 | ||
646 | Accessing files on other machines is not supported on MS-DOS. Other | |
647 | network-oriented commands such as sending mail, Web browsing, remote | |
648 | login, etc., don't work either, unless network access is built into | |
649 | MS-DOS with some network redirector. | |
650 | ||
651 | @cindex directory listing on MS-DOS | |
652 | @vindex dired-listing-switches @r{(MS-DOS)} | |
653 | Dired on MS-DOS uses the @code{ls-lisp} package where other | |
654 | platforms use the system @code{ls} command. Therefore, Dired on | |
655 | MS-DOS supports only some of the possible options you can mention in | |
656 | the @code{dired-listing-switches} variable. The options that work are | |
657 | @samp{-A}, @samp{-a}, @samp{-c}, @samp{-i}, @samp{-r}, @samp{-S}, | |
658 | @samp{-s}, @samp{-t}, and @samp{-u}. | |
659 | ||
660 | @node Windows Processes | |
661 | @section Subprocesses on Windows 95 and NT | |
662 | ||
663 | Emacs compiled as a native Windows application (as opposed to the DOS | |
664 | version) includes full support for asynchronous subprocesses. | |
665 | In the Windows version, synchronous and asynchronous subprocesses work | |
666 | fine on both | |
667 | Windows 95 and Windows NT as long as you run only 32-bit Windows | |
668 | applications. However, when you run a DOS application in a subprocess, | |
669 | you may encounter problems or be unable to run the application at all; | |
670 | and if you run two DOS applications at the same time in two | |
671 | subprocesses, you may have to reboot your system. | |
672 | ||
673 | Since the standard command interpreter (and most command line utilities) | |
674 | on Windows 95 are DOS applications, these problems are significant when | |
675 | using that system. But there's nothing we can do about them; only | |
676 | Microsoft can fix them. | |
677 | ||
678 | If you run just one DOS application subprocess, the subprocess should | |
679 | work as expected as long as it is ``well-behaved'' and does not perform | |
680 | direct screen access or other unusual actions. If you have a CPU | |
681 | monitor application, your machine will appear to be 100% busy even when | |
682 | the DOS application is idle, but this is only an artifact of the way CPU | |
683 | monitors measure processor load. | |
684 | ||
685 | You must terminate the DOS application before you start any other DOS | |
686 | application in a different subprocess. Emacs is unable to interrupt or | |
687 | terminate a DOS subprocess. The only way you can terminate such a | |
688 | subprocess is by giving it a command that tells its program to exit. | |
689 | ||
690 | If you attempt to run two DOS applications at the same time in separate | |
691 | subprocesses, the second one that is started will be suspended until the | |
692 | first one finishes, even if either or both of them are asynchronous. | |
693 | ||
694 | If you can go to the first subprocess, and tell it to exit, the second | |
695 | subprocess should continue normally. However, if the second subprocess | |
696 | is synchronous, Emacs itself will be hung until the first subprocess | |
697 | finishes. If it will not finish without user input, then you have no | |
698 | choice but to reboot if you are running on Windows 95. If you are | |
699 | running on Windows NT, you can use a process viewer application to kill | |
700 | the appropriate instance of ntvdm instead (this will terminate both DOS | |
701 | subprocesses). | |
702 | ||
703 | If you have to reboot Windows 95 in this situation, do not use the | |
704 | @code{Shutdown} command on the @code{Start} menu; that usually hangs the | |
705 | system. Instead, type @kbd{CTL-ALT-@key{DEL}} and then choose | |
706 | @code{Shutdown}. That usually works, although it may take a few minutes | |
707 | to do its job. | |
708 | ||
709 | @node Windows System Menu | |
710 | @section Using the System Menu on Windows | |
711 | ||
712 | Emacs compiled as a native Windows application normally turns off the | |
713 | Windows feature that tapping the @key{ALT} | |
714 | key invokes the Windows menu. The reason is that the @key{ALT} also | |
715 | serves as @key{META} in Emacs. When using Emacs, users often press the | |
716 | @key{META} key temporarily and then change their minds; if this has the | |
717 | effect of bringing up the Windows menu, it alters the meaning of | |
718 | subsequent commands. Many users find this frustrating. | |
719 | ||
720 | @vindex w32-pass-alt-to-system | |
721 | You can reenable Windows's default handling of tapping the @key{ALT} key | |
722 | by setting @code{w32-pass-alt-to-system} to a non-@code{nil} value. | |
723 |