msdos.texi 49 KB

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