Sync up with r21-2-27.
[chise/xemacs-chise.git-] / info / xemacs-faq.info-5
1 This is Info file ../info/xemacs-faq.info, produced by Makeinfo version
2 1.68 from the input file xemacs-faq.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * FAQ: (xemacs-faq).            XEmacs FAQ.
7 END-INFO-DIR-ENTRY
8
9 \1f
10 File: xemacs-faq.info,  Node: Q5.1.5,  Next: Q5.1.6,  Prev: Q5.1.4,  Up: Miscellaneous
11
12 Q5.1.5: What is the recommended use of `setq'?
13 ----------------------------------------------
14
15    * Global variables
16
17      You will typically `defvar' your global variable to a default
18      value, and use `setq' to set it later.
19
20      It is never a good practice to `setq' user variables (like
21      `case-fold-search', etc.), as it ignores the user's choice
22      unconditionally.  Note that `defvar' doesn't change the value of a
23      variable if it was bound previously.  If you wish to change a
24      user-variable temporarily, use `let':
25
26           (let ((case-fold-search nil))
27             ...                                 ; code with searches that must be case-sensitive
28             ...)
29
30      You will notice the user-variables by their docstrings beginning
31      with an asterisk (a convention).
32
33    * Local variables
34
35      Bind them with `let', which will unbind them (or restore their
36      previous value, if they were bound) after exiting from the `let'
37      form.  Change the value of local variables with `setq' or whatever
38      you like (e.g. `incf', `setf' and such).  The `let' form can even
39      return one of its local variables.
40
41      Typical usage:
42
43           ;; iterate through the elements of the list returned by
44           ;; `hairy-function-that-returns-list'
45           (let ((l (hairy-function-that-returns-list)))
46             (while l
47               ... do something with (car l) ...
48               (setq l (cdr l))))
49
50      Another typical usage includes building a value simply to work
51      with it.
52
53           ;; Build the mode keymap out of the key-translation-alist
54           (let ((inbox (file-truename (expand-file-name box)))
55                 (i 0))
56             ... code dealing with inbox ...
57             inbox)
58
59      This piece of code uses the local variable `inbox', which becomes
60      unbound (or regains old value) after exiting the form.  The form
61      also returns the value of `inbox', which can be reused, for
62      instance:
63
64           (setq foo-processed-inbox
65                 (let .....))
66
67 \1f
68 File: xemacs-faq.info,  Node: Q5.1.6,  Next: Q5.1.7,  Prev: Q5.1.5,  Up: Miscellaneous
69
70 Q5.1.6: What is the typical misuse of `setq' ?
71 ----------------------------------------------
72
73    A typical misuse is probably `setq'ing a variable that was meant to
74 be local.  Such a variable will remain bound forever, never to be
75 garbage-collected.  For example, the code doing:
76
77      (defun my-function (whatever)
78        (setq a nil)
79        ... build a large list ...
80        ... and exit ...)
81
82    does a bad thing, as `a' will keep consuming memory, never to be
83 unbound.  The correct thing is to do it like this:
84
85      (defun my-function (whatever)
86        (let (a)                         ; default initialization is to nil
87          ... build a large list ...
88          ... and exit, unbinding `a' in the process  ...)
89
90    Not only is this prettier syntactically, but it makes it possible for
91 Emacs to garbage-collect the objects which `a' used to reference.
92
93    Note that even global variables should not be `setq'ed without
94 `defvar'ing them first, because the byte-compiler issues warnings.  The
95 reason for the warning is the following:
96
97      (defun flurgoze nil)                       ; ok, global internal variable
98      ...
99      
100      (setq flurghoze t)                 ; ops!  a typo, but semantically correct.
101                                         ; however, the byte-compiler warns.
102      
103      While compiling toplevel forms:
104      ** assignment to free variable flurghoze
105
106 \1f
107 File: xemacs-faq.info,  Node: Q5.1.7,  Next: Q5.1.8,  Prev: Q5.1.6,  Up: Miscellaneous
108
109 Q5.1.7: I like the the `do' form of cl, does it slow things down?
110 -----------------------------------------------------------------
111
112    It shouldn't.  Here is what Dave Gillespie has to say about cl.el
113 performance:
114
115      Many of the advanced features of this package, such as `defun*',
116      `loop', and `setf', are implemented as Lisp macros.  In
117      byte-compiled code, these complex notations will be expanded into
118      equivalent Lisp code which is simple and efficient.  For example,
119      the forms
120
121           (incf i n)
122           (push x (car p))
123
124      are expanded at compile-time to the Lisp forms
125
126           (setq i (+ i n))
127           (setcar p (cons x (car p)))
128
129      which are the most efficient ways of doing these respective
130      operations in Lisp.  Thus, there is no performance penalty for
131      using the more readable `incf' and `push' forms in your compiled
132      code.
133
134      *Interpreted* code, on the other hand, must expand these macros
135      every time they are executed.  For this reason it is strongly
136      recommended that code making heavy use of macros be compiled.  (The
137      features labelled "Special Form" instead of "Function" in this
138      manual are macros.)  A loop using `incf' a hundred times will
139      execute considerably faster if compiled, and will also
140      garbage-collect less because the macro expansion will not have to
141      be generated, used, and thrown away a hundred times.
142
143      You can find out how a macro expands by using the `cl-prettyexpand'
144      function.
145
146 \1f
147 File: xemacs-faq.info,  Node: Q5.1.8,  Next: Q5.1.9,  Prev: Q5.1.7,  Up: Miscellaneous
148
149 Q5.1.8: I like recursion, does it slow things down?
150 ---------------------------------------------------
151
152    Yes.  Emacs byte-compiler cannot do much to optimize recursion.  But
153 think well whether this is a real concern in Emacs.  Much of the Emacs
154 slowness comes from internal mechanisms such as redisplay, or from the
155 fact that it is an interpreter.
156
157    Please try not to make your code much uglier to gain a very small
158 speed gain.  It's not usually worth it.
159
160 \1f
161 File: xemacs-faq.info,  Node: Q5.1.9,  Next: Q5.1.10,  Prev: Q5.1.8,  Up: Miscellaneous
162
163 Q5.1.9: How do I put a glyph as annotation in a buffer?
164 -------------------------------------------------------
165
166    Here is a solution that will insert the glyph annotation at the
167 beginning of buffer:
168
169      (make-annotation (make-glyph '([FORMAT :file FILE]
170                                     [string :data "fallback-text"]))
171                       (point-min)
172                       'text
173                       (current-buffer))
174
175    Replace `FORMAT' with an unquoted symbol representing the format of
176 the image (e.g. `xpm', `xbm', `gif', `jpeg', etc.)  Instead of `FILE',
177 use the image file name (e.g.
178 `/usr/local/lib/xemacs-20.2/etc/recycle.xpm').
179
180    You can turn this to a function (that optionally prompts you for a
181 file name), and inserts the glyph at `(point)' instead of `(point-min)'.
182
183 \1f
184 File: xemacs-faq.info,  Node: Q5.1.10,  Next: Q5.1.11,  Prev: Q5.1.9,  Up: Miscellaneous
185
186 Q5.1.10: `map-extents' won't traverse all of my extents!
187 --------------------------------------------------------
188
189    I tried to use `map-extents' to do an operation on all the extents
190 in a region.  However, it seems to quit after processing a random number
191 of extents.  Is it buggy?
192
193    No.  The documentation of `map-extents' states that it will iterate
194 across the extents as long as FUNCTION returns `nil'.  Unexperienced
195 programmers often forget to return `nil' explicitly, which results in
196 buggy code.  For instance, the following code is supposed to delete all
197 the extents in a buffer, and issue as many `fubar!' messages.
198
199      (map-extents (lambda (ext ignore)
200                     (delete-extent ext)
201                     (message "fubar!")))
202
203    Instead, it will delete only the first extent, and stop right there -
204 because `message' will return a non-nil value.  The correct code is:
205
206      (map-extents (lambda (ext ignore)
207                     (delete-extent ext)
208                     (message "fubar!")
209                     nil))
210
211 \1f
212 File: xemacs-faq.info,  Node: Q5.1.11,  Next: Q5.2.1,  Prev: Q5.1.10,  Up: Miscellaneous
213
214 Q5.1.11: My elisp program is horribly slow.  Is there
215 -----------------------------------------------------
216
217    an easy way to find out where it spends time?
218
219    zHrvoje Niksic <hniksic@xemacs.org> writes:
220      Under XEmacs 20.4 and later  you can use `M-x
221      profile-key-sequence', press a key (say <RET> in the Gnus Group
222      buffer), and get the results using `M-x profile-results'.  It
223      should give you an idea of where the time is being spent.
224
225 \1f
226 File: xemacs-faq.info,  Node: Q5.2.1,  Next: Q5.2.2,  Prev: Q5.1.11,  Up: Miscellaneous
227
228 Q5.2.1: How do I turn off the sound?
229 ------------------------------------
230
231    Add the following line to your `.emacs':
232
233      (setq bell-volume 0)
234      (setq sound-alist nil)
235
236    That will make your XEmacs totally silent - even the default ding
237 sound (TTY beep on TTY-s) will be gone.
238
239    Starting with XEmacs-20.2 you can also change these with Customize.
240 Select from the `Options' menu
241 `Customize->Emacs->Environment->Sound->Sound...' or type `M-x customize
242 <RET> sound <RET>'.
243
244 \1f
245 File: xemacs-faq.info,  Node: Q5.2.2,  Next: Q5.2.3,  Prev: Q5.2.1,  Up: Miscellaneous
246
247 Q5.2.2: How do I get funky sounds instead of a boring beep?
248 -----------------------------------------------------------
249
250    Make sure your XEmacs was compiled with sound support, and then put
251 this in your `.emacs':
252
253      (load-default-sounds)
254
255    The sound support in XEmacs 19.14 was greatly improved over previous
256 versions.
257
258 \1f
259 File: xemacs-faq.info,  Node: Q5.2.3,  Next: Q5.2.4,  Prev: Q5.2.2,  Up: Miscellaneous
260
261 Q5.2.3: What's NAS, how do I get it?
262 ------------------------------------
263
264    *Note Q2.0.3::, for an explanation of the "Network Audio System".
265
266 \1f
267 File: xemacs-faq.info,  Node: Q5.2.4,  Next: Q5.3.1,  Prev: Q5.2.3,  Up: Miscellaneous
268
269 Q5.2.4: Sunsite sounds don't play.
270 ----------------------------------
271
272    I'm having some trouble with sounds I've downloaded from sunsite.
273 They play when I run them through `showaudio' or cat them directly to
274 `/dev/audio', but XEmacs refuses to play them.
275
276    Markus Gutschke <gutschk@uni-muenster.de> writes:
277
278      [Many of] These files have an (erroneous) 24byte header that tells
279      about the format that they have been recorded in. If you cat them
280      to `/dev/audio', the header will be ignored and the default
281      behavior for /dev/audio will be used. This happens to be 8kHz
282      uLaw. It is probably possible to fix the header by piping through
283      `sox' and passing explicit parameters for specifying the sampling
284      format; you then need to perform a 'null' conversion from SunAudio
285      to SunAudio.
286
287 \1f
288 File: xemacs-faq.info,  Node: Q5.3.1,  Next: Q5.3.2,  Prev: Q5.2.4,  Up: Miscellaneous
289
290 5.3: Miscellaneous
291 ==================
292
293 Q5.3.1: How do you make XEmacs indent CL if-clauses correctly?
294 --------------------------------------------------------------
295
296    I'd like XEmacs to indent all the clauses of a Common Lisp `if' the
297 same amount instead of indenting the 3rd clause differently from the
298 first two.
299
300    One way is to add, to `.emacs':
301
302      (put 'if 'lisp-indent-function nil)
303
304    However, note that the package `cl-indent' that comes with XEmacs
305 sets up this kind of indentation by default.  `cl-indent' also knows
306 about many other CL-specific forms.  To use `cl-indent', one can do
307 this:
308
309      (load "cl-indent")
310      (setq lisp-indent-function (function common-lisp-indent-function))
311
312    One can also customize `cl-indent.el' so it mimics the default `if'
313 indentation `then' indented more than the `else'.  Here's how:
314
315      (put 'if 'common-lisp-indent-function '(nil nil &body))
316
317    Also, a new version (1.2) of `cl-indent.el' was posted to
318 comp.emacs.xemacs on 12/9/94.  This version includes more documentation
319 than previous versions.  This may prove useful if you need to customize
320 any indent-functions.
321
322 \1f
323 File: xemacs-faq.info,  Node: Q5.3.2,  Next: Q5.3.3,  Prev: Q5.3.1,  Up: Miscellaneous
324
325 Q5.3.2: Fontifying hang when editing a postscript file.
326 -------------------------------------------------------
327
328    When I try to edit a postscript file it gets stuck saying:
329 `fontifying 'filename' (regexps....)' and it just sits there.  If I
330 press `C-c' in the window where XEmacs was started, it suddenly becomes
331 alive again.
332
333    This was caused by a bug in the Postscript font-lock regular
334 expressions.  It was fixed in 19.13.  For earlier versions of XEmacs,
335 have a look at your `.emacs' file.  You will probably have a line like:
336
337      (add-hook 'postscript-mode-hook    'turn-on-font-lock)
338
339    Take it out, restart XEmacs, and it won't try to fontify your
340 postscript files anymore.
341
342 \1f
343 File: xemacs-faq.info,  Node: Q5.3.3,  Next: Q5.3.4,  Prev: Q5.3.2,  Up: Miscellaneous
344
345 Q5.3.3: How can I print WYSIWYG a font-locked buffer?
346 -----------------------------------------------------
347
348    Font-lock looks nice.  How can I print (WYSIWYG) the highlighted
349 document?
350
351    The package `ps-print', which is now included with XEmacs, provides
352 the ability to do this.  The source code contains complete instructions
353 on its use, in `<xemacs_src_root>/lisp/packages/ps-print.el'.
354
355 \1f
356 File: xemacs-faq.info,  Node: Q5.3.4,  Next: Q5.3.5,  Prev: Q5.3.3,  Up: Miscellaneous
357
358 Q5.3.4: Getting `M-x lpr' to work with postscript printer.
359 ----------------------------------------------------------
360
361    My printer is a Postscript printer and `lpr' only works for
362 Postscript files, so how do I get `M-x lpr-region' and `M-x lpr-buffer'
363 to work?
364
365    Put something like this in your `.emacs':
366
367      (setq lpr-command "a2ps")
368      (setq lpr-switches '("-p" "-1"))
369
370    If you don't use a2ps to convert ASCII to postscript (why not, it's
371 free?), replace with the command you do use.  Note also that some
372 versions of a2ps require a `-Pprinter' to ensure spooling.
373
374 \1f
375 File: xemacs-faq.info,  Node: Q5.3.5,  Next: Q5.3.6,  Prev: Q5.3.4,  Up: Miscellaneous
376
377 Q5.3.5: How do I specify the paths that XEmacs uses for finding files?
378 ----------------------------------------------------------------------
379
380    You can specify what paths to use by using a number of different
381 flags when running configure.  See the section MAKE VARIABLES in the
382 top-level file INSTALL in the XEmacs distribution for a listing of
383 those flags.
384
385    Most of the time, however, the simplest fix is: *do not* specify
386 paths as you might for GNU Emacs.  XEmacs can generally determine the
387 necessary paths dynamically at run time.  The only path that generally
388 needs to be specified is the root directory to install into.  That can
389 be specified by passing the `--prefix' flag to configure.  For a
390 description of the XEmacs install tree, please consult the `NEWS' file.
391
392 \1f
393 File: xemacs-faq.info,  Node: Q5.3.6,  Next: Q5.3.7,  Prev: Q5.3.5,  Up: Miscellaneous
394
395 Q5.3.6: [This question intentionally left blank]
396 ------------------------------------------------
397
398    Obsolete question, left blank to avoid renumbering.
399
400 \1f
401 File: xemacs-faq.info,  Node: Q5.3.7,  Next: Q5.3.8,  Prev: Q5.3.6,  Up: Miscellaneous
402
403 Q5.3.7: Can I have the end of the buffer delimited in some way?
404 ---------------------------------------------------------------
405
406    Say, with: `[END]'?
407
408    Try this:
409
410      (let ((ext (make-extent (point-min) (point-max))))
411        (set-extent-property ext 'start-closed t)
412        (set-extent-property ext 'end-closed t)
413        (set-extent-property ext 'detachable nil)
414        (set-extent-end-glyph ext (make-glyph [string :data "[END]"])))
415
416    Since this is XEmacs, you can specify an icon to be shown on
417 window-system devices.  To do so, change the `make-glyph' call to
418 something like this:
419
420      (make-glyph '([xpm :file "~/something.xpm"]
421                    [string :data "[END]"]))
422
423    You can inline the XPM definition yourself by specifying `:data'
424 instead of `:file'.  Here is such a full-featured version that works on
425 both X and TTY devices:
426
427      (let ((ext (make-extent (point-min) (point-max))))
428        (set-extent-property ext 'start-closed t)
429        (set-extent-property ext 'end-closed t)
430        (set-extent-property ext 'detachable nil)
431        (set-extent-end-glyph ext (make-glyph '([xpm :data "\
432      /* XPM */
433      static char* eye = {
434      \"20 11 7 2\",
435      \"__ c None\"
436      \"_` c #7f7f7f\",
437      \"_a c #fefefe\",
438      \"_b c #7f0000\",
439      \"_c c #fefe00\",
440      \"_d c #fe0000\",
441      \"_e c #bfbfbf\",
442      \"___________`_`_`___b_b_b_b_________`____\",
443      \"_________`_`_`___b_c_c_c_b_b____________\",
444      \"_____`_`_`_e___b_b_c_c_c___b___b_______`\",
445      \"___`_`_e_a___b_b_d___b___b___b___b______\",
446      \"_`_`_e_a_e___b_b_d_b___b___b___b___b____\",
447      \"_`_`_a_e_a___b_b_d___b___b___b___b___b__\",
448      \"_`_`_e_a_e___b_b_d_b___b___b___b___b_b__\",
449      \"___`_`_e_a___b_b_b_d_c___b___b___d_b____\",
450      \"_____`_`_e_e___b_b_b_d_c___b_b_d_b______\",
451      \"_`_____`_`_`_`___b_b_b_d_d_d_d_b________\",
452      \"___`_____`_`_`_`___b_b_b_b_b_b__________\",
453      } ;"]
454                                                [string :data "[END]"]))))
455
456    Note that you might want to make this a function, and put it to a
457 hook.  We leave that as an exercise for the reader.
458
459 \1f
460 File: xemacs-faq.info,  Node: Q5.3.8,  Next: Q5.3.9,  Prev: Q5.3.7,  Up: Miscellaneous
461
462 Q5.3.8: How do I insert today's date into a buffer?
463 ---------------------------------------------------
464
465    Like this:
466
467      (insert (current-time-string))
468
469 \1f
470 File: xemacs-faq.info,  Node: Q5.3.9,  Next: Q5.3.10,  Prev: Q5.3.8,  Up: Miscellaneous
471
472 Q5.3.9: Are only certain syntactic character classes available for abbrevs?
473 ---------------------------------------------------------------------------
474
475    Markus Gutschke <gutschk@uni-muenster.de> writes:
476
477      Yes, abbrevs only expands word-syntax strings. While XEmacs does
478      not prevent you from defining (e.g. with `C-x a g' or `C-x a l')
479      abbrevs that contain special characters, it will refuse to expand
480      them. So you need to ensure, that the abbreviation contains
481      letters and digits only. This means that `xd', `d5', and `5d' are
482      valid abbrevs, but `&d', and `x d' are not.
483
484      If this sounds confusing to you, (re-)read the online
485      documentation for abbrevs (`C-h i m XEmacs <RET> m Abbrevs
486      <RET>'), and then come back and read this question/answer again.
487
488    Starting with XEmacs 20.3 this restriction has been lifted.
489
490 \1f
491 File: xemacs-faq.info,  Node: Q5.3.10,  Next: Q5.3.11,  Prev: Q5.3.9,  Up: Miscellaneous
492
493 Q5.3.10: How can I get those oh-so-neat X-Face lines?
494 -----------------------------------------------------
495
496    Firstly there is an ftp site which describes X-faces and has the
497 associated tools mentioned below, at
498 `ftp://ftp.cs.indiana.edu:/pub/faces/'.
499
500    Then the steps are
501
502   1. Create 48x48x1 bitmap with your favorite tool
503
504   2. Convert to "icon" format using one of xbm2ikon, pbmtoicon, etc.,
505      and then compile the face.
506
507   3.      cat file.xbm | xbm2ikon |compface > file.face
508
509   4. Then be sure to quote things that are necessary for emacs strings:
510
511           cat ./file.face | sed 's/\\/\\\\/g'
512           | sed 's/\"/\\\"/g' > ./file.face.quoted
513
514   5. Then set up emacs to include the file as a mail header - there
515      were a couple of suggestions here--either something like:
516
517           (setq  mail-default-headers
518                  "X-Face:  <Ugly looking text string here>")
519
520      Or, alternatively, as:
521
522           (defun mail-insert-x-face ()
523             (save-excursion
524               (goto-char (point-min))
525               (search-forward mail-header-separator)
526               (beginning-of-line)
527               (insert "X-Face:")
528               (insert-file-contents "~/.face")))
529           
530           (add-hook 'mail-setup-hook 'mail-insert-x-face)
531
532    However, 2 things might be wrong:
533
534    Some versions of pbmtoicon produces some header lines that is not
535 expected by the version of compface that I grabbed. So I found I had to
536 include a `tail +3' in the pipeline like this:
537
538      cat file.xbm | xbm2ikon | tail +3 |compface > file.face
539
540    Some people have also found that if one uses the `(insert-file)'
541 method, one should NOT quote the face string using the sed script .
542
543    It might also be helpful to use Stig's <stig@hackvan.com> script
544 (included in the compface distribution at XEmacs.org) to do the
545 conversion.
546
547    Contributors for this item:
548
549    Paul Emsley, Ricardo Marek, Amir J. Katz, Glen McCort, Heinz Uphoff,
550 Peter Arius, Paul Harrison, and Vegard Vesterheim
551
552 \1f
553 File: xemacs-faq.info,  Node: Q5.3.11,  Next: Q5.3.12,  Prev: Q5.3.10,  Up: Miscellaneous
554
555 Q5.3.11: How do I add new Info directories?
556 -------------------------------------------
557
558    You use something like:
559
560      (setq Info-directory-list (cons
561                            (expand-file-name "~/info")
562                            Info-default-directory-list))
563
564    David Masterson <davidm@prism.kla.com> writes:
565
566      Emacs Info and XEmacs Info do many things differently.  If you're
567      trying to support a number of versions of Emacs, here are some
568      notes to remember:
569
570        1. Emacs Info scans `Info-directory-list' from right-to-left
571           while XEmacs Info reads it from left-to-right, so append to
572           the *correct* end of the list.
573
574        2. Use `Info-default-directory-list' to initialize
575           `Info-directory-list' *if* it is available at startup, but not
576           all Emacsen define it.
577
578        3. Emacs Info looks for a standard `dir' file in each of the
579           directories scanned from #1 and magically concatenates them
580           together.
581
582        4. XEmacs Info looks for a `localdir' file (which consists of
583           just the menu entries from a `dir' file) in each of the
584           directories scanned from #1 (except the first), does a simple
585           concatenation of them, and magically attaches the resulting
586           list to the end of the menu in the `dir' file in the first
587           directory.
588
589      Another alternative is to convert the documentation to HTML with
590      texi2html and read it from a web browser like Lynx or W3.
591
592 \1f
593 File: xemacs-faq.info,  Node: Q5.3.12,  Prev: Q5.3.11,  Up: Miscellaneous
594
595 Q5.3.12: What do I need to change to make printing work?
596 --------------------------------------------------------
597
598    For regular printing there are two variables that can be customized.
599
600 `lpr-command'
601      This should be set to a command that takes standard input and sends
602      it to a printer.  Something like:
603
604           (setq lpr-command "lp")
605
606 `lpr-switches'
607      This should be set to a list that contains whatever the print
608      command requires to do its job.  Something like:
609
610           (setq lpr-switches '("-depson"))
611
612    For postscript printing there are three analogous variables to
613 customize.
614
615 `ps-lpr-command'
616      This should be set to a command that takes postscript on standard
617      input and directs it to a postscript printer.
618
619 `ps-lpr-switches'
620      This should be set to a list of switches required for
621      `ps-lpr-command' to do its job.
622
623 `ps-print-color-p'
624      This boolean variable should be set `t' if printing will be done in
625      color, otherwise it should be set to `nil'.
626
627    NOTE: It is an undocumented limitation in XEmacs that postscript
628 printing (the `Pretty Print Buffer' menu item) *requires* a window
629 system environment.  It cannot be used outside of X11.
630
631 \1f
632 File: xemacs-faq.info,  Node: MS Windows,  Next: Current Events,  Prev: Miscellaneous,  Up: Top
633
634 6 XEmacs on MS Windows
635 **********************
636
637    This is part 6 of the XEmacs Frequently Asked Questions list,
638 written by Hrvoje Niksic and others.  This section is devoted to the MS
639 Windows port of XEmacs.
640
641 * Menu:
642
643
644 General Info
645 * Q6.0.1::      What is the status of the XEmacs port to Windows?
646 * Q6.0.2::      What flavors of MS Windows are supported?
647 * Q6.0.3::      Where are the XEmacs on MS Windows binaries?
648 * Q6.0.4::      Does XEmacs on MS Windows require an X server to run?
649
650 Building XEmacs on MS Windows
651 * Q6.1.1::      I decided to run with X.  Where do I get an X server?
652 * Q6.1.2::      What compiler do I need to compile XEmacs?
653 * Q6.1.3::      How do I compile for the native port?
654 * Q6.1.4::      How do I compile for the X port?
655 * Q6.1.5::      How do I compile for Cygnus' Cygwin?
656 * Q6.1.6::      What do I need for Cygwin?
657
658 Customization and User Interface
659 * Q6.2.1::      How will the port cope with differences in the Windows user interface?
660 * Q6.2.2::      How do I change fonts in XEmacs on MS Windows?
661 * Q6.2.3::      Where do I put my `.emacs' file?
662
663 Miscellaneous
664 * Q6.3.1::      Will XEmacs rename all the win32-* symbols to w32-*?
665 * Q6.3.2::      What are the differences between the various MS Windows emacsen?
666 * Q6.3.3::      What is the porting team doing at the moment?
667
668 \1f
669 File: xemacs-faq.info,  Node: Q6.0.1,  Next: Q6.0.2,  Prev: MS Windows,  Up: MS Windows
670
671 6.0: General Info
672 =================
673
674 Q6.0.1: What is the status of the XEmacs port to Windows?
675 ---------------------------------------------------------
676
677    Is XEmacs really getting ported to MS Windows?  What is the status
678 of the port?
679
680    Yes, a group of volunteers actively works on making XEmacs code base
681 cleanly compile and run on MS Windows operating systems.  The mailing
682 list at <xemacs-nt@xemacs.org> is dedicated to that effort (please use
683 the -request address to subscribe).
684
685    At this time, XEmacs on MS Windows is usable, but lacks some of the
686 features of XEmacs on UNIX and UNIX-like systems.  Notably,
687 internationalization does not work.
688
689 \1f
690 File: xemacs-faq.info,  Node: Q6.0.2,  Next: Q6.0.3,  Prev: Q6.0.1,  Up: MS Windows
691
692 Q6.0.2: What flavors of MS Windows are supported?  The list name implies NT only.
693 ---------------------------------------------------------------------------------
694
695    The list name is misleading, as XEmacs will support both Windows 95,
696 Windows 98 and Windows NT.  The MS Windows-specific code is based on
697 Microsoft Win32 API, and will not work on MS Windows 3.x or on MS-DOS.
698
699 \1f
700 File: xemacs-faq.info,  Node: Q6.0.3,  Next: Q6.0.4,  Prev: Q6.0.2,  Up: MS Windows
701
702 Q6.0.3: Are binary kits available?
703 ----------------------------------
704
705    Binary kits are available at
706 `ftp://ftp.xemacs.org/pub/xemacs/binary-kits/win32/' for the "plain" MS
707 Windows version.
708
709 \1f
710 File: xemacs-faq.info,  Node: Q6.0.4,  Next: Q6.1.1,  Prev: Q6.0.3,  Up: MS Windows
711
712 Q6.0.4: Does XEmacs on MS Windows require an X server to run?
713 -------------------------------------------------------------
714
715    Short answer: No.
716
717    Long answer: XEmacs can be built in several ways in the MS Windows
718 environment, some of them requiring an X server and some not.
719
720    One is what we call the "X" port - it requires X libraries to build
721 and an X server to run.  Internally it uses the Xt event loop and makes
722 use of X toolkits.  Its look is quite un-Windowsy, but it works
723 reliably and supports all of the graphical features of Unix XEmacs.
724
725    The other is what we call the "native" port.  It uses the Win32 API
726 and does not require X libraries to build, nor does it require an X to
727 run.  In fact, it has no connection with X whatsoever.  At this time,
728 the native port obsoletes the X port, providing almost all of its
729 features, including support for menus, scrollbars, toolbars, embedded
730 images and background pixmaps, frame pointers, etc.  Most of the future
731 work will be based on the native port.
732
733    There is also a third special case, the Cygwin port.  It takes
734 advantage of Cygnus emulation library under Win32, which enables it to
735 reuse much of the Unix XEmacs code base, such as processes and network
736 support, or internal select() mechanisms.
737
738    Cygwin port supports all display types - TTY, X & MS gui, and can be
739 built with support for all three.  If you build with ms gui support
740 then the Cygwin version uses the majority of the msw code, which is
741 mostly related to display.  If you want to build with X support you
742 need X libraries.  If you want to build with tty support you need
743 ncurses.  MS gui requires no additional libraries.
744
745    Some of the advantages of the Cygwin version are that it:
746
747    * integrates well with Cygwin environment for existing Cygwin users;
748
749    * uses configure so building with different features is very easy;
750
751    * has process support in X & tty.
752
753    The disadvantage is that it requires several Unix utilities and the
754 whole Cygwin environment, whereas the native port requires only a
755 suitable MS Windows compiler.  Also, it follows the Unix filesystem and
756 process model very closely (some will undoubtedly view this as an
757 advantage).
758
759 \1f
760 File: xemacs-faq.info,  Node: Q6.1.1,  Next: Q6.1.2,  Prev: Q6.0.4,  Up: MS Windows
761
762 6.1: Building XEmacs on MS Windows
763 ==================================
764
765 Q6.1.1: I decided to run with X.  Where do I get an X server?
766 -------------------------------------------------------------
767
768    Pointers to X servers can be found at
769 `http://dao.gsfc.nasa.gov/software/grads/win32/X11R6.3/';
770
771    look for "Where to get an X server".  Also note that, although the
772 above page talks about Cygnus gnu-win32 (Cygwin), the information on X
773 servers is Cygwin-independent.  You don't have to be running/using
774 Cygwin to use these X servers, and you don't have to compile XEmacs
775 under Cygwin to use XEmacs with these X servers.  An "X port" XEmacs
776 compiled under Visual C++ will work with these X servers (as will
777 XEmacs running on a Unix box, redirected to the server running on your
778 PC).
779
780 \1f
781 File: xemacs-faq.info,  Node: Q6.1.2,  Next: Q6.1.3,  Prev: Q6.1.1,  Up: MS Windows
782
783 Q6.1.2: What compiler do I need to compile XEmacs?
784 --------------------------------------------------
785
786    You need Visual C++ 4.2 or 5.0, with the exception of the Cygwin
787 port, which uses Gcc.
788
789 \1f
790 File: xemacs-faq.info,  Node: Q6.1.3,  Next: Q6.1.4,  Prev: Q6.1.2,  Up: MS Windows
791
792 Q6.1.3: How do I compile for the native port?
793 ---------------------------------------------
794
795    Please read the file `nt/README' in the XEmacs distribution, which
796 contains the full description.
797
798 \1f
799 File: xemacs-faq.info,  Node: Q6.1.4,  Next: Q6.1.5,  Prev: Q6.1.3,  Up: MS Windows
800
801 Q6.1.4: How do I compile for the X port?
802 ----------------------------------------
803
804    Again, it is described in `nt/README' in some detail.  Basically, you
805 need to get X11 libraries from ftp.x.org, and compile them.  If the
806 precompiled versions are available somewhere, I don't know of it.
807
808 \1f
809 File: xemacs-faq.info,  Node: Q6.1.5,  Next: Q6.1.6,  Prev: Q6.1.4,  Up: MS Windows
810
811 Q6.1.5: How do I compile for Cygnus' Cygwin?
812 --------------------------------------------
813
814    Similar as on Unix; use the usual `configure' and `make' process.
815 Some problems to watch out for:
816
817    * make sure HOME is set. This controls where you `.emacs' file comes
818      from;
819
820    * CYGWIN32 needs to be set to tty for process support work. e.g.
821      CYGWIN32=tty;
822
823    * picking up some other grep or other unix like tools can kill
824      configure;
825
826    * static heap too small, adjust src/sheap-adjust.h to a more positive
827      number;
828
829    * The Cygwin version doesn't understand `//machine/path' type paths
830      so you will need to manually mount a directory of this form under
831      a unix style directory for a build to work on the directory.
832
833 \1f
834 File: xemacs-faq.info,  Node: Q6.1.6,  Next: Q6.2.1,  Prev: Q6.1.5,  Up: MS Windows
835
836 Q6.1.6: What do I need for Cygwin?
837 ----------------------------------
838
839    You can find the Cygwin tools and compiler at:
840
841    `http://sourceware.cygnus.com/cygwin/'
842
843    You will need version b19 or later.
844
845    You will also need the X libraries.  There are libraries at
846 `http://dao.gsfc.nasa.gov/software/grads/win32/X11R6.3/', but these are
847 not b19 compatible.  You can get b19 X11R6.3 binaries, as well as
848 pre-built ncurses and graphic libraries, from:
849
850    `ftp://ftp.parallax.co.uk/pub/andyp/'.
851
852 \1f
853 File: xemacs-faq.info,  Node: Q6.2.1,  Next: Q6.2.2,  Prev: Q6.1.6,  Up: MS Windows
854
855 6.2: Customization and User Interface
856 =====================================
857
858 Q6.2.1: How will the port cope with differences in the Windows user interface?
859 ------------------------------------------------------------------------------
860
861    XEmacs (and Emacs in general) UI is pretty different from what is
862 expected of a typical MS Windows program.  How will the MS Windows port
863 cope with it?
864
865    Fortunately, Emacs is also one of the most configurable editor beasts
866 in the world.  The MS Windows "look and feel" (mark via shift-arrow,
867 self-inserting deletes region, etc.) can be easily configured via
868 various packages distributed with XEmacs.  The `pending-delete' package
869 is an example of such a utility.
870
871    In future versions, some of these packages might be turned on by
872 default in the MS Windows environment.
873
874 \1f
875 File: xemacs-faq.info,  Node: Q6.2.2,  Next: Q6.2.3,  Prev: Q6.2.1,  Up: MS Windows
876
877 Q6.2.2: How do I change fonts in XEmacs on MS Windows?
878 ------------------------------------------------------
879
880    You can change font manually, but not from the menubar, yet. For
881 example:
882
883          (set-face-font 'default "Lucida Console:Regular:10")
884          (set-face-font 'modeline "MS Sans Serif:Regular:10")
885
886 \1f
887 File: xemacs-faq.info,  Node: Q6.2.3,  Next: Q6.3.1,  Prev: Q6.2.2,  Up: MS Windows
888
889 Q6.2.3: Where do I put my `.emacs' file?
890 ----------------------------------------
891
892    If the HOME environment variable is set, `.emacs' will be looked for
893 there.  Else the directory defaults to `c:\'.
894
895 \1f
896 File: xemacs-faq.info,  Node: Q6.3.1,  Next: Q6.3.2,  Prev: Q6.2.3,  Up: MS Windows
897
898 6.3: Miscellaneous
899 ==================
900
901 Q6.3.1: Will XEmacs rename all the win32-* symbols to w32-*?
902 ------------------------------------------------------------
903
904    In his flavor of Emacs 20, Richard Stallman has renamed all the
905 win32-* symbols to w32-*.  Will XEmacs do the same?
906
907    We consider such a move counter-productive, thus we will not use the
908 `w32' prefix.  However, we do recognize that Win32 name is little more
909 than a marketing buzzword (will it be Win64 in the next release?), so
910 we decided not to use it.  Using `windows-' would be wrong because the
911 term is too generic, which is why we settled on a compromise
912 `mswindows' term.
913
914    Thus all the XEmacs variables and functions directly related to Win32
915 are prefixed `mswindows-'.  The user-variables shared with NT Emacs
916 will be provided as compatibility aliases.
917
918    Architectural note: We believe that there should be a very small
919 number of window-systems-specific variables, and will try to provide
920 generic interfaces whenever possible.
921
922 \1f
923 File: xemacs-faq.info,  Node: Q6.3.2,  Next: Q6.3.3,  Prev: Q6.3.1,  Up: MS Windows
924
925 Q6.3.2: What are the differences between the various MS Windows emacsen?
926 ------------------------------------------------------------------------
927
928    XEmacs, Win-Emacs, DOS Emacs, NT Emacs, this is all very confusing.
929 Could you briefly explain the differences between them?
930
931    Here is a recount of various Emacs versions running on MS Windows:
932
933    * Win-Emacs
934
935         - Win-Emacs is a port of Lucid Emacs 19.6 to MS Windows using X
936           compatibility libraries.  Win-Emacs has been written by Ben
937           Wing.  The MS Windows code has not made it back to Lucid
938           Emacs, which left Win-Emacs pretty much dead for our
939           purposes.  Win-Emacs used to be available at Pearlsoft, but
940           not anymore, since Pearlsoft went out of business.
941
942    * GNU Emacs for DOS
943
944         - GNU Emacs features support for MS-DOS and DJGPP (D.J.
945           Delorie's DOS port of Gcc).  Such an Emacs is heavily
946           underfeatured, because it does not supports long file names,
947           lacks proper subprocesses support, and is far too big
948           compared to typical DOS editors.
949
950    * GNU Emacs compiled with Win32
951
952         - Starting with version 19.30, it has been possible to compile
953           GNU Emacs under MS Windows using the DJGPP compiler and X
954           libraries.  The result is is very similar to GNU Emacs
955           compiled under MS DOS, only it supports longer file names,
956           etc.  This "port" is similar to the "X" flavor of XEmacs on
957           MS Windows.
958
959    * NT Emacs
960
961         - NT Emacs is a version of GNU Emacs modified to compile and
962           run under MS MS Windows 95 and NT using the native Win32 API.
963           As such, it is close in spirit to the XEmacs "native" port.
964
965         - NT Emacs has been written by Geoff Voelker, and more
966           information can be found at
967           `http://www.cs.washington.edu/homes/voelker/ntemacs.html'.
968
969    * XEmacs
970
971         - Beginning with XEmacs 19.12, XEmacs' architecture has been
972           redesigned in such a way to allow clean support of multiple
973           window systems.  At this time the TTY support was added,
974           making X and TTY the first two "window systems" XEmacs
975           supported.  The 19.12 design is the basis for the current
976           native MS Windows code.
977
978         - Some time during 1997, David Hobley (soon joined by Marc
979           Paquette) imported some of the NT-specific portions of GNU
980           Emacs, making XEmacs with X support compile under Windows NT,
981           and creating the "X" port.
982
983         - Several months later, Jonathan Harris sent out initial
984           patches to use the Win32 API, thus creating the native port.
985           Since then, various people have contributed, including Kirill
986           M. Katsnelson (contributed support for menubars, subprocesses
987           and network, as well as loads of other code), Andy Piper
988           (ported XEmacs to Cygwin environment, contributed Windows
989           unexec, Windows-specific glyphs and toolbars code, and more),
990           Jeff Sparkes (contributed scrollbars support) and many others.
991
992 \1f
993 File: xemacs-faq.info,  Node: Q6.3.3,  Prev: Q6.3.2,  Up: MS Windows
994
995 Q6.3.3: What is the porting team doing at the moment?
996 -----------------------------------------------------
997
998    The porting team is continuing work on the MS Windows-specific code.
999
1000 \1f
1001 File: xemacs-faq.info,  Node: Current Events,  Prev: MS Windows,  Up: Top
1002
1003 7 What the Future Holds
1004 ***********************
1005
1006    This is part 7 of the XEmacs Frequently Asked Questions list.  This
1007 section will change monthly, and contains any interesting items that
1008 have transpired over the previous month.  If you are reading this from
1009 the XEmacs distribution, please see the version on the Web or archived
1010 at the various FAQ FTP sites, as this file is surely out of date.
1011
1012 * Menu:
1013
1014 * Q7.0.1::      What is new in 20.2?
1015 * Q7.0.2::      What is new in 20.3?
1016 * Q7.0.3::      What is new in 20.4?
1017 * Q7.0.4::      Procedural changes in XEmacs development.
1018
1019 \1f
1020 File: xemacs-faq.info,  Node: Q7.0.1,  Next: Q7.0.2,  Prev: Current Events,  Up: Current Events
1021
1022 7.0: Changes
1023 ============
1024
1025 Q7.0.1: What is new in 20.2?
1026 ----------------------------
1027
1028    The biggest changes in 20.2 include integration of EFS (the next
1029 generation of ange-ftp) and AUC Tex (the Emacs subsystem that includes a
1030 major mode for editing Tex and LaTeX, and a lot of other stuff).  Many
1031 bugs from 20.0 have been fixed for this release.  20.2 also contains a
1032 new system for customizing XEmacs options, invoked via `M-x customize'.
1033
1034    XEmacs 20.2 is the development release (20.0 was beta), and is no
1035 longer considered unstable.
1036
1037 \1f
1038 File: xemacs-faq.info,  Node: Q7.0.2,  Next: Q7.0.3,  Prev: Q7.0.1,  Up: Current Events
1039
1040 Q7.0.2: What is new in 20.3?
1041 ----------------------------
1042
1043    XEmacs 20.3 was released in November 1997. It contains many bugfixes,
1044 and a number of new features, including Autoconf 2 based configuration,
1045 additional support for Mule (Multi-language extensions to Emacs), many
1046 more customizations, multiple frames on TTY-s, support for multiple info
1047 directories, an enhanced gnuclient, improvements to regexp matching,
1048 increased MIME support, and many, many synches with GNU Emacs 20.
1049
1050    The XEmacs/Mule support has been only seriously tested in a Japanese
1051 locale, and no doubt many problems still remain.  The support for
1052 ISO-Latin-1 and Japanese is fairly strong.  MULE support comes at a
1053 price - about a 30% slowdown from 19.16.  We're making progress on
1054 improving performance and XEmacs 20.3 compiled without Mule (which is
1055 the default) is definitely faster than XEmacs 19.16.
1056
1057    XEmacs 20.3 is the first non-beta v20 release, and will be the basis
1058 for all further development.
1059
1060 \1f
1061 File: xemacs-faq.info,  Node: Q7.0.3,  Next: Q7.0.4,  Prev: Q7.0.2,  Up: Current Events
1062
1063 Q7.0.3: What's new in XEmacs 20.4?
1064 ----------------------------------
1065
1066    XEmacs 20.4 is a bugfix release with no user-visible changes.
1067
1068 \1f
1069 File: xemacs-faq.info,  Node: Q7.0.4,  Prev: Q7.0.3,  Up: Current Events
1070
1071 Q7.0.4: Procedural changes in XEmacs development.
1072 -------------------------------------------------
1073
1074   1. Discussion about the development of XEmacs occurs on the
1075      xemacs-beta mailing list.  Subscriptions to this list will now be
1076      fully automated instead of being handled by hand.  Send a mail
1077      message to <xemacs-beta-request@xemacs.org> with `subscribe' as the
1078      BODY of the message to join the list.  Please note this is a
1079      developers mailing list for people who have an active interest in
1080      the development process.
1081
1082      The discussion of NT XEmacs development is taking place on a
1083      separate mailing list.  Send mail to
1084      <xemacs-nt-request@xemacs.org> to subscribe.
1085
1086   2. Due to the long development cycle in between releases, it has been
1087      decided that intermediate versions will be made available in
1088      source only form for the truly interested.
1089
1090      XEmacs 19.16 was the last 19 release, basically consisting of
1091      19.15 plus the collected bugfixes.
1092
1093   3. As of December 1996, Steve Baur <steve@xemacs.org> has become the
1094      lead maintainer of XEmacs.
1095
1096