Commit | Line | Data |
---|---|---|
1857cd3f GM |
1 | \input texinfo @c -*-coding:utf-8 -*- |
2 | @setfilename efaq-w32 | |
3 | @settitle GNU Emacs FAQ For MS Windows | |
4 | @setchapternewpage odd | |
5 | @syncodeindex pg cp | |
6 | @syncodeindex ky cp | |
7 | @syncodeindex tp cp | |
8 | @syncodeindex vr fn | |
9 | ||
10 | @documentdescription | |
11 | Answers to Frequently asked Questions about using Emacs on Microsoft Windows. | |
12 | @end documentdescription | |
13 | ||
79c238dc | 14 | @include emacsver.texi |
1857cd3f GM |
15 | |
16 | @documentencoding utf-8 | |
17 | @documentlanguage en | |
18 | ||
19 | @copying | |
ba318903 | 20 | Copyright @copyright{} 2008, 2010-2014 Free Software Foundation, Inc. |
1857cd3f GM |
21 | |
22 | @quotation | |
23 | This list of frequently asked questions about GNU Emacs on MS Windows | |
24 | with answers (``FAQ'') may be translated into other languages, | |
25 | transformed into other formats (e.g. Texinfo, Info, WWW), and updated | |
26 | with new information. | |
27 | ||
28 | The same conditions apply to any derivative of the FAQ as apply to the FAQ | |
29 | itself. Every copy of the FAQ must include this notice or an approved | |
30 | translation, information on who is currently maintaining the FAQ and how to | |
31 | contact them (including their e-mail address), and information on where the | |
32 | latest version of the FAQ is archived (including FTP information). | |
33 | ||
34 | The FAQ may be copied and redistributed under these conditions, except that | |
35 | the FAQ may not be embedded in a larger literary work unless that work | |
36 | itself allows free copying and redistribution. | |
37 | @end quotation | |
38 | @end copying | |
39 | ||
40 | @dircategory Emacs | |
41 | @direntry | |
42 | * Emacs W32 FAQ: (efaq-w32). FAQs about Emacs on MS Windows. | |
43 | @end direntry | |
44 | ||
45 | @c The @titlepage stuff only appears in the printed version | |
46 | @titlepage | |
47 | @sp 10 | |
48 | @center @titlefont{GNU Emacs FAQ for MS Windows} | |
49 | ||
50 | @c The following two commands start the copyright page. | |
51 | @page | |
52 | @vskip 0pt plus 1filll | |
53 | @insertcopying | |
54 | @end titlepage | |
55 | ||
56 | @footnotestyle end | |
57 | ||
58 | @node Top | |
59 | @top GNU Emacs FAQ for MS Windows | |
60 | ||
79c238dc GM |
61 | This is the FAQ for using GNU Emacs on MS Windows, as distributed with |
62 | Emacs @value{EMACSVER}. | |
1857cd3f GM |
63 | |
64 | This FAQ is maintained by the developers and users of Emacs on MS Windows. | |
65 | If you find any errors, or have any suggestions, please send them to | |
66 | the @url{http://lists.gnu.org/mailman/listinfo/help-emacs-windows, | |
67 | help-emacs-windows} mailing list. | |
68 | ||
69 | At time of writing, the latest version of GNU Emacs is version @value{EMACSVER}. | |
70 | ||
71 | @c Links to ftp.gnu.org are given as http links, since Windows ftp clients | |
72 | @c are notoriously bad at handling firewalls etc. | |
73 | ||
74 | @contents | |
75 | ||
76 | @menu | |
77 | * Introduction:: | |
78 | * Getting Emacs:: | |
79 | * Installing Emacs:: | |
80 | * Display Settings:: | |
81 | * Fonts and text translation:: | |
82 | * Printing:: | |
83 | * Sub-processes:: | |
84 | * Network access:: | |
85 | * Text and Utility modes:: | |
86 | * Developing with Emacs:: | |
87 | * Other useful ports:: | |
88 | * Further information:: | |
89 | * Indexes:: | |
90 | @end menu | |
91 | ||
92 | @c ------------------------------------------------------------ | |
93 | @node Introduction | |
94 | @chapter Introduction | |
95 | @cindex scope of FAQ | |
96 | ||
97 | This FAQ covers questions that are specific to running GNU Emacs on Windows. | |
98 | For more general information, see the other Emacs manuals. | |
99 | @xref{Further information}. | |
100 | ||
101 | @menu | |
102 | * Why Emacs on Windows:: | |
103 | * Which versions of Windows:: | |
104 | * Other versions of Emacs:: | |
105 | @end menu | |
106 | ||
107 | @node Why Emacs on Windows | |
108 | @section Why support GNU Emacs on Windows? | |
109 | @cindex Why Windows | |
110 | ||
111 | It is not our goal to ``help Windows users'' by making text editing | |
112 | on Windows more convenient. We aim to replace proprietary software, | |
113 | not to enhance it. So why support GNU Emacs on Windows? | |
114 | ||
115 | We hope that the experience of using GNU Emacs on Windows will give | |
116 | programmers a taste of freedom, and that this will later inspire them | |
117 | to move to a free operating system such as GNU/Linux. That is the | |
118 | main valid reason to support free applications on nonfree operating | |
119 | systems. | |
120 | ||
121 | @node Which versions of Windows | |
122 | @section Which versions of Windows are supported? | |
123 | @cindex Windows, versions | |
124 | @cindex supported versions of Windows | |
125 | ||
126 | Emacs @value{EMACSVER} is known to run on all versions of Windows from | |
127 | @c FIXME does it really still support Windows 98? Does it matter? | |
128 | Windows 98 and Windows NT 4.0 through to Windows 7. The Windows port is | |
129 | built using the Win32 API and supports most features of the X version, | |
130 | including variable width fonts, images and tooltips. | |
131 | ||
132 | @node Other versions of Emacs | |
133 | @section What other versions of Emacs run on Windows? | |
134 | @cindex other ports of Emacs | |
135 | ||
136 | @xref{Cygwin}. | |
137 | ||
138 | @cindex DOS port | |
139 | @cindex Windows 3.11 port | |
140 | Emacs can also be compiled for MSDOS. When run on recent MS Windows, | |
141 | it supports long file names, and uses the Windows clipboard. | |
142 | See the @file{msdos} directory in the Emacs sources for building | |
143 | instructions (requires DJGPP). | |
144 | ||
145 | @c ------------------------------------------------------------ | |
146 | @node Getting Emacs | |
147 | @chapter Getting Emacs | |
148 | ||
149 | @menu | |
150 | * Downloading:: | |
151 | * Compiling:: | |
152 | * Debugging:: | |
153 | @end menu | |
154 | ||
155 | @node Downloading | |
156 | @section Where can I download Emacs? | |
157 | ||
158 | @cindex precompiled binaries | |
159 | @cindex where to get Emacs binaries | |
160 | Pre-compiled versions are distributed from | |
161 | @uref{http://ftpmirror.gnu.org/emacs/windows/, ftp.gnu.org mirrors}. | |
162 | Emacs binaries are distributed as zip files, digitally | |
163 | signed by the developer who built them. Generally most users will | |
164 | want the file @file{emacs-@value{EMACSVER}-bin-i386.zip}, which | |
63442595 | 165 | contains everything you need to get started. |
1857cd3f GM |
166 | |
167 | @cindex where to get sources | |
168 | @cindex Emacs source code | |
169 | @cindex source for Emacs | |
170 | The latest source is available from | |
171 | @uref{http://ftpmirror.gnu.org/emacs/, ftp.gnu.org mirrors}. It is | |
172 | distributed as a compressed tar file, digitally signed by the maintainer | |
173 | who made the release. | |
174 | ||
175 | @cindex Bzr, getting Emacs | |
176 | @cindex latest development version of Emacs | |
177 | @cindex Emacs Development | |
178 | The development version of Emacs is available from | |
179 | @uref{http://savannah.gnu.org/projects/emacs, Savannah}, the GNU | |
180 | development site. | |
181 | ||
182 | @node Compiling | |
183 | @section How can I compile Emacs myself? | |
184 | @cindex compiling Emacs | |
185 | ||
186 | To compile Emacs on Windows, you will need the MingW or Cygwin port of | |
187 | GCC with MingW make, or a Microsoft C compiler with nmake and the | |
188 | single threaded C runtime library. Recent versions of Microsoft | |
189 | Visual Studio no longer come with the single threaded C runtime | |
190 | library, which is required for certain POSIX compatibility, so MingW | |
191 | is usually the best choice. Image support requires external | |
192 | libraries, the headers and import libraries for which will need to be | |
193 | installed where your compiler can find them. You will also need ports | |
194 | of GNU @command{rm} and @command{cp}, as the Windows native | |
195 | equivalents are not consistent between versions. GNU texinfo will be | |
196 | required to build the manuals. @xref{Other useful ports}. | |
197 | ||
198 | After unpacking the source, or checking out of Bzr, be sure to read the | |
199 | instructions in @file{nt/README} and @file{nt/INSTALL}. | |
200 | ||
201 | @node Debugging | |
202 | @section How do I use a debugger on Emacs? | |
203 | @cindex debugging Emacs | |
204 | @cindex bugs in Emacs, how to debug | |
205 | @cindex Emacs debugging | |
206 | ||
207 | By default, Emacs is compiled with debugging on, and optimizations enabled. | |
208 | The optimizations may interfere with some types of debugging; the debugger | |
209 | may not show clearly where it is, or may not be able to inspect certain | |
210 | variables. If this is the case, reconfigure with @option{--no-opt}. | |
211 | ||
212 | The file @file{etc/DEBUG} contains general debugging hints, as well as | |
213 | specific notes about debugging Emacs with both gdb and Microsoft debuggers. | |
214 | ||
215 | @menu | |
216 | * GDB:: | |
217 | * Microsoft Developer Studio:: | |
218 | @end menu | |
219 | ||
220 | @node GDB | |
221 | @subsection GDB | |
222 | @cindex GDB, debugging Emacs with | |
223 | @cindex debugging Emacs with GDB | |
224 | ||
225 | GDB is the GNU debugger, which can be used to debug Emacs when it has | |
226 | been compiled with GCC. The best results will be obtained if you | |
227 | start gdb from the @file{src} directory as @samp{gdb oo/i386/emacs.exe}. | |
228 | This will load the init file @file{.gdbinit} in that directory, to | |
229 | define some extra commands for working with lisp while debugging, and | |
230 | set up breakpoints to catch abnormal aborts. | |
231 | ||
232 | @node Microsoft Developer Studio | |
233 | @subsection Microsoft Developer Studio | |
234 | @cindex MSVC++, debugging Emacs with | |
235 | @cindex DevStudio, debugging Emacs with | |
236 | @cindex debugging Emacs with MS DevStudio | |
237 | ||
238 | MS DevStudio can be used to debug Emacs when it has been compiled with | |
239 | a Microsoft compiler. To view lisp variables, you can call the | |
240 | function @code{debug_print} from the Quickwatch window. Some | |
241 | @uref{http://www.gnu.org/software/emacs/windows/ntemacs/discuss/debug.txt, | |
242 | old tips} are probably still valid. | |
243 | ||
244 | @c ------------------------------------------------------------ | |
245 | @node Installing Emacs | |
246 | @chapter Installing Emacs | |
247 | ||
248 | @menu | |
249 | * Unpacking:: | |
250 | * Installing:: | |
251 | * Image support:: | |
252 | * Init file:: | |
253 | * Location of init file:: | |
254 | * Troubleshooting init file:: | |
255 | * Associate files with Emacs:: | |
256 | * Find-file and the Desktop:: | |
257 | * Make Windows more like X:: | |
258 | * Make Emacs like a Windows app:: | |
259 | * Window operations:: | |
260 | * Uninstall:: | |
261 | * Does not run:: | |
262 | * Virus:: | |
263 | * Anti-virus:: | |
264 | @end menu | |
265 | ||
266 | @node Unpacking | |
267 | @section How do I unpack the distributions? | |
268 | @cindex unpacking Emacs distribution | |
269 | @cindex extracting Emacs distribution | |
270 | @cindex unzipping Emacs distribution | |
271 | @cindex untarring Emacs distribution | |
272 | @cindex zip files, how to unpack Emacs binaries | |
273 | @cindex tar.gz files, how to unpack Emacs sources | |
274 | ||
275 | The binary distributions are distributed as zip files, which are handled | |
276 | natively by Windows XP and later. For earlier versions, there are many | |
277 | tools that can handle the zip format, from InfoZip's command line unzip | |
278 | tool, to 7zip's multi-format graphical archive explorer. Although | |
279 | popular, WinZip has caused problems with line-ends in the past, and is not | |
280 | Free software, so we do not recommend it. | |
281 | ||
282 | Source distributions are distributed as gzipped tar files. 7zip and | |
283 | similar multi-format graphical tools can handle these, or you can get | |
284 | Windows ports of the command line gzip and tar tools from multiple sources. | |
285 | @xref{Other useful ports}. | |
286 | ||
287 | The command to unpack a source distribution from the command line is: | |
288 | @example | |
63442595 | 289 | tar xzf emacs-@value{EMACSVER}.tar.gz |
1857cd3f GM |
290 | @end example |
291 | ||
292 | If this does not work with the versions of tar and gzip that you have, | |
293 | you may need to try a two step process: | |
294 | @example | |
295 | gzip -dc emacs-@value{EMACSVER}.tar.gz | tar xvf - | |
296 | @end example | |
297 | ||
298 | You may see many messages from tar complaining about being unable to change | |
299 | the modification time on directories, and from gzip complaining about a | |
300 | broken pipe. These messages are usually harmless, caused by incomplete ports | |
301 | that are not fully aware of the limitations of Windows. | |
302 | ||
303 | @node Installing | |
304 | @section How do I install Emacs after unpacking? | |
305 | @cindex installing Emacs | |
306 | @pindex addpm | |
307 | @cindex Start Menu, creating icons for Emacs | |
308 | ||
309 | You can run Emacs without any extra steps, but if you want icons in your | |
310 | Start Menu, or for Emacs to detect the image libraries that are already | |
311 | installed on your system as part of GTK, then you should run the program | |
312 | @file{emacs-@value{EMACSVER}\bin\addpm.exe}. | |
313 | ||
314 | @node Image support | |
315 | @section How do I get image support? | |
316 | @cindex images, installing libraries for | |
317 | @cindex jpeg, installing image support in Emacs | |
318 | @cindex png, installing image support in Emacs | |
319 | @cindex gif, installing image support in Emacs | |
320 | @cindex tiff, installing image support in Emacs | |
321 | @cindex xpm, installing image support in Emacs | |
322 | @cindex toolbar, installing color icons in | |
323 | @cindex color images, installing support for images in Emacs | |
324 | @cindex monochrome images, getting color images in Emacs | |
325 | @cindex black and white images, getting color images in Emacs | |
326 | ||
327 | Emacs has built in support for XBM and PBM/PGM/PPM images. This is | |
328 | sufficient to see the monochrome splash screen and tool-bar icons. | |
329 | Since 22.2, the official precompiled binaries for Windows have bundled | |
330 | libXpm, which is required to display the color versions of those images. | |
331 | ||
332 | Emacs is compiled to recognize JPEG, PNG, GIF and TIFF images also, | |
333 | but displaying these image types require external DLLs which are not | |
334 | bundled with Emacs. @xref{Other useful ports}. | |
335 | ||
336 | @node Init file | |
337 | @section What is my init file? | |
338 | @cindex .emacs | |
339 | @cindex init file | |
340 | ||
341 | When Emacs starts up, it attempts to load and execute the contents of | |
342 | a file commonly called @file{.emacs} (though it may have other names, | |
343 | @pxref{Installing Emacs,,Where do I put my init file?}) which contains any | |
344 | customizations you have made. You can manually add lisp code to your | |
345 | .emacs, or you can use the Customization interface accessible from the | |
346 | @emph{Options} menu. If the file does not exist, Emacs will start | |
347 | with the default settings. | |
348 | ||
349 | @node Location of init file | |
350 | @section Where do I put my init file? | |
351 | @cindex HOME directory | |
352 | @cindex .emacs.d | |
353 | @cindex _emacs | |
354 | @cindex init.el | |
355 | @cindex registry, setting the HOME directory in | |
356 | ||
357 | On Windows, the .emacs file may be called _emacs for backward | |
358 | compatibility with DOS and FAT filesystems where filenames could not | |
359 | start with a dot. Some users prefer to continue using such a name, | |
360 | because Explorer cannot create a file with a name starting with a dot, | |
361 | even though the filesystem and most other programs can handle it. | |
362 | In Emacs 22 and later, the init file may also be called | |
363 | @file{.emacs.d/init.el}. Many of the other files that are created | |
364 | by lisp packages are now stored in the @file{.emacs.d} directory too, | |
365 | so this keeps all your Emacs related files in one place. | |
366 | ||
367 | All the files mentioned above should go in your @env{HOME} directory. | |
368 | The @env{HOME} directory is determined by following the steps below: | |
369 | ||
370 | @enumerate | |
371 | @item | |
372 | If the environment variable @env{HOME} is set, use the directory it indicates. | |
373 | @item | |
374 | If the registry entry @code{HKCU\SOFTWARE\GNU\Emacs\HOME} is set, use the | |
375 | directory it indicates. | |
376 | @item | |
377 | If the registry entry @code{HKLM\SOFTWARE\GNU\Emacs\HOME} is set, use the | |
378 | directory it indicates. Not recommended, as it results in users sharing | |
379 | the same HOME directory. | |
380 | @item | |
381 | If @file{C:\.emacs} exists, then use @file{C:/}. This is for | |
382 | backward compatibility, as previous versions defaulted to @file{C:/} | |
383 | if @env{HOME} was not set. | |
384 | @item | |
385 | Use the user's AppData directory, usually a directory called | |
386 | @file{Application Data} under the user's profile directory, the location | |
387 | of which varies according to Windows version and whether the computer is | |
388 | part of a domain. | |
389 | @end enumerate | |
390 | ||
391 | Within Emacs, @key{~} at the beginning of a file name is expanded to your | |
392 | @env{HOME} directory, so you can always find your .emacs file with | |
393 | @kbd{C-x C-f ~/.emacs}. | |
394 | ||
395 | @node Troubleshooting init file | |
396 | @section Troubleshooting init file problems | |
397 | @cindex troubleshooting init problems | |
398 | @cindex debugging init problems | |
399 | @cindex checking that HOME is set correctly | |
400 | ||
401 | If you've set @env{HOME} to a directory using one of the above | |
402 | methods, and Emacs still doesn't load your init file, the first | |
403 | thing you should do is check to see what Emacs thinks @env{HOME} is set | |
404 | to. You can do this by evaluating the following expression in the | |
405 | @file{*scratch*} buffer using @kbd{C-x C-e}: | |
406 | ||
407 | @example | |
408 | (insert (getenv "HOME")) | |
409 | @end example | |
410 | ||
411 | Look carefully at what is printed and make sure the value is | |
412 | valid. For example, if the value has trailing whitespace, Emacs won't | |
413 | be able to find the directory. Also, be sure that the value isn't a | |
414 | relative drive letter (e.g., @file{d:} without a backslash); if it is, | |
415 | then @env{HOME} is going to be whatever the current directory on that | |
416 | drive is, which is likely not what you want to happen. | |
417 | ||
418 | @node Associate files with Emacs | |
419 | @section How do I associate files with Emacs? | |
420 | @cindex Explorer, associating Emacs with files in | |
421 | @cindex emacsclient, associating files with | |
422 | @cindex file associations | |
423 | @cindex associating files with Emacs | |
424 | @cindex ALTERNATE_EDITOR | |
425 | @findex server-start | |
426 | ||
427 | The recommended way to associate files is to associate them with | |
428 | @command{emacsclientw.exe}. In order for this to work when Emacs is | |
429 | not yet started, you will also need to set the environment variable | |
430 | @env{ALTERNATE_EDITOR} to @command{runemacs.exe}. To open files | |
431 | in a running instance of Emacs, you will need to add the following | |
432 | to your init file: | |
433 | @example | |
434 | (server-start) | |
435 | @end example | |
436 | ||
437 | @menu | |
438 | * Using with Explorer:: | |
439 | @end menu | |
440 | ||
441 | @node Using with Explorer | |
442 | @subsection For use with Internet Explorer | |
443 | @cindex Internet Explorer, view source in Emacs | |
444 | @cindex mailto urls, associating with Emacs | |
445 | @cindex news urls, associating with Emacs | |
446 | @cindex URLs, associating mail and news URLs with Emacs | |
447 | ||
448 | You can use Emacs as the editor for composing mail for | |
449 | @indicateurl{mailto:} links, reading usenet for @indicateurl{news:} | |
450 | links, and viewing source. The following registry entries control | |
451 | this: | |
452 | ||
453 | @itemize @w{} | |
454 | @item | |
455 | ||
456 | @itemize | |
457 | @item @strong{Key:} HKCR\mailto\shell\open\command\(Default) | |
458 | @item @strong{Value:} emacsclientw -e "(message-mail (substring \"%1\" 7))" | |
459 | @end itemize | |
460 | ||
461 | @item | |
462 | News | |
463 | @itemize | |
464 | @item @strong{Key:} HKCR\news\shell\open\command\(Default) | |
465 | @item @strong{Value:} emacsclientw -e "(gnus-fetch-group (substring \"%1\" 5)" | |
466 | @end itemize | |
467 | ||
468 | @item | |
469 | View Source | |
470 | @itemize | |
471 | @item @strong{Key:} HKCR\htmlfile\shell\edit\command\(Default) | |
472 | @item @strong{Value:} emacsclientw "%1" | |
473 | @end itemize | |
474 | ||
475 | @end itemize | |
476 | ||
477 | Thanks to Jason Rumney and Sigbjorn Finne for these tips. | |
478 | ||
479 | @node Find-file and the Desktop | |
480 | @section How do I use find-file to open files that are on the Desktop? | |
481 | @cindex Desktop, finding where it is | |
482 | @cindex finding the Desktop | |
483 | @cindex locating files on the Desktop | |
484 | ||
485 | The location of the Desktop varies between different versions of | |
486 | Windows, and in a corporate environment can be moved around by the | |
487 | network administrator. On NT derivatives, you can use the value of | |
488 | the @env{USERPROFILE} environment variable to find where the desktop | |
489 | might be: | |
490 | ||
491 | @example | |
492 | @kbd{C-x C-f $USERPROFILE/Desktop} | |
493 | @end example | |
494 | ||
495 | If this doesn't work, then you probably have to forgo the keyboard | |
496 | just this once, and either drag a file onto the Emacs frame from the | |
497 | desktop, or use the file dialog (displayed when you use the toolbar or | |
498 | menu by default). Once you have a file from the Desktop inside Emacs, | |
499 | @kbd{C-x C-f} will quickly reveal where your desktop is kept. | |
500 | ||
501 | @node Make Windows more like X | |
502 | @section How can I modify Windows to act more like X? | |
503 | @cindex X, making Windows behave like | |
504 | ||
505 | @menu | |
506 | * Focus follows mouse:: | |
507 | * Swap CapsLock and Control:: | |
508 | @end menu | |
509 | ||
510 | @node Focus follows mouse | |
511 | @subsection How do it make the active window follow the mouse? | |
512 | @vindex focus-follows-mouse | |
513 | @cindex point to focus | |
514 | @cindex mouse over to focus | |
515 | ||
516 | Customize the variables @code{focus-follows-mouse} and | |
517 | @code{mouse-autoselect-window}. The former can be used to mislead | |
518 | Emacs into giving focus to other frames when the mouse is over them, | |
519 | even though Windows has a click to focus policy by default (there is | |
520 | software available to change that though). The latter can be used to | |
521 | make Emacs use a focus-follow-mouse policy within its own frames. | |
522 | ||
523 | @node Swap CapsLock and Control | |
524 | @subsection How do I swap CapsLock and Control? | |
525 | @cindex scan codes, modifying | |
526 | @cindex key layout, customizing | |
527 | @cindex caps-lock, swapping with control key | |
528 | @cindex control key, swapping with caps-lock | |
529 | @cindex windows key, use as alt | |
530 | @cindex alt key, using windows keys as additional | |
531 | ||
532 | This cannot be done within Emacs, but you can modify the scan code | |
533 | mappings in the registry or define a new keyboard layout to swap the | |
534 | keys on a system wide basis. | |
535 | ||
536 | @menu | |
537 | * Swap Caps NT:: | |
538 | * Swap Caps 98:: | |
539 | @end menu | |
540 | ||
541 | @node Swap Caps NT | |
542 | @subsubsection Windows NT/2000/XP/Vista? | |
543 | ||
544 | @itemize | |
545 | @item | |
546 | From Chris McMahon. To make CapsLock a Control key (leaving your | |
547 | original control keys as they were), use this registry file: | |
548 | @example | |
549 | REGEDIT4 | |
550 | ||
551 | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] | |
552 | "Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00 | |
553 | @end example | |
554 | To swap CapsLock and the left Control key, use: | |
555 | @example | |
556 | REGEDIT4 | |
557 | ||
558 | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] | |
559 | "Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,3a,00,1d,00,00,00,00,00 | |
560 | @end example | |
561 | Save these as files with a @file{.reg} extension, and double-click on | |
562 | them in Explorer, or ``run'' them from a command prompt to have them | |
563 | update your registry (you may need to reboot). | |
564 | @item | |
565 | Shane Holder gives some background on how "Scancode Map" is used | |
566 | by the system: | |
567 | @ignore | |
568 | http://ftp.gnu.org/old-gnu/emacs/windows/docs/ntemacs/contrib/caps-ctrl-registry.txt | |
569 | From: Shane Holder <holder@@mordor.rsn.hp.com> | |
570 | To: ntemacs-users@@cs.washington.edu | |
571 | Date: 04 Dec 1996 14:36:21 -0600 | |
572 | Message-ID: <fawg21mm4hm.fsf@@mordor.rsn.hp.com> | |
573 | Subject: Re: Re[2]: problem with caps/ctrl swap on NT 4.0 | |
574 | @end ignore | |
575 | @example | |
63442595 EZ |
576 | It's a binary value that lets you map keystrokes in the low-level keyboard |
577 | drivers in NT. As a result you don't have to worry about applications | |
578 | bypassing mappings that you've done at a higher level (i.e. it just works). | |
1857cd3f GM |
579 | |
580 | Here's the format of the value: | |
581 | ||
582 | DWORD: 0x00000000 header | |
583 | DWORD: 0x00000000 header | |
584 | DWORD: length (in DWORDs) of remaining data, including terminating DWORD | |
585 | DWORD: mapping 1 | |
586 | ... | |
587 | DWORD: mapping n | |
588 | DWORD: 0x00000000 terminating null DWORD | |
589 | ||
63442595 EZ |
590 | Each mapping DWORD has two parts: the input scancode, and an output |
591 | scancode. To map scancode 0x1d (left control) to scancode 0x3a (caps | |
592 | lock), you want a value of 0x003a001d. Note that this does not swap the | |
593 | keys. Using just this mapping value, both the left control and the caps | |
594 | lock key will behave as caps-lock. To swap, you also need to map 0x3a to | |
1857cd3f GM |
595 | 0x1d, using 0x001d003a. |
596 | ||
597 | This registry value is system wide, and can't be made user-specific. It | |
598 | also only takes affect on reboot. | |
599 | @end example | |
600 | @item | |
601 | Ulfar Erlingsson has provided a registry file that sets the CapsLock key | |
602 | to be a Control key and the Windows key to be an Alt key: | |
603 | @example | |
604 | REGEDIT4 | |
605 | ||
606 | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] | |
607 | "Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,38,00,5b,e0,00,00,00,00 | |
608 | @end example | |
609 | @end itemize | |
610 | ||
611 | @node Swap Caps 98 | |
612 | @subsubsection Windows 95/98/ME | |
613 | ||
614 | Microsoft has a tool called keyremap that is part of their Kernel Toys add ons | |
615 | for Windows 95. The tool has also been confirmed to work on Windows 98. | |
616 | ||
617 | @node Make Emacs like a Windows app | |
618 | @section How can I modify Emacs to act more like a Windows app? | |
619 | @cindex Windows, making Emacs act more like | |
620 | @cindex UI, making Emacs more like other Windows apps | |
621 | ||
622 | Many beginning users find Emacs difficult to use because its user | |
623 | interface is different in many ways. Emacs predates most UI | |
624 | standards, and experienced Emacs users are used to the way things are, | |
625 | so changing the defaults is difficult. Most of the ``standard'' | |
626 | behavior can be approximated in Emacs after some configuring though. | |
627 | ||
628 | @menu | |
629 | * Highlight selection:: | |
630 | * CUA:: | |
631 | @end menu | |
632 | ||
633 | @node Highlight selection | |
634 | @subsection Highlighting the selection | |
635 | @cindex transient-mark-mode | |
636 | @cindex selection, highlighting | |
637 | @cindex region, highlighting | |
638 | @cindex highlighting the selected region | |
639 | @cindex marked region, highlighting | |
640 | @cindex point and mark, highlighting the region between | |
641 | @cindex delete-selection-mode | |
642 | @cindex overwriting the selected region | |
643 | ||
644 | Emacs has a concept of a mark and point that is similar to selections | |
645 | in other programs. But the mark in Emacs is used for more than just | |
646 | defining the selected region, it lives on while you continue to edit | |
647 | and move around the buffer so it can also be a kind of bookmark. The | |
648 | history of marks is saved so you can pop previous marks back to the | |
649 | top of the stack to go back to somewhere you were some time ago. | |
650 | Because of this dual purpose, the region between mark and point is not | |
651 | highlighted by default unless you select a region by clicking and | |
652 | dragging the mouse. | |
653 | ||
654 | The minor mode @code{transient-mark-mode} changes the behavior of | |
655 | the mark in two ways. First, it distinguishes between an active mark | |
656 | that has just been defined or reactivated, and an inactive mark. When | |
657 | the mark is active, some commands that normally act on lines, words, | |
658 | buffers etc. will instead act on the region. An inactive mark needs | |
659 | to be reactivated to operate on it, unless @code{mark-even-if-inactive} | |
660 | is set. Secondly, @code{transient-mark-mode} also highlights the | |
661 | region when it is active, providing the same visual clue that you get | |
662 | in other programs. | |
663 | ||
664 | In addition to seeing the highlighting, new Emacs users often expect | |
665 | editing commands to replace the region when it is active. This behavior | |
666 | can be obtained with @code{delete-selection-mode}, but see the following | |
667 | question also. | |
668 | ||
669 | @node CUA | |
670 | @subsection Standard Windows key bindings | |
671 | @findex cua-mode | |
672 | @cindex CUA keybindings | |
673 | @cindex shift key, selecting with | |
674 | @cindex standard Windows keybindings | |
675 | @cindex paste with C-v | |
676 | @cindex cut with C-x | |
677 | @cindex copy with C-c | |
678 | @cindex C-c to copy | |
679 | @cindex C-x to cut | |
680 | @cindex C-v to paste | |
681 | ||
682 | The keybindings of Emacs predate modern GUIs, and the keys that were | |
683 | chosen by later GUIs for cut and copy were given important functions | |
684 | as extended keymaps in Emacs. CUA mode attempts to let both bindings | |
685 | co-exist by defining C-x and C-c as @code{kill-region} and | |
686 | @code{copy-region-as-kill} when the region is active, and letting | |
687 | them have their normal Emacs bindings when the region is not active. | |
688 | Many people find this to be an acceptable compromise. CUA mode also | |
689 | defines a number of other keys (C-v, Shift selection), and can be turned | |
690 | on from the @emph{Options} menu. | |
691 | ||
692 | @node Window operations | |
693 | @section Window operations | |
694 | @cindex maximize frames from lisp | |
695 | @cindex minimize frames from lisp | |
696 | @cindex WM_SYSCOMMAND, sending system commands from lisp | |
697 | @cindex system menu, simulating from lisp | |
698 | ||
699 | The function @code{w32-send-sys-command} can be used to simulate | |
700 | choosing commands from the system menu (in the top left corner of the | |
701 | Window) and a few other system wide functions. It takes an integer | |
702 | argument, the value of which should be a valid @code{WM_SYSCOMMAND} | |
703 | message as documented in Microsoft's API documentation. | |
704 | ||
705 | @node Uninstall | |
706 | @section How do I uninstall Emacs? | |
707 | @cindex uninstall Emacs | |
708 | @cindex remove Emacs | |
709 | @cindex clean Emacs registry settings | |
710 | @cindex registry, cleaning the Emacs settings | |
711 | @cindex Start Menu, removing Emacs from | |
712 | @cindex upgrading Emacs | |
713 | @cindex delete Emacs directory | |
714 | ||
715 | Emacs does not come with an uninstall program. No files are installed | |
716 | outside of the Emacs base directory, so deleting that directory is | |
717 | sufficient to clean away the files. If you ran @command{addpm}, | |
718 | you'll need to delete the Start Menu group too. The registry entries | |
719 | inserted by @command{addpm} will not cause any problems if you leave | |
720 | them there, but for the sake of completeness, you can use @command{regedit} | |
721 | to remove the keys under @code{HKEY_LOCAL_MACHINE} orx | |
722 | @code{HKEY_CURRENT_USER}: @code{SOFTWARE\GNU\Emacs}, and the key | |
723 | @code{HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\emacs.exe} if it exists. | |
724 | ||
725 | @node Does not run | |
726 | @section When I run Emacs nothing happens | |
727 | @cindex troubleshooting installation problems | |
728 | @cindex window not appearing, Emacs | |
729 | @cindex failure to run, Emacs | |
730 | @cindex 8.3 filenames, problems caused | |
731 | ||
732 | Emacs could have failed to run for a number of reasons. The most | |
733 | common symptom is that, when Emacs is started, the cursor changes for | |
734 | a second but nothing happens. If this happens to you, it is quite | |
735 | likely that the distribution was unpacked incorrectly. | |
736 | ||
737 | Check for the following to see if there was a problem during unpacking: | |
738 | @enumerate | |
739 | @item | |
740 | Be sure to disable the CR/LF translation or the executables will be | |
741 | unusable. Older versions of WinZipNT would enable this translation by | |
742 | default. If you are using WinZipNT, disable it. | |
743 | @item | |
744 | Check that filenames were not truncated to 8.3. For example, there | |
745 | should be a file CONTRIBUTE in the top level directory; if this has | |
746 | been truncated to CONTRIBU or CONTRI~1, your distribution has been | |
747 | corrupted while unpacking and Emacs will not start. | |
748 | @end enumerate | |
749 | ||
750 | If it is still not working, send mail to the list, describing what | |
751 | you've done, and what you are seeing. (The more information you send | |
752 | the more likely it is that you'll receive a helpful response.. | |
753 | ||
754 | @node Virus | |
755 | @section Does Emacs contain a virus? | |
756 | @cindex virus reported in Emacs | |
757 | @cindex anti-virus software reporting a virus in Emacs | |
758 | ||
759 | There have been reports in the past that some virus scanners claim | |
760 | that the Emacs distribution has a virus. This is extremely unlikely if | |
761 | you have downloaded Emacs from the GNU FTP site or one of its mirrors | |
762 | and the GPG signature for it is valid and listed in the GNU keyring, | |
763 | unless perhaps it is a new release made in the last few days, in which | |
764 | case you should exercise more caution and report the problem. Past | |
765 | problems seem to have been caused by virus checkers running into a | |
766 | buffer size limit when unpacking large tar.gz files for scanning, and | |
767 | reporting the failure as an ``unknown virus''. | |
768 | ||
769 | @node Anti-virus | |
770 | @section What known problems are there with anti-virus software? | |
771 | @cindex anti-virus software, bad interaction with | |
772 | @cindex virus software, bad interaction with | |
773 | @cindex firewall, bad interaction with | |
774 | @cindex scan all files, anti-virus option causing problems | |
775 | @cindex auto protect, anti-virus option causing problems | |
776 | @cindex shell, interacting badly with anti-virus | |
777 | @cindex subprocesses, interacting badly with anti-virus | |
778 | ||
779 | Anti-virus and firewall software can block Emacs from starting subprocesses | |
780 | and opening network connections. Most such products have an Advanced | |
781 | mode where they will prompt you rather than silently blocking. In some cases | |
782 | the ``scan all files'' or ``auto protect'' option of anti-virus programs | |
783 | has caused failures running shell related commands within Emacs. | |
784 | @xref{Sub-processes,,Why is nothing happening when I enter shell commands?}. | |
785 | ||
786 | @c ------------------------------------------------------------ | |
787 | @node Display Settings | |
788 | @chapter Display Settings | |
789 | ||
790 | @menu | |
791 | * Console window size:: | |
792 | * Mouse trouble:: | |
793 | * Cut and paste NUL:: | |
794 | * Garbled clipboard:: | |
795 | * Beep sound:: | |
796 | @end menu | |
797 | ||
798 | @node Console window size | |
799 | @section Emacs in console mode goes beyond the window size | |
800 | @cindex console, window size | |
801 | @cindex telnet, display size problems running emacs over | |
802 | @cindex -nw, window size | |
803 | @vindex w32-use-full-screen-buffer | |
804 | ||
805 | The variable @code{w32-use-full-screen-buffer} controls whether Emacs uses | |
806 | the window size or buffer size to determine the number of lines on screen. | |
807 | Normally the window size is correct, but when running Emacs over some | |
808 | telnet servers, the buffer size needs to be used. Emacs tries to guess | |
809 | the correct value at startup, but if it guesses wrong, you can customize | |
810 | that variable yourself. | |
811 | ||
812 | @node Mouse trouble | |
813 | @section What do I do if I have problems with my mouse buttons? | |
814 | @cindex mouse buttons, problems with | |
815 | @cindex 2 button mouse | |
816 | @cindex two button mouse | |
817 | @cindex third mouse button, simulating | |
818 | @cindex middle mouse button, simulating | |
819 | @cindex simulating three button mouse with two buttons | |
820 | @cindex swap right and middle mouse buttons | |
821 | @cindex exchange mouse-2 and mouse-3 buttons | |
822 | @vindex w32-mouse-button-tolerance | |
823 | @vindex w32-num-mouse-buttons | |
824 | @vindex w32-swap-mouse-buttons | |
825 | ||
826 | Emacs assigns bindings assuming a three button mouse. On Windows, if | |
827 | a two button mouse is detected, a hack is enabled which lets you | |
828 | simulate the third button by pressing both mouse buttons | |
829 | simultaneously. @code{w32-mouse-button-tolerance} defines the timeout | |
830 | for what is considered ``simultaneous''. You can check how many | |
831 | buttons Emacs thinks your mouse has with @kbd{C-h v} | |
832 | @code{w32-num-mouse-buttons}. | |
833 | ||
834 | If you find yourself needing the mouse-3 bindings more often than mouse-2, | |
835 | you can swap the buttons with the following code in your init file: | |
836 | @example | |
837 | (setq w32-swap-mouse-buttons t) | |
838 | @end example | |
839 | ||
840 | @node Cut and paste NUL | |
841 | @section How do I cut and paste text with NUL characters? | |
842 | @cindex clipboard, NUL characters | |
843 | ||
844 | If you attempt to cut and paste text with NUL characters embedded in it, | |
845 | then the text will be truncated at the first NUL character. This is a | |
846 | limitation of the Windows clipboard, and does not affect killing and yanking | |
847 | from the kill-ring within Emacs. | |
848 | ||
849 | @node Garbled clipboard | |
850 | @section How can I fix garbled text yanked from the clipboard? | |
851 | @cindex clipboard, corruption of | |
852 | @cindex garbage on the clipboard | |
853 | @cindex clipboard encoding | |
854 | @cindex encoding, clipboard | |
855 | @findex set-selection-coding-system | |
856 | ||
857 | You can try @code{set-selection-coding-system}, but generally such | |
858 | corruption is a thing of the past, as Emacs uses Unicode for the clipboard | |
859 | by default now. | |
860 | ||
861 | @node Beep sound | |
862 | @section How do I change the sound of the Emacs beep? | |
863 | @cindex beep, changing the sound | |
864 | @cindex sound, changing the beep | |
865 | @findex set-message-beep | |
866 | ||
867 | You can use the function @code{set-message-beep} to change the sound | |
868 | that Emacs uses for its beep. This affects both console and GUI frames. | |
869 | The doc string contains a list of the system sounds you can use. | |
870 | ||
871 | @c ------------------------------------------------------------ | |
872 | @node Fonts and text translation | |
873 | @chapter Fonts and text translation | |
874 | ||
875 | @menu | |
876 | * Font names:: | |
877 | * Bold and italic:: | |
878 | * Multilingual fonts:: | |
879 | * BDF fonts:: | |
880 | * Font menu:: | |
881 | * Line ends:: | |
882 | @end menu | |
883 | ||
884 | @node Font names | |
885 | @section Font names | |
886 | @cindex XLFD font names | |
887 | @cindex font XLFD name format | |
888 | @cindex fontconfig font names in Emacs 23 | |
889 | @cindex font dialog, using to find font names | |
890 | @findex w32-select-font | |
891 | @findex x-list-fonts | |
892 | ||
893 | Fonts in Emacs 22 and earlier are named using the X Logical Font | |
894 | Description (XLFD) format. Emacs on Windows ignores many of the | |
895 | fields, and populates them with * when listing fonts. Former | |
896 | maintainer Andrew Innes wrote | |
897 | @uref{http://www.gnu.org/software/emacs/windows/ntemacs/discuss/x-font-details, | |
898 | this explanation} of what each field in the font string means and how | |
899 | Emacs treated them back in 19.34. Since then, multilingual support and | |
900 | a redisplay overhaul to support variable width fonts have changed things | |
901 | slightly; more character sets are recognized (and the old pseudo character | |
902 | sets are deprecated), and the resolution fields are used to calculate the | |
903 | difference between point and pixel sizes, but normally you should leave | |
904 | these at the system default. The foundry field is also populated with | |
905 | an indication of whether the font is outline (.TTF, .ATM) or raster (.FON) | |
906 | based when fonts are listed, which may let you differentiate between two | |
907 | fonts with the same name and different technologies. | |
908 | ||
909 | From Emacs 23, the preferred font name format will be moving to the simpler | |
910 | and more flexible fontconfig format. XLFD names will continue to be | |
911 | supported for backward compatibility. | |
912 | ||
913 | @example | |
914 | XLFD: -*-Courier New-normal-r-*-*-13-*-*-*-c-*-iso8859-1 | |
915 | Fontconfig: Courier New-13 | |
916 | @end example | |
917 | ||
918 | To find the XFLD name for a font, you can execute the following in the | |
919 | @file{*scratch*} buffer by pressing C-j at the end of the line: | |
920 | @example | |
921 | (w32-select-font nil t) | |
922 | @end example | |
923 | ||
924 | To see a complete list of fonts, execute the following in the | |
925 | @file{*scratch*} buffer by pressing C-x C-e at the end of the line: | |
926 | @example | |
927 | (insert (prin1-to-string (x-list-fonts "*"))) | |
928 | @end example | |
929 | ||
930 | The command line options and frame-parameters for changing the default font | |
931 | in Emacs are documented in the manual. Fonts can also be used when defining | |
932 | faces, though family and size are generally specified individually there. | |
933 | In addition, Emacs on Windows reads the registry to find X Resources. This | |
934 | is also documented in the manual. | |
935 | ||
936 | @node Bold and italic | |
937 | @section How can I get bold and italic fonts to work? | |
938 | @cindex italic fonts | |
939 | @cindex synthesized italic and bold fonts | |
940 | @cindex bold fonts, synthesized | |
941 | @findex set-face-font | |
942 | @vindex w32-enable-synthesized-fonts | |
943 | ||
944 | Emacs will only use the italic (and bold) versions of a font automatically | |
945 | if it has the same width as the normal version. Many fonts have italic | |
946 | and bold versions that are slightly wider. It will also only use real | |
947 | bold and italic fonts by default, where other applications may use | |
948 | synthesized variations that are derived from the normal font. To enable | |
949 | more italic and bold fonts to be displayed, you can enable synthesized fonts | |
950 | and manually set the font for italic, bold and bold-italic as follows: | |
951 | ||
952 | @example | |
953 | (setq w32-enable-synthesized-fonts t) | |
954 | (set-face-font 'italic "-*-Courier New-normal-i-*-*-11-*-*-*-c-*-iso8859-1") | |
955 | (set-face-font 'bold-italic "-*-Courier New-bold-i-*-*-11-*-*-*-c-*-iso8859-1") | |
956 | @end example | |
957 | ||
958 | @node Multilingual fonts | |
959 | @section Multilingual font support | |
960 | @cindex multilingual display, fonts | |
961 | @cindex MULE, fonts | |
962 | ||
963 | @menu | |
964 | * Language display:: | |
965 | * Non-latin display:: | |
966 | * International fonts:: | |
967 | * Third-party multibyte:: | |
968 | * Localized fonts:: | |
969 | @end menu | |
970 | ||
971 | @node Language display | |
972 | @subsection Is it possible to display all the supported languages? | |
973 | @cindex HELLO file, displaying all | |
974 | @cindex language support, fonts | |
975 | @cindex GNU intlfonts, for displaying all languages | |
976 | @cindex intlfonts, for displaying all languages | |
977 | ||
978 | To display all the languages that Emacs is capable of displaying, you will | |
979 | require the BDF fonts from the GNU intlfonts package. | |
980 | @xref{Fonts and text translation,,How do I use bdf fonts with Emacs?}. | |
981 | ||
982 | For many languages, native truetype fonts are sufficient, and in Emacs | |
983 | 23 the need for BDF fonts will disappear for almost all languages. At | |
984 | the time of writing, some Arabic characters in the HELLO file still do | |
985 | not display with native fonts, because they are pre-composed characters | |
986 | from MULE character sets rather than standard Unicode Arabic, but all | |
987 | other characters are able to be displayed with appropriate truetype or | |
988 | opentype fonts. | |
989 | ||
990 | @node Non-latin display | |
991 | @subsection How do I get Emacs to display non-latin characters? | |
992 | @cindex fontsets, defining | |
993 | @cindex language support, forcing Emacs to use specific fonts | |
994 | @cindex MULE, fontsets | |
995 | @cindex multilingual display, fontsets | |
996 | @findex create-fontset-from-ascii-font | |
997 | @findex create-fontset-from-fontset-spec | |
998 | ||
999 | Recent versions of Emacs display a large range of characters out of | |
1000 | the box, but if you are having problems with a particular character | |
1001 | set which you know you have fonts for, you can try defining a | |
1002 | new fontset with @code{create-fontset-from-ascii-font} or | |
1003 | @code{create-fontset-from-fontset-spec}. | |
1004 | ||
1005 | @example | |
1006 | (create-fontset-from-fontset-spec | |
1007 | "-*-Courier New-normal-r-*-*-12-*-*-*-c-*-fontset-most, | |
1008 | latin-iso8859-2:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-2, | |
1009 | latin-iso8859-3:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-3, | |
1010 | latin-iso8859-4:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-4, | |
1011 | cyrillic-iso8859-5:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-5, | |
1012 | greek-iso8859-7:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-7, | |
1013 | latin-iso8859-9:-*-Courier New-normal-r-*-*-12-*-*-*-c-*-iso8859-9, | |
1014 | japanese-jisx0208:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, | |
1015 | katakana-jisx0201:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, | |
1016 | latin-jisx0201:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, | |
1017 | japanese-jisx0208-1978:-*-MS Gothic-normal-r-*-*-12-*-*-*-c-*-jisx0208-sjis, | |
1018 | korean-ksc5601:-*-Gulim-normal-r-*-*-12-*-*-*-c-*-ksc5601-*, | |
1019 | chinese-gb2312:-*-MS Song-normal-r-*-*-12-*-*-*-c-*-gb2312-*, | |
1020 | chinese-big5-1:-*-MingLiU-normal-r-*-*-12-*-*-*-c-*-big5-*, | |
1021 | chinese-big5-2:-*-MingLiU-normal-r-*-*-12-*-*-*-c-*-big5-*" t) | |
1022 | @end example | |
1023 | ||
1024 | @node International fonts | |
1025 | @subsection Where can I find fonts for other languages? | |
1026 | @cindex language support, finding fonts | |
1027 | @cindex fonts, where to find | |
1028 | @cindex MULE, finding fonts | |
1029 | @cindex multilingual display, finding fonts | |
1030 | @cindex GNU intlfonts, where to get | |
1031 | @cindex intlfonts, where to get | |
1032 | ||
1033 | In addition to the wide range of fonts that come with the language | |
1034 | support packages of various components of Windows itself, GNU/Linux | |
1035 | distributions these days come with a number of Free truetype fonts | |
1036 | that cover a wide range of languages. The GNU intlfonts source | |
1037 | distribution contains BDF fonts covering all of the languages that can | |
1038 | be displayed by Emacs 22, and can be downloaded from | |
1039 | @uref{http://ftpmirror.gnu.org/intlfonts, ftp.gnu.org mirrors}. | |
1040 | ||
1041 | @node Third-party multibyte | |
1042 | @subsection How do I use third party programs to display multibyte characters? | |
1043 | @cindex multilingual display, third party programs on Windows 9x/ME | |
1044 | @cindex language support, third party programs on Windows 9x/ME | |
1045 | @vindex w32-enable-unicode-output | |
1046 | ||
1047 | You probably only need to do this on the non-Unicode versions of Windows | |
1048 | (95, 98 and ME), and even then, various Windows and Internet Explorer | |
1049 | updates have made third party software unnecessary in most cases. | |
1050 | If you are having trouble displaying text, try defining a fontset | |
1051 | with the font for the languages that the third party software handles | |
1052 | set to what that software expects (which may not be an appropriate font | |
1053 | for that language, but the third party software is intercepting it | |
1054 | and using a different font behind the scenes). | |
1055 | @xref{Non-latin display}. | |
1056 | ||
1057 | In addition to defining a fontset with the expected font, you may also need | |
1058 | to disable unicode output with: | |
1059 | @example | |
1060 | (setq w32-enable-unicode-output nil) | |
1061 | @end example | |
1062 | ||
1063 | @node Localized fonts | |
1064 | @subsection Can I use a font with a name in my language? | |
1065 | @cindex fonts, localized font names | |
1066 | @vindex locale-coding-system | |
1067 | ||
1068 | Normally Emacs should initialize @code{locale-coding-system} appropriately | |
1069 | based on your locale, which will let Emacs use font names in your local | |
1070 | language successfully. | |
1071 | ||
1072 | @node BDF fonts | |
1073 | @section How do I use bdf fonts with Emacs? | |
1074 | @cindex BDF fonts, using | |
1075 | @cindex GNU intlfonts, using | |
1076 | @cindex intlfonts, using | |
1077 | @vindex w32-bdf-filename-alist | |
1078 | @vindex bdf-directory-alist | |
1079 | @vindex font-encoding-alist | |
1080 | @findex w32-find-bdf-fonts | |
1081 | @findex set-frame-font | |
1082 | ||
1083 | To use bdf fonts with Emacs, you need to tell Emacs where the fonts | |
1084 | are located, create fontsets for them, and then use them. We'll use | |
1085 | the 16 dot international fonts from @uref{http://ftpmirror.gnu.org/intlfonts, | |
1086 | ftp.gnu.org/gnu/intlfonts} as an | |
1087 | example put together by Jason Rumney. | |
1088 | ||
1089 | Download @file{16dots.tar.gz} and unpack it; I'll assume that they are in | |
1090 | @file{c:\intlfonts}. Then set @code{w32-bdf-filename-alist} to the list of | |
1091 | fonts returned by using @code{w32-find-bdf-fonts} to enumerate all of | |
1092 | the font files. It is a good idea to set the variable | |
1093 | @code{bdf-directory-list} at the same time so @code{ps-print} knows where | |
1094 | to find the fonts: | |
1095 | @example | |
1096 | (setq bdf-directory-list | |
1097 | '("c:/intlfonts/Asian" "c:/intlfonts/Chinese" | |
1098 | "c:/intlfonts/Chinese-X" "c:/intlfonts/Ethiopic" | |
1099 | "c:/intlfonts/European" "c:/intlfonts/Japanese" | |
1100 | "c:/intlfonts/Japanese-X" "c:/intlfonts/Korean-X" | |
1101 | "c:/intlfonts/Misc/")) | |
1102 | ||
1103 | (setq w32-bdf-filename-alist (w32-find-bdf-fonts bdf-directory-list)) | |
1104 | @end example | |
1105 | ||
1106 | Then create fontsets for the BDF fonts: | |
1107 | ||
1108 | @example | |
1109 | (create-fontset-from-fontset-spec | |
1110 | "-*-fixed-medium-r-normal-*-16-*-*-*-c-*-fontset-bdf, | |
1111 | japanese-jisx0208:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1983-*, | |
1112 | katakana-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*, | |
1113 | latin-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*, | |
1114 | japanese-jisx0208-1978:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1978-*, | |
1115 | thai-tis620:-misc-fixed-medium-r-normal--16-160-72-72-m-80-tis620.2529-1, | |
1116 | lao:-misc-fixed-medium-r-normal--16-160-72-72-m-80-MuleLao-1, | |
1117 | tibetan-1-column:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-80-MuleTibetan-1, | |
1118 | ethiopic:-Admas-Ethiomx16f-Medium-R-Normal--16-150-100-100-M-160-Ethiopic-Unicode, | |
1119 | tibetan:-TibMdXA-fixed-medium-r-normal--16-160-72-72-m-160-MuleTibetan-0") | |
1120 | @end example | |
1121 | ||
1122 | Many of the international bdf fonts from gnu.org are type 0, and therefore | |
1123 | need to be added to font-encoding-alist: | |
1124 | ||
1125 | @example | |
1126 | ;; Need to add some fonts to font-encoding-alist since the bdf fonts | |
1127 | ;; are type 0 not the default type 1. | |
1128 | (setq font-encoding-alist | |
1129 | (append '(("MuleTibetan-0" (tibetan . 0)) | |
1130 | ("GB2312" (chinese-gb2312 . 0)) | |
1131 | ("JISX0208" (japanese-jisx0208 . 0)) | |
1132 | ("JISX0212" (japanese-jisx0212 . 0)) | |
1133 | ("VISCII" (vietnamese-viscii-lower . 0)) | |
1134 | ("KSC5601" (korean-ksc5601 . 0)) | |
1135 | ("MuleArabic-0" (arabic-digit . 0)) | |
1136 | ("MuleArabic-1" (arabic-1-column . 0)) | |
1137 | ("MuleArabic-2" (arabic-2-column . 0))) font-encoding-alist)) | |
1138 | @end example | |
1139 | ||
1140 | You can now use the Emacs font menu (@pxref{Fonts and text | |
1141 | translation,,How can I have Emacs use a font menu like on X?}) to | |
1142 | select the @emph{bdf: 16-dot medium} fontset, or you can select it by | |
1143 | setting the default font: | |
1144 | ||
1145 | @example | |
1146 | (set-frame-font "fontset-bdf") | |
1147 | @end example | |
1148 | ||
1149 | Try loading the file @file{etc/HELLO}, and you should be able to see the | |
1150 | various international fonts displayed (except for Hindi, which is not | |
1151 | included in the 16-dot font distribution). | |
1152 | ||
1153 | @node Font menu | |
1154 | @section How can I have Emacs use a font menu like on X? | |
1155 | @cindex fonts, displaying a menu | |
1156 | @cindex fontsets, displaying a menu | |
1157 | @cindex font dialog, using a menu instead | |
1158 | @vindex w32-use-w32-font-dialog | |
1159 | ||
1160 | Place the following in your init file: | |
1161 | ||
1162 | @example | |
1163 | (setq w32-use-w32-font-dialog nil) | |
1164 | @end example | |
1165 | ||
1166 | @menu | |
1167 | * Add fonts to menu:: | |
1168 | @end menu | |
1169 | ||
1170 | @node Add fonts to menu | |
1171 | @subsection How can I add my font to the font menu? | |
1172 | @cindex font menu, adding fonts | |
1173 | @vindex w32-fixed-font-alist | |
1174 | ||
1175 | If you have set w32-use-w32-font-dialog to nil, you can add fonts to | |
1176 | the font menu by changing `w32-fixed-font-alist'. For example: | |
1177 | ||
1178 | @example | |
1179 | (setq w32-fixed-font-alist | |
1180 | (append w32-fixed-font-alist | |
1181 | '(("Monotype.com" | |
1182 | ("8" "-*-Monotype.com-normal-r-*-*-11-*-*-*-c-iso8859-1") | |
1183 | ("9" "-*-Monotype.com-normal-r-*-*-12-*-*-*-c-iso8859-1") | |
1184 | ("10" "-*-Monotype.com-normal-r-*-*-13-*-*-*-c-iso8859-1") | |
1185 | ("11" "-*-Monotype.com-normal-r-*-*-15-*-*-*-c-iso8859-1"))))) | |
1186 | @end example | |
1187 | ||
1188 | @node Line ends | |
1189 | @section How can I control CR/LF translation? | |
1190 | @cindex DOS line ends | |
1191 | @cindex Unix line ends | |
1192 | @cindex Mac line ends | |
1193 | ||
1194 | There are a number of methods by which you can control automatic CR/LF | |
1195 | translation in Emacs, a situation that reflects the fact that the | |
1196 | default support was not very robust in the past. For a discussion of | |
1197 | this issue, take a look at | |
1198 | @uref{http://www.gnu.org/software/emacs/windows/ntemacs/todo/translate, | |
1199 | this collection of email messages} on the topic. | |
1200 | ||
1201 | @menu | |
1202 | * Automatic line ends:: | |
1203 | * Line ends by filename:: | |
1204 | * Line ends by file system:: | |
1205 | @end menu | |
1206 | ||
1207 | @node Automatic line ends | |
1208 | @subsection Automatic CR/LF translation | |
1209 | @cindex line ends, automatic detection | |
1210 | ||
1211 | For existing files, Emacs scans the file to determine the line ending | |
1212 | convention as part of the same scan it does to determine the file | |
1213 | encoding. Embedded Ctrl-M (ASCII 13) characters and inconsistent line | |
1214 | ends can confuse the automatic scanning, and Emacs will present the | |
1215 | file in Unix (LF) mode with the Ctrl-M characters displayed as @samp{^M}. | |
1216 | It does this to be safe, as no data loss will occur if the file is really | |
1217 | binary and the Ctrl-M characters are significant. | |
1218 | ||
1219 | @node Line ends by filename | |
1220 | @subsection CR/LF translation by file extension | |
1221 | @cindex line ends, determining by filename | |
1222 | @cindex binary files, determining by file name | |
1223 | @vindex file-name-buffer-file-type-alist | |
1224 | ||
1225 | The variable @code{file-name-buffer-file-type-alist} holds a list of | |
1226 | filename patterns and their associated type; binary or text. Files marked | |
1227 | as binary will not have line-end detection performed on them, and instead | |
1228 | will always be displayed as is. With auto-detection in recent versions of | |
1229 | Emacs, this is seldom useful for existing files, but can still be used | |
1230 | to influence the choice of line ends for newly created files. | |
1231 | ||
1232 | @node Line ends by file system | |
1233 | @subsection CR/LF translation by file system | |
1234 | @cindex line ends, determining by filesystem | |
1235 | @cindex binary files, determining by filesystem | |
1236 | @vindex untranslated-filesystem-list | |
1237 | @findex add-untranslated-filesystem | |
1238 | @findex remove-untranslated-filesystem | |
1239 | ||
1240 | The variable @code{untranslated-filesystem-list} defines whole | |
1241 | directory trees that should not have CR/LF autodetection performed on | |
1242 | them. The list can be manipulated with the functions | |
1243 | @code{add-untranslated-filesystem} and | |
1244 | @code{remove-untranslated-filesystem}. With auto-detection in | |
1245 | recent versions of Emacs, this is seldom useful for existing files, | |
1246 | but can still be used to influence the choice of line ends for newly | |
1247 | created files. | |
1248 | ||
1249 | @c ------------------------------------------------------------ | |
1250 | @node Printing | |
1251 | @chapter Printing | |
1252 | @cindex printing | |
1253 | ||
1254 | A lot of effort has gone into making it easier to print from Emacs on | |
1255 | MS Windows, but this has still been insufficient to keep up with | |
1256 | changes in printing technology from text and postscript based printers | |
1257 | connected via ports that can be accessed directly, to graphical | |
1258 | printers that are only accessible via USB. For details, see | |
1259 | @uref{http://www.emacswiki.org/cgi-bin/wiki/PrintingFromEmacs, Emacs | |
1260 | Wiki}. | |
1261 | ||
1262 | @c ------------------------------------------------------------ | |
1263 | @node Sub-processes | |
1264 | @chapter Subprocesses | |
1265 | @cindex subprocesses | |
1266 | ||
1267 | @menu | |
1268 | * Quoting issues:: | |
1269 | * Subprocess hang:: | |
1270 | * Subprocess buffering:: | |
1271 | * Subprocesses and floppy drive:: | |
1272 | * Killing subprocesses:: | |
1273 | * Subprocess EOF:: | |
1274 | * Using shell:: | |
1275 | * Cygwin paths:: | |
1276 | * Dired ls:: | |
1277 | * Shell echo:: | |
1278 | * Shell completion forward slash:: | |
1279 | * Incorrect DOS version:: | |
1280 | * Shell commands do nothing:: | |
1281 | @end menu | |
1282 | ||
1283 | @node Quoting issues | |
1284 | @section Quoting issues | |
1285 | @cindex quoting arguments to subprocesses | |
1286 | @cindex sub-processes, quoting arguments to | |
1287 | @cindex cygwin, quoting arguments | |
1288 | ||
1289 | The quoting rules for native Windows shells and Cygwin shells have | |
1290 | some subtle differences. When Emacs spawns subprocesses, it tries to | |
1291 | determine whether the process is a Cygwin program and changes its | |
1292 | quoting mechanism appropriately. See this | |
1293 | @uref{http://www.gnu.org/software/emacs/windows/ntemacs/discuss/shell-quoting, | |
1294 | previous discussion} for details. | |
1295 | ||
1296 | @node Subprocess hang | |
1297 | @section Programs reading input hang | |
1298 | @cindex subprocesses, hanging when reading input | |
1299 | @cindex full-screen console programs, as subprocesses | |
1300 | @cindex ftp, client hanging | |
1301 | @findex ftp | |
1302 | ||
1303 | Programs that explicitly use a handle to the console (@file{CON} or | |
1304 | @file{CON:}) instead of stdin and stdout cannot be used as | |
1305 | subprocesses to Emacs, and they will also not work in shell-mode. The | |
1306 | default ftp client on Windows is an example of such a program - this | |
1307 | ftp program is mostly fine for use with @code{ange-ftp} or | |
1308 | @code{tramp}, but not for @kbd{M-x ftp} (@pxref{Network access,,How do | |
1309 | I use FTP within Emacs}). There is no convenient way for either Emacs | |
1310 | or any shell used in @code{shell-mode} to redirect the input and | |
1311 | output of such processes from the console to input and output pipes. | |
1312 | The only workaround is to use a different implementation of the | |
1313 | program that does not use the console directly. Microsoft's new | |
1314 | PowerShell appears to be another such program, so that cannot be used | |
1315 | as a replacement shell for Emacs. | |
1316 | ||
1317 | @node Subprocess buffering | |
1318 | @section Buffering in shells and subprocesses | |
1319 | @cindex subprocesses, buffering output | |
1320 | @cindex output not displaying, subprocesses | |
1321 | @cindex SQL subprocess hanging | |
1322 | @cindex cvs hanging when login needed | |
1323 | @cindex ssh, password prompt not appearing when using with cvs | |
1324 | @findex sql-mode | |
1325 | @findex shell-mode | |
1326 | @cindex setbuf, using in subprocesses to prevent buffering | |
1327 | @cindex setvbuf, using in subprocesses to prevent buffering | |
1328 | ||
1329 | You may notice that some programs, when run in a shell in | |
1330 | @code{shell-mode}, | |
1331 | have their output buffered (e.g., people have found this happening to | |
1332 | them with @code{sql-mode}). When the program has a lot of output, it | |
1333 | overflows the buffering and gets printed to the shell buffer; however, | |
1334 | if the program only outputs a small amount of text, it will remain | |
1335 | buffered and won't appear in the shell buffer. The same can happen | |
1336 | in other subprocesses that themselves run other programs as | |
1337 | subprocesses, for example when using @command{cvs} from Emacs, which | |
1338 | is itself configured to use @command{ssh}, password prompts fail to | |
1339 | appear when expected, and @command{cvs} appears to hang. | |
1340 | ||
1341 | Although it may at first seem like the shell is buffering the output | |
1342 | from the program, it is actually the program that is buffering | |
1343 | output. The C runtime typically decides how to buffer output based | |
1344 | upon whether stdout is bound to a handle to a console window or | |
1345 | not. If bound to a console window, output is buffered line by line; if | |
1346 | bound to a block device, such as a file, output is buffered block by | |
1347 | block. | |
1348 | ||
1349 | In a shell buffer, stdout is a pipe handle and so is buffered in | |
1350 | blocks. If you would like the buffering behavior of your program to | |
1351 | behave differently, the program itself is going to have to be changed; | |
1352 | you can use @code{setbuf} and @code{setvbuf} to manipulate | |
1353 | the buffering semantics. | |
1354 | ||
1355 | Some programs handle this by having an explicit flag to control their | |
1356 | buffering behaviour, typically @option{-i} for interactive. Other | |
1357 | programs manage to detect that they are running under Emacs, by | |
1358 | using @samp{getenv("emacs")} internally. | |
1359 | ||
1360 | @menu | |
1361 | * Perl script buffering:: | |
1362 | @end menu | |
1363 | ||
1364 | @node Perl script buffering | |
1365 | @subsection Perl script buffering | |
1366 | @cindex perl, avoiding buffering when used as a subprocess of Emacs | |
1367 | ||
1368 | A handy solution for Perl scripts to the above problem is to use: | |
1369 | ||
1370 | @example | |
1371 | # Turn all buffering off. | |
1372 | select((select(STDOUT), $| = 1)[0]); | |
1373 | select((select(STDERR), $| = 1)[0]); | |
1374 | select((select(STDIN), $| = 1)[0]); | |
1375 | @end example | |
1376 | ||
1377 | @node Subprocesses and floppy drive | |
1378 | @section 16-bit subprocesses accessing the floppy drive | |
1379 | @cindex floppy drive, access when subprocesses started | |
1380 | @cindex subprocess starting causes floppy drive access | |
1381 | ||
1382 | If you are finding the 16 bit DOS subprocesses cause your A: drive to | |
1383 | be accessed, hanging Emacs until the read times out if there is no | |
1384 | floppy in the drive, check to see if your virus software is causing | |
1385 | the problem. | |
1386 | ||
1387 | @node Killing subprocesses | |
1388 | @section Killing subprocesses on Windows 95/98/Me | |
1389 | @cindex subprocess, killing on Windows 95/98/ME | |
1390 | @cindex killing subprocesses, Windows 95/98/ME | |
1391 | @cindex shutdown, complaints about cmdproxy.exe running | |
1392 | ||
1393 | Emacs cannot guarantee that a subprocess gets killed on Windows 95 and | |
1394 | its descendants, and it is a difficult limitation to work around. To | |
1395 | avoid problems on these systems, you should let subprocesses run to | |
1396 | completion including explicitly exiting shells before killing the | |
1397 | associated buffer. | |
1398 | ||
1399 | If you find that while shutting down, Windows complains that there is | |
1400 | a running @command{cmdproxy.exe} even though you carefully exited all | |
1401 | shells and none were showing in Task Manager before the shutdown, this | |
1402 | could be due to buggy interaction with your virus scanner. | |
1403 | ||
1404 | @node Subprocess EOF | |
1405 | @section Sending EOF to subprocesses | |
1406 | @cindex EOF, sending to subprocesses | |
1407 | @cindex shell terminates when EOF sent to subprocess | |
1408 | @findex process-send-eof | |
1409 | ||
1410 | When an EOF is sent to a subprocess running in an interactive shell | |
1411 | with @code{process-send-eof}, the shell terminates unexpectedly as | |
1412 | if its input was closed. This affects the use of @kbd{C-c C-d} in | |
1413 | shell buffers. See | |
1414 | @uref{http://www.gnu.org/software/emacs/windows/ntemacs/todo/shell-ctrl-d, | |
1415 | this discussion} for more details. | |
1416 | ||
1417 | @node Using shell | |
1418 | @section How do I use a shell in Emacs? | |
1419 | @cindex interactive shell, using | |
1420 | @cindex shell within emacs, using | |
1421 | @findex shell | |
1422 | @findex shell-command | |
1423 | @vindex shell-file-name | |
1424 | @vindex explicit-shell-file-name | |
1425 | ||
1426 | You can start an interactive shell in Emacs by typing @kbd{M-x shell}. | |
1427 | Emacs uses the @env{SHELL} environment variable to determine which | |
1428 | program to use as the shell. To instruct Emacs to use a non-default | |
63442595 | 1429 | shell, you can either set this environment variable, or customize |
1857cd3f GM |
1430 | @code{explicit-shell-file-name}. You can also customize |
1431 | @code{shell-file-name} to change the shell that will be used by | |
1432 | subprocesses that are started with @code{shell-command} and | |
1433 | related non-interactive shell commands. | |
1434 | ||
1435 | @menu | |
1436 | * Bash:: | |
1437 | @end menu | |
1438 | ||
1439 | @node Bash | |
1440 | @subsection bash | |
1441 | @cindex cygwin bash as shell within Emacs | |
1442 | @cindex shell, using cygwin bash within Emacs | |
1443 | @cindex bash, using cygwin shell within Emacs | |
1444 | @vindex comint-scroll-show-maximum-output | |
1445 | @vindex comint-completion-addsuffix | |
1446 | @vindex comint-eol-on-send | |
1447 | @vindex w32-quote-process-args | |
1448 | @vindex shell-mode-hook | |
1449 | ||
1450 | Cygwin bash is a popular shell for use with Emacs. To use bash as the | |
1451 | default shell in Emacs, you can place the following in your init file: | |
1452 | ||
1453 | @example | |
1454 | (defun my-shell-setup () | |
1455 | "For Cygwin bash under Emacs 20" | |
1456 | (setq comint-scroll-show-maximum-output 'this) | |
1457 | (make-variable-buffer-local 'comint-completion-addsuffix)) | |
1458 | (setq comint-completion-addsuffix t) | |
1459 | ;; (setq comint-process-echoes t) ;; reported that this is no longer needed | |
1460 | (setq comint-eol-on-send t) | |
1461 | (setq w32-quote-process-args ?\") | |
1462 | ||
1463 | (setq shell-mode-hook 'my-shell-setup) | |
1464 | @end example | |
1465 | ||
1466 | If you find that you are having trouble with Emacs tracking drive | |
1467 | changes with bash, see Mike Fabian's | |
1468 | @uref{http://www.gnu.org/software/emacs/windows/ntemacs/discuss/drive-tracking, | |
1469 | note}. | |
1470 | ||
1471 | WARNING: Some versions of bash set and use the environment variable | |
1472 | PID. For some as yet unknown reason, if @env{PID} is set and Emacs | |
1473 | passes it on to bash subshells, bash dies (Emacs can inherit the | |
1474 | @env{PID} variable if it's started from a bash shell). If you clear | |
1475 | the @env{PID} variable in your init file, you should be able to | |
1476 | continue to use bash as your subshell: | |
1477 | @example | |
1478 | (setenv "PID" nil) | |
1479 | @end example | |
1480 | ||
1481 | @node Cygwin paths | |
1482 | @section How do I use Cygwin style paths in Emacs? | |
1483 | @cindex cygwin paths, using within Emacs | |
1484 | @cindex mount points, cygwin | |
1485 | @cindex cygwin mount points, using within Emacs | |
1486 | ||
1487 | The package | |
1488 | @uref{http://www.emacswiki.org/cgi-bin/wiki/cygwin-mount.el, | |
1489 | cygwin-mount.el} teaches Emacs about Cygwin mount points. | |
1490 | ||
1491 | @node Dired ls | |
1492 | @section How do I make dired use my ls program? | |
1493 | @cindex dired, using an external ls program | |
1494 | @cindex dired, interpreting symlinks the same way as cygwin | |
1495 | @cindex symlinks in dired, interpreting the same way as cygwin | |
1496 | @cindex cygwin symlinks in dired | |
1497 | @vindex ls-lisp-use-insert-directory-program | |
1498 | @vindex insert-directory-program | |
1499 | ||
1500 | Dired uses an internal lisp implementation of @command{ls} by default | |
1501 | on Windows. For consistent display of symbolic links and other | |
1502 | information with other programs (eg Cygwin) and performance reasons, | |
1503 | you may want to use a Windows port of @command{ls} instead. | |
1504 | ||
1505 | @example | |
1506 | (setq ls-lisp-use-insert-directory-program t) ;; use external ls | |
1507 | (setq insert-directory-program "c:/cygwin/bin/ls") ;; ls program name | |
1508 | @end example | |
1509 | ||
1510 | @node Shell echo | |
1511 | @section How do I prevent shell commands from being echoed? | |
1512 | @cindex echo, suppressing for shell input | |
1513 | @cindex shell commands, suppressing echo | |
1514 | @vindex comint-process-echoes | |
1515 | @vindex comint-mode-hook | |
1516 | @vindex explicit-cmd.exe-args | |
1517 | @vindex explicit-cmdproxy.exe-args | |
1518 | @vindex explicit-bash.exe-args | |
1519 | @vindex explicit-bash-args | |
1520 | @cindex shell specific arguments | |
1521 | ||
1522 | Some shells echo the commands that you send to them, and the echoed | |
1523 | commands appear in the output buffer. In particular, the default | |
1524 | shells, @command{command.com} and @command{cmd.exe}, have this behavior. | |
1525 | ||
1526 | To prevent echoed commands from being printed, you can place the | |
1527 | following in your init file: | |
1528 | ||
1529 | @example | |
1530 | (defun my-comint-init () | |
1531 | (setq comint-process-echoes t)) | |
1532 | (add-hook 'comint-mode-hook 'my-comint-init) | |
1533 | @end example | |
1534 | ||
1535 | If @code{shell-mode} still is not stripping echoed commands, then | |
1536 | you'll have to explicitly tell the shell to not echo commands. You can | |
1537 | do this by setting the @code{explicit-@var{SHELL}-args} variable | |
1538 | appropriately; where @var{SHELL} is the value of your @env{SHELL} | |
1539 | environment variable (do a @kbd{M-: (getenv "SHELL")} to see what it | |
1540 | is currently set to). Assuming that you are on NT and that your | |
1541 | @env{SHELL} environment variable is set to @command{cmd.exe}, | |
1542 | then placing the following in your init file will tell | |
1543 | @command{cmd.exe} to not echo commands: | |
1544 | ||
1545 | @example | |
1546 | (setq explicit-cmd.exe-args '("/q")) | |
1547 | @end example | |
1548 | ||
1549 | The comint package will use the value of this variable as an argument | |
1550 | to @command{cmd.exe} every time it starts up a new shell; the | |
1551 | @option{/q} is the argument to @command{cmd.exe} that stops the | |
1552 | echoing (invoking @samp{cmd /?} in a shell will show you all of the | |
1553 | command line arguments to @command{cmd.exe}). | |
1554 | ||
1555 | Note that this variable is case sensitive; if the value of your | |
1556 | @env{SHELL} environment variable is @command{CMD.EXE} instead, then | |
1557 | this variable needs to be named @code{explicit-CMD.EXE-args} instead. | |
1558 | ||
1559 | @node Shell completion forward slash | |
1560 | @section How can I make shell completion use forward slashes? | |
1561 | @cindex completion, using forward slashes in shell buffers | |
1562 | @cindex forward slashes for completion in shell buffers | |
1563 | @vindex comint-completion-addsuffix | |
1564 | ||
1565 | The character appended to directory names when completing in a shell | |
1566 | buffer is controlled by the variable @code{comint-completion-addsuffix}. | |
1567 | See its documentation (with @kbd{C-h v}) for details. | |
1568 | ||
1569 | @node Incorrect DOS version | |
1570 | @section Why do I get incorrect DOS version messages? | |
1571 | @cindex nmake, Incorrect DOS version messages | |
1572 | @cindex shell, Incorrect DOS version messages | |
1573 | @cindex COMSPEC, effect on subprocesses of subprocesses | |
1574 | ||
1575 | This might happen if, for example, you invoke @command{nmake} in a | |
1576 | shell and it tries to create sub-shells. The problem happens because | |
1577 | when the shell is initially created, the first argument to the shell | |
1578 | is not the directory in which the shell program resides. When this | |
1579 | happens, @command{command.com} fabricates a value for its | |
1580 | @env{COMSPEC} environment variable that is incorrect. Then, when | |
1581 | other programs go to use @env{COMSPEC} to find the shell, they are | |
1582 | given the wrong value. | |
1583 | ||
1584 | The fix for this is to either prevent any arguments from being sent to | |
1585 | the shell when it starts up (in which case @command{command.com} will | |
1586 | use a default, and correct, value for @env{COMSPEC}), or to have the | |
1587 | first argument be the directory in which the shell executable resides. | |
1588 | ||
1589 | @node Shell commands do nothing | |
1590 | @section Why is nothing happening when I enter shell commands? | |
1591 | @cindex shell commands not working | |
1592 | @cindex anti-virus software, bad interaction with | |
1593 | @cindex virus software, bad interaction with | |
1594 | @cindex firewall, bad interaction with | |
1595 | @cindex scan all files, anti-virus option causing problems | |
1596 | @cindex auto protect, anti-virus option causing problems | |
1597 | @cindex shell, interacting badly with anti-virus | |
1598 | ||
1599 | Some anti-virus software has been reported to cause problems with | |
1600 | shells in the past. Try turning off options such as ``Scan all | |
1601 | files''. @xref{Installing Emacs,,What known problems are there with anti-virus software?}. | |
1602 | ||
1603 | @c ------------------------------------------------------------ | |
1604 | @node Network access | |
1605 | @chapter Network access | |
1606 | ||
1607 | @menu | |
1608 | * Mail:: | |
1609 | * Attachments with Gnus:: | |
1610 | * Using FTP:: | |
1611 | * Tramp ssh:: | |
1612 | * telnet:: | |
1613 | @end menu | |
1614 | ||
1615 | @node Mail | |
1616 | @section How do I use mail in Emacs? | |
1617 | ||
1618 | Emacs comes with several options for reading and writing mail. These | |
1619 | are documented in the manual, and the choice of which method to use | |
1620 | depends on personal taste. There are some issues specific to Windows | |
1621 | however, related to the fact that Windows machines do not have the | |
1622 | mail infrastructure that is commonly installed on other platforms, so | |
1623 | mail will not work without some configuration. | |
1624 | ||
1625 | @menu | |
1626 | * Outgoing mail:: | |
1627 | * Incoming mail with Rmail:: | |
1628 | * Incoming mail with Gnus:: | |
1629 | * Incoming mail other:: | |
1630 | @end menu | |
1631 | ||
1632 | @node Outgoing mail | |
1633 | @subsection Outgoing mail | |
1634 | @cindex mail, outgoing | |
1635 | @cindex smtp server | |
1636 | @vindex user-full-name | |
1637 | @vindex user-mail-address | |
1638 | @vindex smtpmail-default-smtp-server | |
1639 | @vindex smtpmail-smtp-server | |
1640 | @vindex send-mail-command | |
1641 | @vindex message-send-mail-function | |
1642 | @findex smtpmail-send-it | |
1643 | @vindex smtpmail-debug-info | |
1644 | ||
1645 | For outgoing mail, you will need to use @file{smtpmail.el} which | |
1646 | allows Emacs to talk directly to SMTP mail servers. This is included | |
1647 | with Emacs, and can be set up as follows: | |
1648 | ||
1649 | @example | |
1650 | (setq user-full-name "@var{Your full name}") | |
1651 | (setq user-mail-address "@var{Your@@email.address}") | |
1652 | (setq smtpmail-default-smtp-server "@var{domain.name.of.your.smtp.server}") | |
1653 | ||
1654 | (setq send-mail-command 'smtpmail-send-it) ; For mail-mode (Rmail) | |
1655 | (setq message-send-mail-function 'smtpmail-send-it) ; For message-mode (Gnus) | |
1656 | @end example | |
1657 | ||
1658 | Note that if you want to change the name of the SMTP server after | |
1659 | smtpmail is loaded, then you'll need to change | |
1660 | @code{smtpmail-smtp-server}. | |
1661 | ||
1662 | If you are experiencing problems with sending large messages, check | |
1663 | the value of the variable @code{smtpmail-debug-info}. If it is non-nil, you | |
1664 | should set it to @code{nil}: | |
1665 | ||
1666 | @node Incoming mail with Rmail | |
1667 | @subsection Incoming mail with Rmail and POP3 | |
1668 | @cindex mail, incoming with rmail | |
1669 | @cindex pop3, using rmail | |
1670 | @cindex rmail, mail client | |
1671 | @cindex movemail, using pop3 | |
1672 | @cindex MAILHOST | |
1673 | @vindex rmail-primary-inbox-list | |
1674 | @vindex rmail-pop-password-required | |
1675 | ||
1676 | For incoming mail using the Rmail package and a POP3 server, you will | |
1677 | need the following configuration: | |
1678 | ||
1679 | @example | |
1680 | (setenv "MAILHOST" "@var{domain.name.of.your.pop3.server}") | |
1681 | (setq rmail-primary-inbox-list '("po:@var{your logon id}")) | |
1682 | (setq rmail-pop-password-required t) | |
1683 | @end example | |
1684 | ||
1685 | @node Incoming mail with Gnus | |
1686 | @subsection Incoming mail with Gnus | |
1687 | @cindex mail, incoming with Gnus | |
1688 | @cindex pop3, using Gnus | |
1689 | @cindex imap, using Gnus | |
1690 | @cindex gnus, mail and news client | |
1691 | ||
1692 | Although Gnus started life as a Usenet news reader, it also makes a | |
1693 | good mail reader, particularly if you subscribe to a lot of mailing | |
1694 | lists, or you want to use IMAP rather than POP3, which is not | |
1695 | supported by Rmail. @xref{Top,The Gnus manual,,gnus, The Gnus manual}. | |
1696 | ||
1697 | @node Incoming mail other | |
1698 | @subsection Other incoming mail options | |
1699 | @cindex mail, other options | |
1700 | @cindex wanderlust, mail and news client | |
1701 | @cindex vm, mail client | |
1702 | @cindex mh-e, mail client | |
1703 | ||
1704 | Other options for reading mail in Emacs include VM, MH-E and Wanderlust. | |
1705 | MH-E is included with Emacs. The others require lisp or executable code | |
1706 | that does not come with Emacs, so you should seek help where you | |
1707 | obtained the packages from if you want to use them. | |
1708 | ||
1709 | @node Attachments with Gnus | |
1710 | @section How do I open attachments in Gnus? | |
1711 | @cindex gnus, attachments | |
1712 | @cindex attachments, in gnus | |
1713 | @cindex mail, attachments in gnus | |
1714 | @cindex .mailcap | |
1715 | @cindex MIME, configuration for Gnus | |
1716 | ||
1717 | In your @env{HOME} directory create a file called @file{.mailcap}, | |
1718 | with contents like the following: | |
1719 | @example | |
1720 | application/zip "C:/Program Files/7-Zip/7zFM.exe" | |
1721 | video/* "C:/Program Files/VideoLAN/VLC/vlc.exe" | |
1722 | @end example | |
1723 | ||
1724 | @strong{Warning:} Associating MIME types with @command{start} or other | |
1725 | generic Windows commands to open arbitrary files might seem like a | |
1726 | good idea, but it leaves your system as open to attack as Outlook | |
1727 | Express was at its worst. Especially dangerous is associating | |
1728 | application/* or */* in this way. | |
1729 | ||
1730 | @node Using FTP | |
1731 | @section How do I use FTP within Emacs? | |
1732 | @cindex ftp, using within Emacs | |
1733 | @cindex ange-ftp | |
1734 | @cindex tramp, ftp | |
1735 | @cindex remote hosts via ftp | |
1736 | @vindex ange-ftp-ftp-program-name | |
1737 | ||
1738 | Windows built in FTP client can be used with ange-ftp. Ange-ftp is | |
1739 | the Emacs package that provides FTP connectivity to tramp, a | |
1740 | multi-protocol remote file access package for Emacs that is enabled by | |
1741 | default. | |
1742 | ||
1743 | The Windows FTP client does have problems with some firewalls, due to | |
1744 | lack of passive mode support, so you may want to try an alternative | |
1745 | ftp client instead. Make sure that the client you are trying is in | |
1746 | your @env{PATH} before the default Windows client, or rename the | |
1747 | default Windows client to avoid it getting in the way. Alternatively | |
1748 | you can customize @code{ange-ftp-ftp-program-name} to the full path to | |
1749 | the version you are trying. @xref{Other useful ports}. | |
1750 | ||
1751 | @node Tramp ssh | |
1752 | @section How do I use Tramp to work in Emacs via SSH? | |
1753 | @cindex tramp, ssh | |
1754 | @cindex ssh, accessing remote hosts within Emacs | |
1755 | @cindex remote hosts via ssh | |
1756 | @cindex openssh | |
1757 | @cindex PuTTY | |
1758 | @cindex plink | |
1759 | @vindex tramp-default-method | |
1760 | @vindex tramp-default-method-alist | |
1761 | ||
1762 | Tramp can use a number of protocols to connect to remote machines to | |
1763 | read files and even run commands on those files remotely. A popular | |
1764 | one is ssh. As well as Cygwin versions of openssh, you can use | |
1765 | PuTTY's command line plink program as the ssh client. The relevant | |
1766 | methods to use in @code{tramp-default-method} or | |
1767 | @code{tramp-default-method-alist} for these options are: | |
1768 | @itemize @w{} | |
1769 | @item | |
1770 | openssh | |
1771 | @itemize | |
1772 | @item @code{scp} Uses scp for copying, ssh for shell operations. | |
1773 | @item @code{scp1} scp with forced SSH protocol version 1 | |
1774 | @item @code{scp2} scp with forced SSH protocol version 2 | |
1775 | @item @code{ssh} Uses ssh with encoding on stdin/stdout for file transfer. | |
1776 | @item @code{ssh1} ssh with forced SSH protocol version 1 | |
1777 | @item @code{ssh2} ssh with forced SSH protocol version 2 | |
1778 | @end itemize | |
1779 | ||
1780 | @item | |
1781 | PuTTY | |
1782 | @itemize | |
1783 | @item @code{pscp} Uses pscp for copying, plink for shell operations. | |
1784 | @item @code{pscp1} pscp, with forced SSH protocol version 1 | |
1785 | @item @code{pscp2} pscp, with forced SSH protocol version 2 | |
1786 | @item @code{plink} Uses plink with encoding on stdin/stdout for file transfer. | |
1787 | @item @code{plink1} plink with forced SSH protocol version 1 | |
1788 | @item @code{plink2} plink with forced SSH protocol version 2 | |
1789 | @end itemize | |
1790 | @end itemize | |
1791 | ||
1792 | @node telnet | |
1793 | @section How do I use telnet with Emacs? | |
1794 | @cindex telnet, in Emacs | |
1795 | @findex telnet | |
1796 | @cindex telnet client, that works with Emacs | |
1797 | ||
1798 | To use telnet-mode on Windows, you need a telnet client that uses | |
1799 | stdin and stdout for input and output. The default Windows client is | |
1800 | a Windows application, and will not work as a subprocess. Several | |
1801 | options exist, but information that was formerly in this FAQ is out of | |
1802 | date now, so no concrete pointers are available. | |
1803 | ||
1804 | @c ------------------------------------------------------------ | |
1805 | @node Text and Utility modes | |
1806 | @chapter Text and Utility modes | |
1807 | ||
1808 | @menu | |
1809 | * TeX:: | |
1810 | * Spell check:: | |
1811 | * Encryption:: | |
1812 | * Mouse wheel:: | |
1813 | * Grep:: | |
1814 | @end menu | |
1815 | ||
1816 | @node TeX | |
1817 | @section How do I use TeX with Emacs? | |
1818 | @cindex tex | |
1819 | @cindex typesetting | |
1820 | ||
1821 | You will need an implementation of TeX for Windows. | |
1822 | A number of implementations are listed on the | |
1823 | @uref{http://www.tug.org/interest.html#free, TeX Users Group} website. | |
1824 | ||
1825 | @menu | |
1826 | * AUCTeX:: | |
1827 | @end menu | |
1828 | ||
1829 | @node AUCTeX | |
1830 | @subsection AUCTeX | |
1831 | @cindex auctex, precompiled for Windows | |
1832 | @cindex latex | |
1833 | @cindex preview-latex | |
1834 | ||
1835 | AUCTeX is an Emacs package for writing LaTeX files, which also | |
1836 | includes preview-latex, an Emacs mode for previewing the formatted | |
1837 | contents of LaTeX documents. Pre-compiled versions for Windows are | |
1838 | available from | |
1839 | @uref{http://www.gnu.org/software/auctex/download-for-windows.html, the | |
1840 | AUCTeX site}. | |
1841 | ||
1842 | @node Spell check | |
1843 | @section How do I perform spell checks? | |
1844 | @cindex spell checking | |
1845 | @cindex ispell | |
1846 | @cindex aspell | |
1847 | @cindex flyspell | |
1848 | @vindex ispell-program-name | |
1849 | @findex flyspell-mode | |
1850 | ||
1851 | Emacs has support for spell checking on demand (@code{ispell}) and as | |
1852 | your type (@code{flyspell}). Both packages depend on a copy of | |
1853 | @command{ispell} 3.2 or a compatible spell-checking program. | |
1854 | GNU Aspell is a popular choice these days, Windows installers are | |
1855 | available from the @uref{http://aspell.net/win32/, official site}. | |
1856 | ||
1857 | Once installed, you will need to configure @code{ispell-program-name} | |
1858 | to tell ispell and flyspell to use @command{aspell} as a replacement for | |
1859 | ispell. You can include the full path to the @file{aspell} binary, which | |
1860 | means you do not need to add its installation directory to the @env{PATH}. | |
1861 | ||
1862 | @node Encryption | |
1863 | @section Emacs and encryption | |
1864 | @cindex encryption | |
1865 | @cindex gpg, Windows binaries | |
1866 | @cindex pgp encryption, with GNU Privacy Guard | |
1867 | @cindex signatures on Emacs distribution, checking | |
1868 | @cindex Emacs distribution, checking digital signatures | |
1869 | ||
1870 | GNU Privacy Guard is a Free replacement for PGP, with Windows binaries | |
1871 | available. See @uref{http://www.gnupg.org/}. | |
1872 | ||
1873 | @node Mouse wheel | |
1874 | @section Why doesn't my wheel mouse work in Emacs? | |
1875 | @cindex mouse wheel | |
1876 | @cindex wheel mouse | |
1877 | @cindex middle button, on wheel mouse | |
1878 | @cindex scrolling, with mouse wheel | |
1879 | ||
1880 | Some wheel mice ship with default settings that do not send the | |
1881 | standard wheel events to programs, but instead try to simulate scroll | |
1882 | bar events. Usually this is configurable from the hardware specific | |
1883 | pages on the mouse control panel. The middle button is often mapped | |
1884 | in the same settings to have some functionality other than sending | |
1885 | middle mouse button events. In some cases, uninstalling the | |
1886 | manufacturer's drivers and telling Windows to use the generic USB or | |
1887 | PS/2 drivers is the only way to make the mouse work properly. | |
1888 | ||
1889 | @node Grep | |
1890 | @section How do I use grep with Emacs? | |
1891 | @cindex searching through files with grep | |
1892 | @cindex grep | |
1893 | @cindex findstr | |
1894 | @findex grep | |
1895 | ||
1896 | The best way to use @kbd{M-x grep} with Emacs is to download a port of | |
1897 | GNU @command{grep}. @xref{Other useful ports}. | |
1898 | ||
1899 | If you want a quick solution without installing extra tools, a poor | |
1900 | substitute that works for simple text searches is to specify the built | |
1901 | in Windows command @command{findstr} as the command to run at the | |
1902 | @kbd{M-x grep} prompt. Normally you will want to use the @option{/n} | |
1903 | argument to @command{findstr}. | |
1904 | ||
1905 | @menu | |
1906 | * Recursive grep:: | |
1907 | @end menu | |
1908 | ||
1909 | @node Recursive grep | |
1910 | @subsection How do I do a recursive grep? | |
1911 | @cindex recursive searching with grep | |
1912 | @cindex grep, recursive through subdirectories | |
1913 | @cindex findstr, recursive | |
1914 | @cindex find, using with grep | |
1915 | @cindex find, the POSIX command | |
1916 | @findex rgrep | |
1917 | @findex grep-find | |
1918 | @findex find-grep-dired | |
1919 | @vindex find-program | |
1920 | @vindex grep-find-command | |
1921 | ||
1922 | The Emacs commands @code{rgrep}, @code{grep-find} | |
1923 | and @code{find-grep-dired} are all different interfaces for | |
1924 | grepping recursively into subdirectories. By default, they use the | |
1925 | command @command{find} to determine which files to work on, and either | |
1926 | run @command{grep} directly from find, or use @command{xargs} to batch | |
1927 | up files and reduce the number of invocations of @command{grep}. | |
1928 | ||
1929 | Windows also comes with a @command{find} command, but it is not in any | |
1930 | way compatible with the POSIX @command{find} that Emacs tries to use. | |
1931 | Emacs expects a @command{find} compatible with GNU findutils. | |
1932 | @xref{Other useful ports}. After you have installed it, you will need | |
1933 | to make sure that Emacs finds this version, not the standard Windows | |
1934 | @command{find} command. You can do this by either renaming the | |
1935 | Windows command, changing your @env{PATH} to ensure that the directory | |
1936 | containing the findutils @file{bin} directory comes before the Windows | |
1937 | system directory, or set the variable @code{find-program} to the full | |
1938 | path to the findutils @command{find} command. | |
1939 | ||
1940 | An alternative if you have a recent version of grep is to customize | |
1941 | @code{grep-find-command} to use @samp{grep -r} instead of both find | |
1942 | and grep. Another alternative if you don't need the full capabilities | |
1943 | of grep is to use @samp{findstr /n /r}. | |
1944 | ||
1945 | @c ------------------------------------------------------------ | |
1946 | @node Developing with Emacs | |
1947 | @chapter Developing with Emacs | |
1948 | ||
1949 | @menu | |
1950 | * MSVC:: | |
1951 | * Borland C++ Builder:: | |
1952 | * Version control:: | |
1953 | * Perldb:: | |
1954 | @end menu | |
1955 | ||
1956 | @node MSVC | |
1957 | @section How do I use Emacs with Microsoft Visual C++ | |
1958 | ||
1959 | There are two ways you can use Emacs in conjunction with MSVC. You | |
1960 | can use Emacs as the editor, and do everything else in the DevStudio | |
1961 | IDE. Or you can use Emacs as an IDE, calling the MSVC command line | |
1962 | tools to build your project. | |
1963 | ||
1964 | @menu | |
1965 | * DevStudio:: | |
1966 | * MSVC command line:: | |
1967 | @end menu | |
1968 | ||
1969 | @node DevStudio | |
1970 | @subsection Emacs as the text editor for DevStudio | |
1971 | @cindex DevStudio, using Emacs as editor in | |
1972 | @cindex MSVC++, using Emacs as editor with | |
1973 | @cindex Visual Studio, using Emacs as editor in | |
1974 | @cindex VisEmacs, add in for MS Developer Studio | |
1975 | ||
1976 | Christopher Payne wrote a Visual Studio add-in that makes Emacs the | |
1977 | default text editor, this has now been taken over by Jeff Paquette. | |
1978 | See the following two URLS for details: | |
1979 | @itemize | |
1980 | @item @uref{http://sourceforge.net/projects/visemacs/} for the latest version. | |
1981 | @item @uref{http://www.smathers.net/VisEmacs.htm} for notes on usage. | |
1982 | @end itemize | |
1983 | ||
1984 | @node MSVC command line | |
1985 | @subsection Using MSVC command line tools from Emacs | |
1986 | @cindex MSVC++, compiling within Emacs | |
1987 | @findex compile | |
1988 | ||
1989 | This is an app note on how to use Microsoft Visual C++ with Emacs. The | |
1990 | experiments done below were done with Emacs 19.34.1 on Windows 95, | |
1991 | using Visual C++ 4.0 Standard Edition. Your mileage may vary. | |
1992 | ||
1993 | This writeup assumes minimal knowledge of Emacs hacking on the part of | |
1994 | the reader. | |
1995 | ||
1996 | @menu | |
1997 | * VC++ environment:: | |
1998 | * Default compile command:: | |
1999 | * Reverting buffers:: | |
2000 | * Edit MSVC:: | |
2001 | @end menu | |
2002 | ||
2003 | @node VC++ environment | |
2004 | @subsubsection VC++ Environment Variables | |
2005 | @cindex vcvars32.bat | |
2006 | @cindex MSVC++, environment variables | |
2007 | ||
2008 | There is a batch file in your VC++ installation's bin directory called | |
2009 | @file{vcvars32.bat}, which sets up the environment variables needed to | |
2010 | run the VC++ command line tools. Arrange for those same environment | |
2011 | variables to be set in your Emacs session. You can do this on Windows | |
2012 | 9x by calling the @file{vcvars32.bat} script from @file{autoexec.bat}. | |
2013 | On other versions of Windows you can set the environment variables | |
2014 | globally using the System control panel. | |
2015 | ||
2016 | For all versions of Windows you can alternatively set the variables | |
2017 | just inside Emacs by using @code{setenv} calls in your init file. | |
2018 | @xref{Installing Emacs,,Where do I put my init file?}. | |
2019 | ||
2020 | You should now be able to compile from Emacs. Load a source file from | |
2021 | a VC++ project. Type @kbd{M-x compile}. Replace the proposed command line | |
2022 | with: | |
2023 | @example | |
2024 | nmake -f @var{ProjectName}.mak | |
2025 | @end example | |
2026 | ||
2027 | You will find that this defaults to a debug build. You can change it | |
2028 | to a release build with: | |
2029 | @example | |
2030 | nmake -f @var{ProjectName}.mak CFG="@var{ProjectName} - Win32 Release" | |
2031 | @end example | |
2032 | ||
2033 | @node Default compile command | |
2034 | @subsubsection Setting the default compile command | |
2035 | @cindex compile, setting default command | |
2036 | @cindex nmake, as default compile command | |
2037 | @vindex compile-command | |
2038 | ||
2039 | Now set the default value for the compile command line. Add the | |
2040 | following to your init file: | |
2041 | ||
2042 | @example | |
2043 | ;; Set up for Visual C++ compiling | |
2044 | (setq compile-command "nmake -f ") | |
2045 | @end example | |
2046 | ||
2047 | If you work on the same project long term, you can add the project | |
2048 | makefile to the string. | |
2049 | ||
2050 | David Biesack suggests that perhaps it's | |
2051 | easy to write a @file{Makefile} in the project directory which does | |
2052 | ||
2053 | @example | |
2054 | PROJECT=MyProject | |
2055 | all: debug | |
2056 | debug: FORCE | |
2057 | nmake /f $(PROJECT).mak CFG="$(PROJECT) - Win32 Debug" | |
2058 | release: FORCE | |
2059 | nmake /f $(PROJECT).mak CFG="$(PROJECT) - Win32 Release" | |
2060 | FORCE: | |
2061 | @end example | |
2062 | ||
2063 | and then you can simply change compile-command to @command{nmake}. | |
2064 | ||
2065 | Caleb T. Deupree reports that on VC++ | |
2066 | 5.0 and up, "You can also set an option in Options/Build to export a | |
2067 | makefile every time the project is saved, which you can then use to | |
2068 | compile with @samp{nmake -f project.mak}." VC++ 4.0 builds the make file | |
2069 | every time, and there is no option. | |
2070 | ||
2071 | @node Reverting buffers | |
2072 | @subsubsection Reverting Buffers | |
2073 | @cindex DevStudio, keeping source in sync | |
2074 | @cindex Visual Studio, keeping source in sync | |
2075 | @cindex MSVC++, keeping source in sync | |
2076 | @findex auto-revert-mode | |
2077 | @findex global-auto-revert-mode | |
2078 | ||
2079 | It is recommended that you use @code{auto-revert-mode} in buffers | |
2080 | that you have open in both Emacs and MSVC++ at the same time. Then if | |
2081 | you mistakenly edit the file in MSVC++, Emacs will pick up your | |
2082 | changes immediately, rather than after you have written lots more code | |
2083 | and attempt to save. | |
2084 | ||
2085 | @node Edit MSVC | |
2086 | @subsubsection Edit with Emacs function for MSVC | |
2087 | @cindex DevStudio, load in Emacs command | |
2088 | @cindex Visual Studio, load in Emacs command | |
2089 | @cindex MSVC++, load in Emacs command | |
2090 | @cindex emacsclient, calling from Visual Studio | |
2091 | ||
2092 | You can also set up VC++ to import a file into Emacs for you, all | |
2093 | ready for editing. In VC++, go to the @code{Tools} pull-down menu, and | |
2094 | click on @code{Customize...}. In the @code{Tools} tab, click on | |
2095 | @code{Add}. Use @code{Browse} to locate the | |
2096 | @file{emacsclientw.exe} file in your Emacs bin directory, and | |
2097 | select it. For arguments, use @option{+$(CurLine)} | |
2098 | @option{"$(FilePath)"} and for the directory use the @code{$(WkspDir)} | |
2099 | (the quotes around FilePath handle paths with spaces in them). Set the | |
2100 | Menu Text to say "Em&acs". The @option{+$(CurLine)} will set point in | |
2101 | Emacs to the same line as the cursor position in VC++. The ampersand | |
2102 | in the word @code{Em&acs} allows you to select emacs from the keyboard. (E | |
2103 | is already used for the OLE control test container.) | |
2104 | ||
2105 | You should now be able to go to any source file in your project. Then, | |
2106 | use the pull-down menu @code{Tools->Emacs}. The active file in your | |
2107 | VC++ IDE should now be front and center in Emacs, all ready to edit as | |
2108 | you wish. If you use keystrokes to work the menus, try @kbd{Alt-T A} to | |
2109 | move the file into Emacs. Binding this tool to a keystroke will be | |
2110 | left as an exercise for the student. | |
2111 | ||
2112 | If you have the option of saving files before running tools, make sure | |
2113 | this option is set. (I don't see it on VC++ 4.0.) | |
2114 | ||
2115 | @node Borland C++ Builder | |
2116 | @section Emacs and Borland C++ Builder | |
2117 | @cindex Borland C++, integration with Emacs | |
2118 | ||
2119 | Jonathan Arnold has written an | |
2120 | @uref{http://www.buddydog.org/C++Builder/c++builder.html, EmacsEdit | |
2121 | ``expert''} for interfacing C++ Builder and Emacs. | |
2122 | ||
2123 | @node Version control | |
2124 | @section Is there a version of my VC software I can use with Emacs? | |
2125 | @cindex version control, integration with Emacs | |
2126 | @cindex revision control, integration with Emacs | |
2127 | @cindex source control, integration with Emacs | |
2128 | @cindex cvs, version control integration with Emacs | |
2129 | @cindex rcs, version control integration with Emacs | |
2130 | @cindex svn, version control integration with Emacs | |
2131 | @cindex git, version control integration with Emacs | |
2132 | @cindex bzr, version control integration with Emacs | |
2133 | @cindex arch, version control integration with Emacs | |
2134 | @cindex mercurial, version control integration with Emacs | |
2135 | @cindex hg, version control integration with Emacs | |
2136 | @cindex monotone, version control integration with Emacs | |
2137 | @cindex mcvs, version control integration with Emacs | |
2138 | ||
2139 | If you are using a graphical revision control tool already, check if | |
2140 | it comes with command-line tools. Many such GUI tools are just | |
2141 | wrappers for the same command line tools that Emacs requires for its | |
2142 | VC integration. Most of the supported VC systems have well supported | |
2143 | Free native Windows binaries. For those that don't Cygwin may be an option. | |
2144 | @xref{Other useful ports}. | |
2145 | ||
2146 | @node Perldb | |
2147 | @section How do I use the Perl debugger with Emacs? | |
2148 | @cindex perl, debugging within Emacs | |
2149 | @cindex perldb, using with Emacs | |
2150 | ||
2151 | From Jay Rogers: | |
2152 | ||
2153 | Some versions of the perl debugger itself need to be patched to work | |
2154 | with emacs. They are perl versions 5.001 and less, and version | |
2155 | 5.004_01. To fix, locate and change the code similar to the following | |
2156 | code in lib/perl5db.pl | |
2157 | @example | |
2158 | if (-e "/dev/tty") @{ | |
2159 | $console = "/dev/tty"; | |
2160 | $rcfile=".perldb"; | |
2161 | @} | |
2162 | elsif (-e "con") @{ | |
2163 | $console = ""; <---- change "con" to "" | |
2164 | $rcfile="perldb.ini"; | |
2165 | @} | |
2166 | else @{ | |
2167 | $console = "sys\$command"; | |
2168 | $rcfile="perldb.ini"; | |
2169 | @} | |
2170 | @end example | |
2171 | ||
2172 | Doug Campbell also has some | |
2173 | @uref{http://www.gnu.org/software/emacs/windows/ntemacs/discuss/perldb, | |
2174 | suggestions} for improving the interaction of perldb and Emacs. | |
2175 | ||
2176 | @c ------------------------------------------------------------ | |
2177 | @node Other useful ports | |
2178 | @chapter Other useful ports | |
2179 | @cindex useful tools | |
2180 | @cindex subprocesses, useful tools | |
2181 | ||
2182 | @menu | |
2183 | * Cygwin:: | |
2184 | * MinGW:: | |
2185 | * UWIN:: | |
2186 | * GnuWin32:: | |
2187 | * GTK:: | |
2188 | * Read man pages:: | |
2189 | @end menu | |
2190 | ||
2191 | @node Cygwin | |
2192 | @section Cygwin | |
2193 | @cindex cygwin environment | |
2194 | @cindex cygwin, library conflicts | |
2195 | @cindex library conflicts with cygwin | |
2196 | @cindex interoperability with cygwin | |
2197 | @cindex subprocesses, cygwin tools | |
2198 | @vindex exec-path | |
2199 | ||
2200 | @uref{http://www.cygwin.com/}. | |
2201 | ||
2202 | Cygwin is a popular complete POSIX emulation environment for Windows. | |
2203 | Most of its tools can be used with Emacs, and it covers a wide range | |
2204 | of ported software. The main shell used by Cygwin is GNU | |
2205 | @command{bash}, but other shells are also available. Some Cygwin | |
2206 | tools may not interoperate well with Emacs or other native Windows | |
2207 | tools, due to the total immersion aspect of Cygwin, including its | |
2208 | non-native filesystem mapping. | |
2209 | ||
2210 | If you choose to use Cygwin, then its tools will probably be all that | |
2211 | you need, but you will need to get image libraries from elsewhere, as | |
2212 | the Cygwin ones are not compatible with non-Cygwin software. In fact, | |
2213 | if Cygwin is on your PATH when you run Emacs, and Emacs does not find | |
2214 | other versions of the image libraries first, then the Cygwin ones can | |
2215 | cause problems. Cygwin developers recommend that you do not put | |
2216 | Cygwin on your system @env{PATH} for this reason. Instead you can | |
2217 | make the Cygwin tools available within Emacs by setting @code{exec-path} | |
2218 | in your init file. | |
2219 | ||
2220 | @node MinGW | |
2221 | @section MinGW and MSYS | |
2222 | @cindex mingw tools | |
2223 | @cindex msys environment | |
2224 | @cindex subprocesses, mingw and msys | |
2225 | ||
2226 | @uref{http://www.mingw.org/} | |
2227 | ||
2228 | MinGW is a set of development tools that produce native Windows | |
2229 | executables, not dependent on Cygwin's POSIX emulation DLLs. | |
2230 | ||
2231 | MSYS is a POSIX shell and minimal set of tools that are commonly used in | |
2232 | configure scripts. Like Cygwin, this environment uses a non-native | |
2233 | filesystem mapping to appear more POSIX like to the scripts that it | |
2234 | runs. This is intended to complement the MinGW tools to make it easier | |
2235 | to port software to Windows. | |
2236 | ||
2237 | @node UWIN | |
2238 | @section UWIN | |
2239 | @cindex uwin environment | |
2240 | @cindex subprocesses, uwin | |
2241 | ||
2242 | @uref{http://www.research.att.com/sw/tools/uwin/} | |
2243 | ||
2244 | UWIN is another POSIX emulation environment, like Cygwin and MSYS, | |
2245 | that provides a large number of ported tools. The shell used by UWIN | |
2246 | is @command{ksh}, the Korn shell. | |
2247 | ||
2248 | @node GnuWin32 | |
2249 | @section GnuWin32 | |
2250 | @cindex gnuwin32 tools | |
2251 | @cindex subprocesses, gnuwin32 | |
2252 | @cindex image libraries, gnuwin32 | |
2253 | @cindex image libraries, development | |
2254 | ||
2255 | @uref{http://gnuwin32.sourceforge.net/} | |
2256 | ||
2257 | GnuWin32 provides precompiled native Windows ports of a wide selection | |
2258 | of Free software and libraries. Tools available here that are useful | |
2259 | for Emacs include: | |
2260 | ||
2261 | @itemize | |
2262 | @item Arc - used by @code{archive-mode} to edit .arc files. | |
2263 | @item Bzip2 - used by Emacs to automatically decompress .bz2 files. | |
2264 | @item CompFace - used by @code{gnus} to display XFace headers in messages. | |
2265 | @item CoreUtils - GNU file, shell and text utilities (also in MSYS) | |
2266 | @item DiffUtils - for @code{ediff} and producing patches | |
2267 | @item FindUtils - for @code{grep-find} and other file searches. | |
2268 | @item GifLib - library to support GIF images. | |
2269 | @item Grep - for searching through files with @code{grep}. | |
2270 | @item Gzip - used by Emacs to automatically decompress .gz files. | |
2271 | @item Jpeg - library to support JPEG images (also in GTK). | |
2272 | @item Lha - used by @code{archive-mode} to edit .lzh files. | |
2273 | @item LibPng - library to support PNG images (also in GTK). | |
2274 | @item LibTiff - library to support TIFF images (also in GTK). | |
2275 | @item Make - used by @code{compile} for building projects (also in MinGW) | |
2276 | @item OpenSSL - used by @code{gnus} to talk to servers over SSL. | |
2277 | @item Patch - used by @code{ediff-patch-file} and others to apply patches. | |
2278 | @item Tar - used by @code{tar-mode} to edit tar files. | |
2279 | @item TexInfo - used to build Emacs' manuals. | |
2280 | @item Unzip - used by @code{archive-mode} for extracting zip files. | |
2281 | @item Xpm - library to support XPM images (bundled with Emacs binaries) | |
2282 | @item Zip - used by @code{archive-mode} for editing zip files. | |
2283 | @item Zlib - required by LibPng (also in GTK). | |
2284 | @end itemize | |
2285 | ||
2286 | @node GTK | |
2287 | @section GTK | |
2288 | @cindex GTK image libraries | |
2289 | @cindex image libraries, GTK | |
2290 | @cindex addpm, using GTK image libraries | |
2291 | ||
2292 | GTK is a potential source for some of the image libraries that Emacs | |
2293 | requires. GTK is installed along with other ports of GUI software, | |
2294 | such as the GIMP image editor, and Pidgin instant messenger client. | |
2295 | If GTK is installed when you run @command{addpm}, Emacs will use the | |
2296 | image libraries that it provides, even if they are not on the | |
2297 | @env{PATH}. GTK ships with JPEG, PNG and TIFF support. | |
2298 | ||
2299 | @node Read man pages | |
2300 | @section How do I read man pages? | |
2301 | @cindex man pages | |
2302 | @findex woman | |
2303 | @findex man | |
2304 | ||
2305 | Man pages for Emacs and other ported programs that you have can be | |
2306 | read using Emacs' built-in manual reader @code{woman}. This | |
2307 | requires no external programs, but if you do have a port of | |
2308 | @command{man}, there is also an Emacs wrapper @code{man} that | |
2309 | which may be slightly faster. | |
2310 | ||
2311 | @c ------------------------------------------------------------ | |
2312 | @node Further information | |
2313 | @chapter Further information | |
2314 | ||
2315 | @menu | |
2316 | * More information:: | |
2317 | * Mailing lists:: | |
2318 | @end menu | |
2319 | ||
2320 | @node More information | |
2321 | @section Where can I get more information about Emacs? | |
2322 | @cindex other sources of information | |
2323 | @cindex faqs, general | |
2324 | @cindex faqs, old | |
2325 | @cindex help, manuals and other sources | |
2326 | @cindex manuals | |
2327 | @cindex wiki | |
2328 | ||
2329 | If you have general questions about Emacs, the best places to start | |
2330 | looking are @ref{Top,,, emacs, The GNU Emacs Manual}, and | |
2331 | @ref{Top,,, efaq, the standard Emacs FAQ}. | |
2332 | In Emacs, you can browse the manual using Info by typing @kbd{C-h r}, | |
2333 | and you can view the FAQ by typing @kbd{C-h C-f}. Other resources include: | |
2334 | ||
2335 | @itemize | |
2336 | @item @uref{http://www.gnu.org/software/emacs/, The Emacs homepage} | |
2337 | @item @uref{http://www.gnu.org/software/emacs/manual/, Other Emacs manuals} | |
2338 | @item @uref{http://www.emacswiki.org/, Emacs Wiki} | |
2339 | @end itemize | |
2340 | ||
2341 | @node Mailing lists | |
2342 | @section What mailing lists are there for discussing Emacs on Windows? | |
2343 | @cindex mailing lists | |
2344 | @cindex help, mailing lists | |
2345 | ||
2346 | The official mailing list for Windows specific help and discussion is | |
2347 | @url{http://lists.gnu.org/mailman/listinfo/help-emacs-windows, | |
2348 | help-emacs-windows}. See that link for information on how to subscribe | |
2349 | or unsubscribe. The | |
2350 | @uref{http://lists.gnu.org/archive/html/help-emacs-windows/, list archives} | |
2351 | are available online. | |
2352 | ||
2353 | @c ------------------------------------------------------------ | |
2354 | @node Indexes | |
2355 | @unnumbered Indexes | |
2356 | ||
2357 | @unnumberedsec Function and Variable Index | |
2358 | ||
2359 | @printindex fn | |
2360 | ||
2361 | @unnumberedsec Concept Index | |
2362 | ||
2363 | @printindex cp | |
2364 | ||
2365 | @bye |