* international/mule-diag.el (mule-diag): Display the window
[bpt/emacs.git] / doc / emacs / msdog.texi
CommitLineData
ca2565b0 1@c This is part of the Emacs manual.
b65d8176 2@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
3f548a7c 3@c 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
ca2565b0 4@c See file emacs.texi for copying conditions.
e93bc142 5@node Microsoft Windows, Manifesto, Mac OS / GNUstep, Top
5798efc8 6@appendix Emacs and Microsoft Windows/MS-DOS
c6b30bd2 7@cindex Microsoft Windows
270c6692 8@cindex MS-Windows, Emacs peculiarities
ca2565b0 9
e691d082 10 This section describes peculiarities of using Emacs on Microsoft
270c6692
EZ
11Windows. Some of these peculiarities are also relevant to Microsoft's
12older MS-DOS ``operating system'' (also known as ``MS-DOG'').
13However, Emacs features that are relevant @emph{only} to MS-DOS are
5798efc8
EZ
14described in a separate
15@iftex
9dc999d3 16manual (@pxref{MS-DOS,,, emacs-xtra, Specialized Emacs Features}).
5798efc8
EZ
17@end iftex
18@ifnottex
19section (@pxref{MS-DOS}).
20@end ifnottex
21
ca2565b0 22
270c6692
EZ
23 The behavior of Emacs on MS-Windows is reasonably similar to what is
24documented in the rest of the manual, including support for long file
25names, multiple frames, scroll bars, mouse menus, and subprocesses.
26However, a few special considerations apply, and they are described
27here.
ca2565b0
AI
28
29@menu
5798efc8
EZ
30* Text and Binary:: Text files use CRLF to terminate lines.
31* Windows Files:: File-name conventions on Windows.
9974630f 32* ls in Lisp:: Emulation of @code{ls} for Dired.
5798efc8 33* Windows HOME:: Where Emacs looks for your @file{.emacs}.
5a3e3201 34* Windows Keyboard:: Windows-specific keyboard features.
37a75312 35* Windows Mouse:: Windows-specific mouse features.
5798efc8
EZ
36* Windows Processes:: Running subprocesses on Windows.
37* Windows Printing:: How to specify the printer on MS-Windows.
03bebefc 38* Windows Fonts:: Specifying fonts on MS-Windows.
37a75312 39* Windows Misc:: Miscellaneous Windows features.
5798efc8
EZ
40@ifnottex
41* MS-DOS:: Using Emacs on MS-DOS (otherwise known as @dfn{MS-DOG}).
42@end ifnottex
ca2565b0
AI
43@end menu
44
ca2565b0
AI
45@node Text and Binary
46@section Text Files and Binary Files
47@cindex text and binary files on MS-DOS/MS-Windows
48
49 GNU Emacs uses newline characters to separate text lines. This is the
270c6692 50convention used on GNU, Unix, and other Posix-compliant systems.
ca2565b0
AI
51
52@cindex end-of-line conversion on MS-DOS/MS-Windows
270c6692
EZ
53 By contrast, MS-DOS and MS-Windows normally use carriage-return linefeed,
54a two-character sequence, to separate text lines. (Linefeed is the same
ca2565b0
AI
55character as newline.) Therefore, convenient editing of typical files
56with Emacs requires conversion of these end-of-line (EOL) sequences.
57And that is what Emacs normally does: it converts carriage-return
58linefeed into newline when reading files, and converts newline into
59carriage-return linefeed when writing files. The same mechanism that
60handles conversion of international character codes does this conversion
61also (@pxref{Coding Systems}).
62
1ca54e68
EZ
63@cindex cursor location, on MS-DOS
64@cindex point location, on MS-DOS
ca2565b0
AI
65 One consequence of this special format-conversion of most files is
66that character positions as reported by Emacs (@pxref{Position Info}) do
67not agree with the file size information known to the operating system.
68
ca2565b0
AI
69 In addition, if Emacs recognizes from a file's contents that it uses
70newline rather than carriage-return linefeed as its line separator, it
8e375db2
RS
71does not perform EOL conversion when reading or writing that file.
72Thus, you can read and edit files from GNU and Unix systems on MS-DOS
73with no special effort, and they will retain their Unix-style
74end-of-line convention after you edit them.
ca2565b0 75
ca2565b0 76 The mode line indicates whether end-of-line translation was used for
1ca54e68 77the current buffer. If MS-DOS end-of-line translation is in use for the
270c6692
EZ
78buffer, the MS-Windows build of Emacs displays a backslash @samp{\} after
79the coding system mnemonic near the beginning of the mode line
80(@pxref{Mode Line}). If no EOL translation was performed, the string
81@samp{(Unix)} is displayed instead of the backslash, to alert you that the
82file's EOL format is not the usual carriage-return linefeed.
1ca54e68
EZ
83
84@cindex DOS-to-Unix conversion of files
8e375db2 85 To visit a file and specify whether it uses DOS-style or Unix-style
fef4d6a6 86end-of-line, specify a coding system (@pxref{Text Coding}). For
8e375db2
RS
87example, @kbd{C-x @key{RET} c unix @key{RET} C-x C-f foobar.txt}
88visits the file @file{foobar.txt} without converting the EOLs; if some
89line ends with a carriage-return linefeed pair, Emacs will display
90@samp{^M} at the end of that line. Similarly, you can direct Emacs to
91save a buffer in a specified EOL format with the @kbd{C-x @key{RET} f}
92command. For example, to save a buffer with Unix EOL format, type
93@kbd{C-x @key{RET} f unix @key{RET} C-x C-s}. If you visit a file
94with DOS EOL conversion, then save it with Unix EOL format, that
95effectively converts the file to Unix EOL style, like @code{dos2unix}.
ca2565b0
AI
96
97@cindex untranslated file system
98@findex add-untranslated-filesystem
270c6692
EZ
99 When you use NFS, Samba, or some other similar method to access file
100systems that reside on computers using GNU or Unix systems, Emacs
101should not perform end-of-line translation on any files in these file
102systems---not even when you create a new file. To request this,
103designate these file systems as @dfn{untranslated} file systems by
104calling the function @code{add-untranslated-filesystem}. It takes one
105argument: the file system name, including a drive letter and
106optionally a directory. For example,
ca2565b0
AI
107
108@example
109(add-untranslated-filesystem "Z:")
110@end example
111
112@noindent
113designates drive Z as an untranslated file system, and
114
115@example
116(add-untranslated-filesystem "Z:\\foo")
117@end example
118
119@noindent
120designates directory @file{\foo} on drive Z as an untranslated file
121system.
122
123 Most often you would use @code{add-untranslated-filesystem} in your
270c6692 124@file{.emacs} file, or in @file{site-start.el} so that all the users at
ca2565b0
AI
125your site get the benefit of it.
126
127@findex remove-untranslated-filesystem
128 To countermand the effect of @code{add-untranslated-filesystem}, use
129the function @code{remove-untranslated-filesystem}. This function takes
130one argument, which should be a string just like the one that was used
131previously with @code{add-untranslated-filesystem}.
132
8e375db2
RS
133 Designating a file system as untranslated does not affect character
134set conversion, only end-of-line conversion. Essentially, it directs
135Emacs to create new files with the Unix-style convention of using
136newline at the end of a line. @xref{Coding Systems}.
1ca54e68
EZ
137
138@vindex file-name-buffer-file-type-alist
139@cindex binary files, on MS-DOS/MS-Windows
140 Some kinds of files should not be converted at all, because their
270c6692 141contents are not really text. Therefore, Emacs on MS-Windows distinguishes
1ca54e68 142certain files as @dfn{binary files}. (This distinction is not part of
270c6692 143MS-Windows; it is made by Emacs only.) Binary files include executable
1ca54e68
EZ
144programs, compressed archives, etc. Emacs uses the file name to decide
145whether to treat a file as binary: the variable
146@code{file-name-buffer-file-type-alist} defines the file-name patterns
147that indicate binary files. If a file name matches one of the patterns
148for binary files (those whose associations are of the type
149@code{(@var{pattern} . t)}, Emacs reads and writes that file using the
150@code{no-conversion} coding system (@pxref{Coding Systems}) which turns
151off @emph{all} coding-system conversions, not only the EOL conversion.
152@code{file-name-buffer-file-type-alist} also includes file-name patterns
270c6692 153for files which are known to be Windows-style text files with
1ca54e68 154carriage-return linefeed EOL format, such as @file{CONFIG.SYS}; Emacs
270c6692 155always writes those files with Windows-style EOLs.
1ca54e68
EZ
156
157 If a file which belongs to an untranslated file system matches one of
158the file-name patterns in @code{file-name-buffer-file-type-alist}, the
159EOL conversion is determined by @code{file-name-buffer-file-type-alist}.
160
270c6692
EZ
161@node Windows Files
162@section File Names on MS-Windows
163@cindex file names on MS-Windows
164
165 MS-Windows and MS-DOS normally use a backslash, @samp{\}, to
166separate name units within a file name, instead of the slash used on
167other systems. Emacs on MS-DOS/MS-Windows permits use of either slash or
168backslash, and also knows about drive letters in file names.
169
170@cindex file-name completion, on MS-Windows
171 On MS-DOS/MS-Windows, file names are case-insensitive, so Emacs by
172default ignores letter-case in file names during completion.
173
37a75312 174@vindex w32-get-true-file-attributes
6af511e3
EZ
175 The variable @code{w32-get-true-file-attributes} controls whether
176Emacs should issue additional system calls to determine more
177accurately file attributes in primitives like @code{file-attributes}
178and @code{directory-files-and-attributes}. These additional calls are
179needed to report correct file ownership, link counts and file types
180for special files such as pipes. Without these system calls, file
181ownership will be attributed to the current user, link counts will be
182always reported as 1, and special files will be reported as regular
183files.
184
185 If the value of this variable is @code{local} (the default), Emacs
186will issue these additional system calls only for files on local fixed
187drives. Any other non-@code{nil} value means do this even for
188removable and remote volumes, where this could potentially slow down
189Dired and other related features. The value of @code{nil} means never
190issue those system calls. Non-@code{nil} values are only useful on
191NTFS volumes, which support hard links and file security.
37a75312 192
9974630f
EZ
193@node ls in Lisp
194@section Emulation of @code{ls} on MS-Windows
195@cindex Dired, and MS-Windows/MS-DOS
196@cindex @code{ls} emulation
197
198 Dired normally uses the external program @code{ls} (or its close
199work-alike) to produce the directory listing displayed in Dired
200buffers (@pxref{Dired}). However, MS-Windows and MS-DOS systems don't
201come with such a program, although several ports of @sc{gnu} @code{ls}
202are available. Therefore, Emacs on those systems @emph{emulates}
203@code{ls} in Lisp, by using the @file{ls-lisp.el} package. While
204@file{ls-lisp.el} provides a reasonably full emulation of @code{ls},
7d0a2d30
EZ
205there are some options and features peculiar to that emulation;
206@iftex
207for more details, see the documentation of the variables whose names
208begin with @code{ls-lisp}.
209@end iftex
210@ifnottex
211they are described in this section.
9974630f
EZ
212
213 The @code{ls} emulation supports many of the @code{ls} switches, but
214it doesn't support all of them. Here's the list of the switches it
215does support: @option{-A}, @option{-a}, @option{-B}, @option{-C},
216@option{-c}, @option{-i}, @option{-G}, @option{-g}, @option{-R},
217@option{-r}, @option{-S}, @option{-s}, @option{-t}, @option{-U},
218@option{-u}, and @option{-X}. The @option{-F} switch is partially
219supported (it appends the character that classifies the file, but does
220not prevent symlink following).
221
222@vindex ls-lisp-use-insert-directory-program
223 On MS-Windows and MS-DOS, @file{ls-lisp.el} is preloaded when Emacs
224is built, so the Lisp emulation of @code{ls} is always used on those
225platforms. If you have a ported @code{ls}, setting
226@code{ls-lisp-use-insert-directory-program} to a non-@code{nil} value
227will revert to using an external program named by the variable
228@code{insert-directory-program}.
229
230@vindex ls-lisp-ignore-case
231 By default, @file{ls-lisp.el} uses a case-sensitive sort order for
232the directory listing it produces; this is so the listing looks the
233same as on other platforms. If you wish that the files be sorted in
234case-insensitive order, set the variable @code{ls-lisp-ignore-case} to
235a non-@code{nil} value.
236
237@vindex ls-lisp-dirs-first
238 By default, files and subdirectories are sorted together, to emulate
239the behavior of @code{ls}. However, native MS-Windows/MS-DOS file
240managers list the directories before the files; if you want that
241behavior, customize the option @code{ls-lisp-dirs-first} to a
242non-@code{nil} value.
243
244@vindex ls-lisp-verbosity
245 The variable @code{ls-lisp-verbosity} controls the file attributes
246that @file{ls-lisp.el} displays. The value should be a list that
247contains one or more of the symbols @code{links}, @code{uid}, and
248@code{gid}. @code{links} means display the count of different file
249names that are associated with (a.k.a.@: @dfn{links to}) the file's
75099884
EZ
250data; this is only useful on NTFS volumes. @code{uid} means display
251the numerical identifier of the user who owns the file. @code{gid}
252means display the numerical identifier of the file owner's group. The
253default value is @code{(links uid gid)} i.e.@: all the 3 optional
254attributes are displayed.
9974630f
EZ
255
256@vindex ls-lisp-emulation
257 The variable @code{ls-lisp-emulation} controls the flavour of the
258@code{ls} emulation by setting the defaults for the 3 options
259described above: @code{ls-lisp-ignore-case},
260@code{ls-lisp-dirs-first}, and @code{ls-lisp-verbosity}. The value of
261this option can be one of the following symbols:
262
263@table @code
264@item GNU
265@itemx nil
266Emulate @sc{gnu} systems; this is the default. This sets
267@code{ls-lisp-ignore-case} and @code{ls-lisp-dirs-first} to
268@code{nil}, and @code{ls-lisp-verbosity} to @code{(links uid gid)}.
269@item UNIX
270Emulate Unix systems. Like @code{GNU}, but sets
271@code{ls-lisp-verbosity} to @code{(links uid)}.
272@item MacOS
273Emulate MacOS. Sets @code{ls-lisp-ignore-case} to @code{t}, and
274@code{ls-lisp-dirs-first} and @code{ls-lisp-verbosity} to @code{nil}.
275@item MS-Windows
276Emulate MS-Windows. Sets @code{ls-lisp-ignore-case} and
277@code{ls-lisp-dirs-first} to @code{t}, and @code{ls-lisp-verbosity} to
278@code{(links)} on Windows NT/2K/XP/2K3 and to @code{nil} on Windows 9X.
279Note that the default emulation is @emph{not} @code{MS-Windows}, even
280on Windows, since many users of Emacs on those platforms prefer the
281@sc{gnu} defaults.
282@end table
283
284@noindent
285Any other value of @code{ls-lisp-emulation} means the same as
286@code{GNU}. Note that this option needs to be set @emph{before}
287@file{ls-lisp.el} is loaded, which means that on MS-Windows and MS-DOS
288you will have to set the value from your @file{.emacs} file and then
289restart Emacs, since @file{ls-lisp.el} is preloaded.
290
291@vindex ls-lisp-support-shell-wildcards
292 The variable @code{ls-lisp-support-shell-wildcards} controls how
293file-name patterns are supported: if it is non-@code{nil} (the
294default), they are treated as shell-style wildcards; otherwise they
295are treated as Emacs regular expressions.
de320775
EZ
296
297@vindex ls-lisp-format-time-list
298 The variable @code{ls-lisp-format-time-list} defines how to format
299the date and time of files. @emph{The value of this variable is
300ignored}, unless Emacs cannot determine the current locale. (However,
301if the value of @code{ls-lisp-use-localized-time-format} is
302non-@code{nil}, Emacs obeys @code{ls-lisp-format-time-list} even if
303the current locale is available; see below.)
304
305The value of @code{ls-lisp-format-time-list} is a list of 2 strings.
306The first string is used if the file was modified within the current
307year, while the second string is used for older files. In each of
308these two strings you can use @samp{%}-sequences to substitute parts
309of the time. For example:
310@lisp
311("%b %e %H:%M" "%b %e %Y")
312@end lisp
313
314@noindent
315Note that the strings substituted for these @samp{%}-sequences depend
316on the current locale. @xref{Time Parsing,,, elisp, The Emacs Lisp
317Reference Manual}, for more about format time specs.
318
319@vindex ls-lisp-use-localized-time-format
320 Normally, Emacs formats the file time stamps in either traditional
321or ISO-style time format. However, if the value of the variable
322@code{ls-lisp-use-localized-time-format} is non-@code{nil}, Emacs
323formats file time stamps according to what
324@code{ls-lisp-format-time-list} specifies. The @samp{%}-sequences in
325@code{ls-lisp-format-time-list} produce locale-dependent month and day
326names, which might cause misalignment of columns in Dired display.
7d0a2d30 327@end ifnottex
9974630f 328
270c6692
EZ
329@node Windows HOME
330@section HOME Directory on MS-Windows
331@cindex @code{HOME} directory on MS-Windows
332
444246ca 333 The Windows equivalent of the @code{HOME} directory is the
270c6692
EZ
334@dfn{user-specific application data directory}. The actual location
335depends on your Windows version and system configuration; typical values
336are @file{C:\Documents and Settings\@var{username}\Application Data} on
337Windows 2K/XP and later, and either @file{C:\WINDOWS\Application Data}
338or @file{C:\WINDOWS\Profiles\@var{username}\Application Data} on the
339older Windows 9X/ME systems.
340
341@cindex init file @file{.emacs} on MS-Windows
342 The home directory is where your init file @file{.emacs} is stored.
343When Emacs starts, it first checks whether the environment variable
344@env{HOME} is set. If it is, it looks for the init file in the
345directory pointed by @env{HOME}. If @env{HOME} is not defined, Emacs
346checks for an existing @file{.emacs} file in @file{C:\}, the root
347directory of drive @file{C:}@footnote{
03bebefc
JR
348The check in @file{C:\} is for compatibility with older versions of Emacs,
349which didn't check the application data directory.
270c6692
EZ
350}. If there's no such file in @file{C:\}, Emacs next uses the Windows
351system calls to find out the exact location of your application data
03bebefc 352directory. If that system call fails, Emacs falls back to @file{C:\}.
270c6692
EZ
353
354 Whatever the final place is, Emacs sets the value of the @env{HOME}
355environment variable to point to it, and it will use that location for
356other files and directories it normally creates in the user's home
357directory.
358
359 You can always find out where Emacs thinks is your home directory's
360location by typing @kbd{C-x d ~/ @key{RET}}. This should present the
361list of files in the home directory, and show its full name on the
362first line. Likewise, to visit your init file, type @kbd{C-x C-f
363~/.emacs @key{RET}}.
364
365@cindex @file{_emacs} init file, MS-Windows
366 Because MS-DOS does not allow file names with leading dots, and
367because older Windows systems made it hard to create files with such
368names, the Windows port of Emacs supports an alternative name
369@file{_emacs} as a fallback, if such a file exists in the home
370directory, whereas @file{.emacs} does not.
371
5a3e3201
EZ
372@node Windows Keyboard
373@section Keyboard Usage on MS-Windows
374@cindex keyboard, MS-Windows
375
376 This section describes the Windows-specific features related to
377keyboard input in Emacs.
378
e7379492 379@cindex MS-Windows keyboard shortcuts
668ef058
RS
380 Many key combinations (known as ``keyboard shortcuts'') that have
381conventional uses in MS-Windows programs conflict with traditional
51524f43
RS
382Emacs key bindings. (These Emacs key bindings were established years
383before Microsoft was founded.) Examples of conflicts include
384@kbd{C-c}, @kbd{C-x}, @kbd{C-z}, @kbd{C-a}, and @kbd{W-@key{SPC}}.
385You can redefine some of them with meanings more like the MS-Windows
386meanings by enabling CUA Mode (@pxref{CUA Bindings}).
e7379492 387
5a3e3201
EZ
388@kindex F10 @r{(MS-Windows)}
389@cindex menu bar access using keyboard @r{(MS-Windows)}
390 The @key{F10} key on Windows activates the menu bar in a way that
391makes it possible to use the menus without a mouse. In this mode, the
392arrow keys traverse the menus, @key{RET} selects a highlighted menu
393item, and @key{ESC} closes the menu.
394
a210f8e6
EZ
395@iftex
396@inforef{Windows Keyboard, , emacs}, for information about additional
397Windows-specific variables in this category.
398@end iftex
7d0a2d30 399@ifnottex
5a3e3201
EZ
400@vindex w32-alt-is-meta
401@cindex @code{Alt} key (MS-Windows)
402 By default, the key labeled @key{Alt} is mapped as the @key{META}
403key. If you wish it to produce the @code{Alt} modifier instead, set
404the variable @code{w32-alt-is-meta} to a @code{nil} value.
405
71ce5fd0
JB
406@findex w32-register-hot-key
407@findex w32-unregister-hot-key
2be6bfe2
EZ
408 MS-Windows reserves certain key combinations, such as
409@kbd{Alt-@key{TAB}}, for its own use. These key combinations are
410intercepted by the system before Emacs can see them. You can use the
411@code{w32-register-hot-key} function to allow a key sequence to be
412seen by Emacs instead of being grabbed by Windows. This functions
413registers a key sequence as a @dfn{hot key}, overriding the special
414meaning of that key sequence for Windows. (MS-Windows is told that
415the key sequence is a hot key only when one of the Emacs windows has
416focus, so that the special keys still have their usual meaning for
417other Windows applications.)
418
419 The argument to @code{w32-register-hot-key} must be a single key,
420with or without modifiers, in vector form that would be acceptable to
421@code{define-key}. The meta modifier is interpreted as the @key{ALT}
422key if @code{w32-alt-is-meta} is @code{t} (the default), and the hyper
423modifier is always interpreted as the Windows key (usually labeled
424with @key{start} and the Windows logo). If the function succeeds in
425registering the key sequence, it returns the hotkey ID, a number;
426otherwise it returns @code{nil}.
427
428@kindex M-TAB@r{, (MS-Windows)}
71ce5fd0
JB
429@cindex @kbd{M-@key{TAB}} vs @kbd{Alt-@key{TAB}} (MS-Windows)
430@cindex @kbd{Alt-@key{TAB}} vs @kbd{M-@key{TAB}} (MS-Windows)
431 For example, @code{(w32-register-hot-key [M-tab])} lets you use
2be6bfe2
EZ
432@kbd{M-TAB} normally in Emacs, for instance, to complete the word or
433symbol at point at top level, or to complete the current search string
434against previously sought strings during incremental search.
435
436 The function @code{w32-unregister-hot-key} reverses the effect of
437@code{w32-register-hot-key} for its argument key sequence.
71ce5fd0 438
5a3e3201
EZ
439@vindex w32-capslock-is-shiftlock
440 By default, the @key{CapsLock} key only affects normal character
441keys (it converts lower-case characters to their upper-case
442variants). However, if you set the variable
443@code{w32-capslock-is-shiftlock} to a non-@code{nil} value, the
444@key{CapsLock} key will affect non-character keys as well, as if you
445pressed the @key{Shift} key while typing the non-character key.
446
447@vindex w32-enable-caps-lock
448 If the variable @code{w32-enable-caps-lock} is set to a @code{nil}
449value, the @key{CapsLock} key produces the symbol @code{capslock}
450instead of the shifted version of they keys. The default value is
451@code{t}.
452
453@vindex w32-enable-num-lock
454@cindex keypad keys (MS-Windows)
455 Similarly, if @code{w32-enable-num-lock} is @code{nil}, the
456@key{NumLock} key will produce the symbol @code{kp-numlock}. The
457default is @code{t}, which causes @key{NumLock} to work as expected:
458toggle the meaning of the keys on the numeric keypad.
7d0a2d30 459@end ifnottex
5a3e3201 460
3a9d9327
EZ
461@vindex w32-apps-modifier
462 The variable @code{w32-apps-modifier} controls the effect of the
463@key{Apps} key (usually located between the right @key{Alt} and the
464right @key{Ctrl} keys). Its value can be one of the symbols
465@code{hyper}, @code{super}, @code{meta}, @code{alt}, @code{control},
466or @code{shift} for the respective modifier, or @code{nil} to appear
467as the key @code{apps}. The default is @code{nil}.
468
5a3e3201
EZ
469@vindex w32-lwindow-modifier
470@vindex w32-rwindow-modifier
471@vindex w32-scroll-lock-modifier
472 The variable @code{w32-lwindow-modifier} determines the effect of
473the left Windows key (usually labeled with @key{start} and the Windows
474logo). If its value is @code{nil} (the default), the key will produce
475the symbol @code{lwindow}. Setting it to one of the symbols
476@code{hyper}, @code{super}, @code{meta}, @code{alt}, @code{control},
477or @code{shift} will produce the respective modifier. A similar
478variable @code{w32-rwindow-modifier} controls the effect of the right
479Windows key, and @code{w32-scroll-lock-modifier} does the same for the
480@key{ScrLock} key. If these variables are set to @code{nil}, the
481right Windows key produces the symbol @code{rwindow} and @key{ScrLock}
482produces the symbol @code{scroll}.
483
484@vindex w32-pass-alt-to-system
37a75312
EZ
485@cindex Windows system menu
486@cindex @code{Alt} key invokes menu (Windows)
487 Emacs compiled as a native Windows application normally turns off
488the Windows feature that tapping the @key{ALT} key invokes the Windows
489menu. The reason is that the @key{ALT} serves as @key{META} in Emacs.
490When using Emacs, users often press the @key{META} key temporarily and
491then change their minds; if this has the effect of bringing up the
492Windows menu, it alters the meaning of subsequent commands. Many
493users find this frustrating.
494
495 You can re-enable Windows' default handling of tapping the @key{ALT}
496key by setting @code{w32-pass-alt-to-system} to a non-@code{nil}
497value.
498
7d0a2d30 499@ifnottex
5a3e3201
EZ
500@vindex w32-pass-lwindow-to-system
501@vindex w32-pass-rwindow-to-system
37a75312 502 The variables @code{w32-pass-lwindow-to-system} and
5a3e3201
EZ
503@code{w32-pass-rwindow-to-system} determine whether the respective
504keys are passed to Windows or swallowed by Emacs. If the value is
505@code{nil}, the respective key is silently swallowed by Emacs,
37a75312
EZ
506otherwise it is passed to Windows. The default is @code{t} for both
507of these variables. Passing each of these keys to Windows produces
508its normal effect: for example, @kbd{@key{Lwindow}} opens the
a26d12e3
EZ
509@code{Start} menu, etc.@footnote{
510Some combinations of the ``Windows'' keys with other keys are caught
511by Windows at low level in a way that Emacs currently cannot prevent.
512For example, @kbd{@key{Lwindow} r} always pops up the Windows
513@samp{Run} dialog. Customizing the value of
514@code{w32-phantom-key-code} might help in some cases, though.}
5a3e3201
EZ
515
516@vindex w32-recognize-altgr
517@kindex AltGr @r{(MS-Windows)}
518@cindex AltGr key (MS-Windows)
6041f4e1 519 The variable @code{w32-recognize-altgr} controls whether the
1521f22e
EZ
520@key{AltGr} key (if it exists on your keyboard), or its equivalent,
521the combination of the right @key{Alt} and left @key{Ctrl} keys
522pressed together, is recognized as the @key{AltGr} key. The default
523is @code{t}, which means these keys produce @code{AltGr}; setting it
524to @code{nil} causes @key{AltGr} or the equivalent key combination to
525be interpreted as the combination of @key{CTRL} and @key{META}
526modifiers.
7d0a2d30 527@end ifnottex
5a3e3201 528
37a75312
EZ
529@node Windows Mouse
530@section Mouse Usage on MS-Windows
531@cindex mouse, and MS-Windows
532
533 This section describes the Windows-specific variables related to
534mouse.
535
536@vindex w32-mouse-button-tolerance
537@cindex simulation of middle mouse button
538 The variable @code{w32-mouse-button-tolerance} specifies the
539time interval, in milliseconds, for faking middle mouse button press
540on 2-button mice. If both mouse buttons are depressed within this
541time interval, Emacs generates a middle mouse button click event
542instead of a double click on one of the buttons.
543
544@vindex w32-pass-extra-mouse-buttons-to-system
545 If the variable @code{w32-pass-extra-mouse-buttons-to-system} is
546non-@code{nil}, Emacs passes the fourth and fifth mouse buttons to
547Windows.
548
549@vindex w32-swap-mouse-buttons
550 The variable @code{w32-swap-mouse-buttons} controls which of the 3
551mouse buttons generates the @kbd{mouse-2} events. When it is
552@code{nil} (the default), the middle button generates @kbd{mouse-2}
553and the right button generates @kbd{mouse-3} events. If this variable
554is non-@code{nil}, the roles of these two buttons are reversed.
5a3e3201 555
ca2565b0 556@node Windows Processes
270c6692
EZ
557@section Subprocesses on Windows 9X/ME and Windows NT/2K/XP
558@cindex subprocesses on MS-Windows
ca2565b0 559
270c6692 560@cindex DOS applications, running from Emacs
049224f6 561 Emacs compiled as a native Windows application (as opposed to the DOS
ca2565b0
AI
562version) includes full support for asynchronous subprocesses.
563In the Windows version, synchronous and asynchronous subprocesses work
564fine on both
270c6692 565Windows 9X/ME and Windows NT/2K/XP as long as you run only 32-bit Windows
ca2565b0
AI
566applications. However, when you run a DOS application in a subprocess,
567you may encounter problems or be unable to run the application at all;
568and if you run two DOS applications at the same time in two
569subprocesses, you may have to reboot your system.
570
571Since the standard command interpreter (and most command line utilities)
270c6692 572on Windows 9X are DOS applications, these problems are significant when
ca2565b0
AI
573using that system. But there's nothing we can do about them; only
574Microsoft can fix them.
575
576If you run just one DOS application subprocess, the subprocess should
577work as expected as long as it is ``well-behaved'' and does not perform
578direct screen access or other unusual actions. If you have a CPU
579monitor application, your machine will appear to be 100% busy even when
580the DOS application is idle, but this is only an artifact of the way CPU
581monitors measure processor load.
582
583You must terminate the DOS application before you start any other DOS
584application in a different subprocess. Emacs is unable to interrupt or
585terminate a DOS subprocess. The only way you can terminate such a
586subprocess is by giving it a command that tells its program to exit.
587
588If you attempt to run two DOS applications at the same time in separate
589subprocesses, the second one that is started will be suspended until the
590first one finishes, even if either or both of them are asynchronous.
591
270c6692 592@cindex kill DOS application
ca2565b0
AI
593If you can go to the first subprocess, and tell it to exit, the second
594subprocess should continue normally. However, if the second subprocess
595is synchronous, Emacs itself will be hung until the first subprocess
596finishes. If it will not finish without user input, then you have no
ff43a665 597choice but to reboot if you are running on Windows 9X. If you are
270c6692
EZ
598running on Windows NT/2K/XP, you can use a process viewer application to kill
599the appropriate instance of NTVDM instead (this will terminate both DOS
ca2565b0
AI
600subprocesses).
601
ff43a665 602If you have to reboot Windows 9X in this situation, do not use the
ca2565b0
AI
603@code{Shutdown} command on the @code{Start} menu; that usually hangs the
604system. Instead, type @kbd{CTL-ALT-@key{DEL}} and then choose
605@code{Shutdown}. That usually works, although it may take a few minutes
606to do its job.
607
37a75312 608@vindex w32-quote-process-args
a210f8e6
EZ
609 The variable @code{w32-quote-process-args} controls how Emacs quotes
610the process arguments. Non-@code{nil} means quote with the @code{"}
611character. If the value is a character, use that character to escape
612any quote characters that appear; otherwise chose a suitable escape
613character based on the type of the program.
37a75312 614
ccff391f
EZ
615@ifnottex
616@findex w32-shell-execute
617 The function @code{w32-shell-execute} can be useful for writing
618customized commands that run MS-Windows applications registered to
619handle a certain standard Windows operation for a specific type of
620document or file. This function is a wrapper around the Windows
621@code{ShellExecute} API. See the MS-Windows API documentation for
622more details.
623@end ifnottex
624
270c6692
EZ
625@node Windows Printing
626@section Printing and MS-Windows
627
628 Printing commands, such as @code{lpr-buffer} (@pxref{Printing}) and
629@code{ps-print-buffer} (@pxref{PostScript}) work in MS-DOS and
630MS-Windows by sending the output to one of the printer ports, if a
631Posix-style @code{lpr} program is unavailable. The same Emacs
632variables control printing on all systems, but in some cases they have
633different default values on MS-DOS and MS-Windows.
634
635 Emacs on Windows automatically determines your default printer and
03bebefc 636sets the variable @code{printer-name} to that printer's name. But in
270c6692
EZ
637some rare cases this can fail, or you may wish to use a different
638printer from within Emacs. The rest of this section explains how to
639tell Emacs which printer to use.
640
03bebefc 641@vindex printer-name@r{, (MS-DOS/MS-Windows)}
270c6692
EZ
642 If you want to use your local printer, then set the Lisp variable
643@code{lpr-command} to @code{""} (its default value on Windows) and
644@code{printer-name} to the name of the printer port---for example,
645@code{"PRN"}, the usual local printer port or @code{"LPT2"}, or
646@code{"COM1"} for a serial printer. You can also set
647@code{printer-name} to a file name, in which case ``printed'' output
648is actually appended to that file. If you set @code{printer-name} to
649@code{"NUL"}, printed output is silently discarded (sent to the system
650null device).
651
652 You can also use a printer shared by another machine by setting
653@code{printer-name} to the UNC share name for that printer---for
654example, @code{"//joes_pc/hp4si"}. (It doesn't matter whether you use
655forward slashes or backslashes here.) To find out the names of shared
656printers, run the command @samp{net view} from the command prompt to
657obtain a list of servers, and @samp{net view @var{server-name}} to see
658the names of printers (and directories) shared by that server.
659Alternatively, click the @samp{Network Neighborhood} icon on your
660desktop, and look for machines which share their printers via the
661network.
662
663@cindex @samp{net use}, and printing on MS-Windows
664@cindex networked printers (MS-Windows)
665 If the printer doesn't appear in the output of @samp{net view}, or
666if setting @code{printer-name} to the UNC share name doesn't produce a
667hardcopy on that printer, you can use the @samp{net use} command to
668connect a local print port such as @code{"LPT2"} to the networked
669printer. For example, typing @kbd{net use LPT2: \\joes_pc\hp4si}@footnote{
670Note that the @samp{net use} command requires the UNC share name to be
671typed with the Windows-style backslashes, while the value of
672@code{printer-name} can be set with either forward- or backslashes.}
673causes Windows to @dfn{capture} the @code{LPT2} port and redirect the
674printed material to the printer connected to the machine @code{joes_pc}.
675After this command, setting @code{printer-name} to @code{"LPT2"}
676should produce the hardcopy on the networked printer.
677
678 With some varieties of Windows network software, you can instruct
679Windows to capture a specific printer port such as @code{"LPT2"}, and
680redirect it to a networked printer via the @w{@code{Control
681Panel->Printers}} applet instead of @samp{net use}.
682
683 If you set @code{printer-name} to a file name, it's best to use an
684absolute file name. Emacs changes the working directory according to
685the default directory of the current buffer, so if the file name in
686@code{printer-name} is relative, you will end up with several such
687files, each one in the directory of the buffer from which the printing
688was done.
689
375136cc
EZ
690 If the value of @code{printer-name} is correct, but printing does
691not produce the hardcopy on your printer, it is possible that your
692printer does not support printing plain text (some cheap printers omit
a210f8e6
EZ
693this functionality). In that case, try the PostScript print commands,
694described below.
375136cc 695
270c6692
EZ
696@findex print-buffer @r{(MS-DOS)}
697@findex print-region @r{(MS-DOS)}
698@vindex lpr-headers-switches @r{(MS-DOS)}
699 The commands @code{print-buffer} and @code{print-region} call the
700@code{pr} program, or use special switches to the @code{lpr} program, to
701produce headers on each printed page. MS-DOS and MS-Windows don't
702normally have these programs, so by default, the variable
703@code{lpr-headers-switches} is set so that the requests to print page
704headers are silently ignored. Thus, @code{print-buffer} and
705@code{print-region} produce the same output as @code{lpr-buffer} and
706@code{lpr-region}, respectively. If you do have a suitable @code{pr}
707program (for example, from GNU Coreutils), set
708@code{lpr-headers-switches} to @code{nil}; Emacs will then call
709@code{pr} to produce the page headers, and print the resulting output as
710specified by @code{printer-name}.
711
712@vindex print-region-function @r{(MS-DOS)}
713@cindex lpr usage under MS-DOS
714@vindex lpr-command @r{(MS-DOS)}
715@vindex lpr-switches @r{(MS-DOS)}
716 Finally, if you do have an @code{lpr} work-alike, you can set the
717variable @code{lpr-command} to @code{"lpr"}. Then Emacs will use
718@code{lpr} for printing, as on other systems. (If the name of the
719program isn't @code{lpr}, set @code{lpr-command} to specify where to
720find it.) The variable @code{lpr-switches} has its standard meaning
721when @code{lpr-command} is not @code{""}. If the variable
722@code{printer-name} has a string value, it is used as the value for the
723@code{-P} option to @code{lpr}, as on Unix.
724
725@findex ps-print-buffer @r{(MS-DOS)}
726@findex ps-spool-buffer @r{(MS-DOS)}
727@vindex ps-printer-name @r{(MS-DOS)}
728@vindex ps-lpr-command @r{(MS-DOS)}
729@vindex ps-lpr-switches @r{(MS-DOS)}
730 A parallel set of variables, @code{ps-lpr-command},
731@code{ps-lpr-switches}, and @code{ps-printer-name} (@pxref{PostScript
732Variables}), defines how PostScript files should be printed. These
733variables are used in the same way as the corresponding variables
734described above for non-PostScript printing. Thus, the value of
735@code{ps-printer-name} is used as the name of the device (or file) to
736which PostScript output is sent, just as @code{printer-name} is used
737for non-PostScript printing. (There are two distinct sets of
738variables in case you have two printers attached to two different
739ports, and only one of them is a PostScript printer.)
740
741 The default value of the variable @code{ps-lpr-command} is @code{""},
742which causes PostScript output to be sent to the printer port specified
743by @code{ps-printer-name}, but @code{ps-lpr-command} can also be set to
744the name of a program which will accept PostScript files. Thus, if you
745have a non-PostScript printer, you can set this variable to the name of
746a PostScript interpreter program (such as Ghostscript). Any switches
747that need to be passed to the interpreter program are specified using
748@code{ps-lpr-switches}. (If the value of @code{ps-printer-name} is a
749string, it will be added to the list of switches as the value for the
750@code{-P} option. This is probably only useful if you are using
751@code{lpr}, so when using an interpreter typically you would set
752@code{ps-printer-name} to something other than a string so it is
753ignored.)
754
755 For example, to use Ghostscript for printing on the system's default
756printer, put this in your @file{.emacs} file:
757
758@example
759(setq ps-printer-name t)
760(setq ps-lpr-command "D:/gs6.01/bin/gswin32c.exe")
761(setq ps-lpr-switches '("-q" "-dNOPAUSE" "-dBATCH"
762 "-sDEVICE=mswinpr2"
763 "-sPAPERSIZE=a4"))
764@end example
765
766@noindent
767(This assumes that Ghostscript is installed in the
768@file{D:/gs6.01} directory.)
769
03bebefc
JR
770@node Windows Fonts
771@section Specifying Fonts on MS-Windows
772@cindex font specification (MS Windows)
773
774 Starting with Emacs 23, fonts are specified by their name, size
87e391bb
EZ
775and optional properties. The format for specifying fonts comes from the
776fontconfig library used in modern Free desktops:
03bebefc
JR
777
778@example
779 [Family[-PointSize]][:Option1=Value1[:Option2=Value2[...]]]
780@end example
781
782 The old XLFD based format is also supported for backwards compatibility.
783
87e391bb
EZ
784 Emacs 23 supports a number of backends. Currently, the @code{gdi}
785font backend is supported on Windows.
03bebefc
JR
786
787@cindex font properties (MS Windows)
788@noindent
789Optional properties common to all font backends on MS-Windows are:
790
87e391bb
EZ
791@table @code
792
03bebefc 793@vindex font-weight-table @r{(MS-Windows)}
87e391bb
EZ
794@item weight
795Specifies the weight of the font. Special values @code{light},
796@code{medium}, @code{demibold}, @code{bold}, and @code{black} can be specified
797without @code{weight=} (e.g., @kbd{Courier New-12:bold}). Otherwise,
03bebefc 798the weight should be a numeric value between 100 and 900, or one of the
87e391bb 799named weights in @code{font-weight-table}. If unspecified, a regular font
03bebefc
JR
800is assumed.
801
802@vindex font-slant-table @r{(MS-Windows)}
87e391bb
EZ
803@item slant
804Specifies whether the font is italic. Special values
03bebefc 805@code{roman}, @code{italic} and @code{oblique} can be specified
87e391bb
EZ
806without @code{slant=} (e.g., @kbd{Courier New-12:italic}).
807Otherwise, the slant should be a numeric value, or one of the named
03bebefc 808slants in @code{font-slant-table}. On Windows, any slant above 150 is
87e391bb 809treated as italics, and anything below as roman.
03bebefc 810
87e391bb
EZ
811@item family
812Specifies the font family, but normally this will be specified
03bebefc
JR
813at the start of the font name.
814
87e391bb
EZ
815@item pixelsize
816Specifies the font size in pixels. This can be used instead
03bebefc
JR
817of the point size specified after the family name.
818
87e391bb
EZ
819@item adstyle
820Specifies additional style information for the font.
03bebefc 821On MS-Windows, the values @code{mono}, @code{sans}, @code{serif},
87e391bb 822@code{script} and @code{decorative} are recognized. These are most useful
03bebefc
JR
823as a fallback with the font family left unspecified.
824
825@vindex w32-charset-info-alist
87e391bb
EZ
826@item registry
827Specifies the character set registry that the font is
828expected to cover. Most Truetype and Opentype fonts will be unicode fonts
03bebefc
JR
829that cover several national character sets, but you can narrow down the
830selection of fonts to those that support a particular character set by
831using a specific registry from @code{w32-charset-info-alist} here.
832
87e391bb
EZ
833@item spacing
834Specifies how the font is spaced. The @code{p} spacing specifies
03bebefc
JR
835a proportional font, and @code{m} or @code{c} specify a monospaced font.
836
87e391bb
EZ
837@item foundry
838Not used on Windows, but for informational purposes and to
03bebefc
JR
839prevent problems with code that expects it to be set, is set internally to
840@code{raster} for bitmapped fonts, @code{outline} for scalable fonts,
841or @code{unknown} if the type cannot be determined as one of those.
87e391bb 842@end table
03bebefc
JR
843
844@cindex font properties (MS Windows gdi backend)
87e391bb
EZ
845Options specific to @code{GDI} fonts:
846
847@table @code
03bebefc
JR
848
849@cindex font scripts (MS Windows)
850@cindex font unicode subranges (MS Windows)
87e391bb
EZ
851@item script
852Specifies a unicode subrange the font should support.
853
854The following scripts are recognized on Windows: @code{latin}, @code{greek},
855@code{coptic}, @code{cyrillic}, @code{armenian}, @code{hebrew}, @code{arabic},
03bebefc
JR
856@code{syriac}, @code{nko}, @code{thaana}, @code{devanagari}, @code{bengali},
857@code{gurmukhi}, @code{gujarati}, @code{oriya}, @code{tamil}, @code{telugu},
858@code{kannada}, @code{malayam}, @code{sinhala}, @code{thai}, @code{lao},
859@code{tibetan}, @code{myanmar}, @code{georgian}, @code{hangul},
860@code{ethiopic}, @code{cherokee}, @code{canadian-aboriginal}, @code{ogham},
861@code{runic}, @code{khmer}, @code{mongolian}, @code{symbol}, @code{braille},
862@code{han}, @code{ideographic-description}, @code{cjk-misc}, @code{kana},
863@code{bopomofo}, @code{kanbun}, @code{yi}, @code{byzantine-musical-symbol},
864@code{musical-symbol}, and @code{mathematical}.
865
866@cindex font antialiasing (MS Windows)
87e391bb
EZ
867@item antialias
868Specifies the antialiasing to use for the font. The value @code{none}
03bebefc
JR
869means no antialiasing, @code{standard} means use standard antialiasing,
870@code{subpixel} means use subpixel antialiasing (known as Cleartype on Windows),
87e391bb
EZ
871and @code{natural} means use subpixel antialiasing with adjusted spacing between
872letters. If unspecified, the font will use the system default antialiasing.
873@end table
03bebefc 874
37a75312
EZ
875@node Windows Misc
876@section Miscellaneous Windows-specific features
877
878 This section describes miscellaneous Windows-specific features.
879
a210f8e6
EZ
880@vindex w32-use-visible-system-caret
881@cindex screen reader software, MS-Windows
882 The variable @code{w32-use-visible-system-caret} is a flag that
883determines whether to make the system caret visible. The default is
884@code{nil}, which means Emacs draws its own cursor to indicate the
885position of point. A non-@code{nil} value means Emacs will indicate
886point location by the system caret; this facilitates use of screen
887reader software. When this variable is non-@code{nil}, other
888variables affecting the cursor display have no effect.
889
890@iftex
891@inforef{Windows Misc, , emacs}, for information about additional
892Windows-specific variables in this category.
893@end iftex
894
7d0a2d30 895@ifnottex
37a75312
EZ
896@vindex w32-grab-focus-on-raise
897@cindex frame focus policy, MS-Windows
898 The variable @code{w32-grab-focus-on-raise}, if set to a
899non-@code{nil} value causes a frame to grab focus when it is raised.
900The default is @code{t}, which fits well with the Windows default
901click-to-focus policy.
902
903@vindex w32-list-proportional-fonts
904 The variable @code{w32-list-proportional-fonts} controls whether
905proportional fonts are included in the font selection dialog. If its
906value is non-@code{nil}, these fonts will be included. The default is
907@code{nil}.
7d0a2d30 908@end ifnottex
37a75312 909
5798efc8
EZ
910@ifnottex
911@include msdog-xtra.texi
912@end ifnottex
913
ab5796a9
MB
914@ignore
915 arch-tag: f39d2590-5dcc-4318-88d9-0eb73ca10fa2
916@end ignore