]> code.delx.au - gnu-emacs/blob - man/msdog.texi
Sync with Tramp 2.0.53.
[gnu-emacs] / man / msdog.texi
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
3 @c 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4 @c See file emacs.texi for copying conditions.
5 @node Emacs and Microsoft Windows, Manifesto, Mac OS, Top
6 @appendix Emacs and Microsoft Windows
7 @cindex Microsoft Windows
8
9 This section describes peculiarities of using Emacs on Microsoft
10 Windows. Information about Emacs and Microsoft's older MS-DOS
11 ``operating system'' (also known as ``MS-DOG'') is now in a separate
12 manual (@inforef{MS-DOG,, emacs-xtra}).
13
14 Iif you want to use Emacs on Windows, you would normally build Emacs
15 specifically for Windows. If you do that, the behavior is reasonably
16 similar to what is documented in the rest of the manual, including
17 support for long file names, multiple frames, scroll bars, mouse
18 menus, and subprocesses. However, a few special considerations apply,
19 and they are described here.
20
21 @menu
22 * Text and Binary:: Text files use CRLF to terminate lines.
23 * Windows Processes:: Running subprocesses on Windows.
24 * Windows System Menu:: Controlling what the ALT key does.
25 @end menu
26
27 @node Text and Binary
28 @section Text Files and Binary Files
29 @cindex text and binary files on MS-DOS/MS-Windows
30
31 GNU Emacs uses newline characters to separate text lines. This is the
32 convention used on GNU and Unix.
33
34 @cindex end-of-line conversion on MS-DOS/MS-Windows
35 MS-DOS and MS-Windows normally use carriage-return linefeed, a
36 two-character sequence, to separate text lines. (Linefeed is the same
37 character as newline.) Therefore, convenient editing of typical files
38 with Emacs requires conversion of these end-of-line (EOL) sequences.
39 And that is what Emacs normally does: it converts carriage-return
40 linefeed into newline when reading files, and converts newline into
41 carriage-return linefeed when writing files. The same mechanism that
42 handles conversion of international character codes does this conversion
43 also (@pxref{Coding Systems}).
44
45 @cindex cursor location, on MS-DOS
46 @cindex point location, on MS-DOS
47 One consequence of this special format-conversion of most files is
48 that character positions as reported by Emacs (@pxref{Position Info}) do
49 not agree with the file size information known to the operating system.
50
51 In addition, if Emacs recognizes from a file's contents that it uses
52 newline rather than carriage-return linefeed as its line separator, it
53 does not perform EOL conversion when reading or writing that file.
54 Thus, you can read and edit files from GNU and Unix systems on MS-DOS
55 with no special effort, and they will retain their Unix-style
56 end-of-line convention after you edit them.
57
58 The mode line indicates whether end-of-line translation was used for
59 the current buffer. If MS-DOS end-of-line translation is in use for the
60 buffer, a backslash @samp{\} is displayed after the coding system
61 mnemonic near the beginning of the mode line (@pxref{Mode Line}). If no
62 EOL translation was performed, the string @samp{(Unix)} is displayed
63 instead of the backslash, to alert you that the file's EOL format is not
64 the usual carriage-return linefeed.
65
66 @cindex DOS-to-Unix conversion of files
67 To visit a file and specify whether it uses DOS-style or Unix-style
68 end-of-line, specify a coding system (@pxref{Text Coding}). For
69 example, @kbd{C-x @key{RET} c unix @key{RET} C-x C-f foobar.txt}
70 visits the file @file{foobar.txt} without converting the EOLs; if some
71 line ends with a carriage-return linefeed pair, Emacs will display
72 @samp{^M} at the end of that line. Similarly, you can direct Emacs to
73 save a buffer in a specified EOL format with the @kbd{C-x @key{RET} f}
74 command. For example, to save a buffer with Unix EOL format, type
75 @kbd{C-x @key{RET} f unix @key{RET} C-x C-s}. If you visit a file
76 with DOS EOL conversion, then save it with Unix EOL format, that
77 effectively converts the file to Unix EOL style, like @code{dos2unix}.
78
79 @cindex untranslated file system
80 @findex add-untranslated-filesystem
81 When you use NFS or Samba to access file systems that reside on
82 computers using GNU or Unix systems, Emacs should not perform
83 end-of-line translation on any files in these file systems---not even
84 when you create a new file. To request this, designate these file
85 systems as @dfn{untranslated} file systems by calling the function
86 @code{add-untranslated-filesystem}. It takes one argument: the file
87 system name, including a drive letter and optionally a directory. For
88 example,
89
90 @example
91 (add-untranslated-filesystem "Z:")
92 @end example
93
94 @noindent
95 designates drive Z as an untranslated file system, and
96
97 @example
98 (add-untranslated-filesystem "Z:\\foo")
99 @end example
100
101 @noindent
102 designates directory @file{\foo} on drive Z as an untranslated file
103 system.
104
105 Most often you would use @code{add-untranslated-filesystem} in your
106 @file{_emacs} file, or in @file{site-start.el} so that all the users at
107 your site get the benefit of it.
108
109 @findex remove-untranslated-filesystem
110 To countermand the effect of @code{add-untranslated-filesystem}, use
111 the function @code{remove-untranslated-filesystem}. This function takes
112 one argument, which should be a string just like the one that was used
113 previously with @code{add-untranslated-filesystem}.
114
115 Designating a file system as untranslated does not affect character
116 set conversion, only end-of-line conversion. Essentially, it directs
117 Emacs to create new files with the Unix-style convention of using
118 newline at the end of a line. @xref{Coding Systems}.
119
120 @vindex file-name-buffer-file-type-alist
121 @cindex binary files, on MS-DOS/MS-Windows
122 Some kinds of files should not be converted at all, because their
123 contents are not really text. Therefore, Emacs on MS-DOS distinguishes
124 certain files as @dfn{binary files}. (This distinction is not part of
125 MS-DOS; it is made by Emacs only.) Binary files include executable
126 programs, compressed archives, etc. Emacs uses the file name to decide
127 whether to treat a file as binary: the variable
128 @code{file-name-buffer-file-type-alist} defines the file-name patterns
129 that indicate binary files. If a file name matches one of the patterns
130 for binary files (those whose associations are of the type
131 @code{(@var{pattern} . t)}, Emacs reads and writes that file using the
132 @code{no-conversion} coding system (@pxref{Coding Systems}) which turns
133 off @emph{all} coding-system conversions, not only the EOL conversion.
134 @code{file-name-buffer-file-type-alist} also includes file-name patterns
135 for files which are known to be DOS-style text files with
136 carriage-return linefeed EOL format, such as @file{CONFIG.SYS}; Emacs
137 always writes those files with DOS-style EOLs.
138
139 If a file which belongs to an untranslated file system matches one of
140 the file-name patterns in @code{file-name-buffer-file-type-alist}, the
141 EOL conversion is determined by @code{file-name-buffer-file-type-alist}.
142
143 @node Windows Processes
144 @section Subprocesses on Windows 9X/ME and Windows NT/2K
145
146 Emacs compiled as a native Windows application (as opposed to the DOS
147 version) includes full support for asynchronous subprocesses.
148 In the Windows version, synchronous and asynchronous subprocesses work
149 fine on both
150 Windows 9X and Windows NT/2K as long as you run only 32-bit Windows
151 applications. However, when you run a DOS application in a subprocess,
152 you may encounter problems or be unable to run the application at all;
153 and if you run two DOS applications at the same time in two
154 subprocesses, you may have to reboot your system.
155
156 Since the standard command interpreter (and most command line utilities)
157 on Windows 95 are DOS applications, these problems are significant when
158 using that system. But there's nothing we can do about them; only
159 Microsoft can fix them.
160
161 If you run just one DOS application subprocess, the subprocess should
162 work as expected as long as it is ``well-behaved'' and does not perform
163 direct screen access or other unusual actions. If you have a CPU
164 monitor application, your machine will appear to be 100% busy even when
165 the DOS application is idle, but this is only an artifact of the way CPU
166 monitors measure processor load.
167
168 You must terminate the DOS application before you start any other DOS
169 application in a different subprocess. Emacs is unable to interrupt or
170 terminate a DOS subprocess. The only way you can terminate such a
171 subprocess is by giving it a command that tells its program to exit.
172
173 If you attempt to run two DOS applications at the same time in separate
174 subprocesses, the second one that is started will be suspended until the
175 first one finishes, even if either or both of them are asynchronous.
176
177 If you can go to the first subprocess, and tell it to exit, the second
178 subprocess should continue normally. However, if the second subprocess
179 is synchronous, Emacs itself will be hung until the first subprocess
180 finishes. If it will not finish without user input, then you have no
181 choice but to reboot if you are running on Windows 9X. If you are
182 running on Windows NT/2K, you can use a process viewer application to kill
183 the appropriate instance of ntvdm instead (this will terminate both DOS
184 subprocesses).
185
186 If you have to reboot Windows 9X in this situation, do not use the
187 @code{Shutdown} command on the @code{Start} menu; that usually hangs the
188 system. Instead, type @kbd{CTL-ALT-@key{DEL}} and then choose
189 @code{Shutdown}. That usually works, although it may take a few minutes
190 to do its job.
191
192 @node Windows System Menu
193 @section Using the System Menu on Windows
194
195 Emacs compiled as a native Windows application normally turns off the
196 Windows feature that tapping the @key{ALT}
197 key invokes the Windows menu. The reason is that the @key{ALT} also
198 serves as @key{META} in Emacs. When using Emacs, users often press the
199 @key{META} key temporarily and then change their minds; if this has the
200 effect of bringing up the Windows menu, it alters the meaning of
201 subsequent commands. Many users find this frustrating.
202
203 @vindex w32-pass-alt-to-system
204 You can re-enable Windows' default handling of tapping the @key{ALT} key
205 by setting @code{w32-pass-alt-to-system} to a non-@code{nil} value.
206
207 @ignore
208 arch-tag: f39d2590-5dcc-4318-88d9-0eb73ca10fa2
209 @end ignore