89a2b7d32cae441c3a2c593db45dc28104ae4d05
[chise/xemacs-chise.git] / info / xemacs-faq.info-4
1 This is ../info/xemacs-faq.info, produced by makeinfo version 4.0 from
2 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: Q4.2.3,  Next: Q4.2.4,  Prev: Q4.2.2,  Up: Subsystems
11
12 Q4.2.3: How do I make Gnus stay within a single frame?
13 ------------------------------------------------------
14
15    The toolbar code to start Gnus opens the new frame--and it's a
16 feature rather than a bug.  If you don't like it, but would still like
17 to click on the seemly icon, use the following code:
18
19      (defun toolbar-news ()
20        (gnus))
21
22    It will redefine the callback function of the icon to just call
23 `gnus', without all the fancy frame stuff.
24
25 \1f
26 File: xemacs-faq.info,  Node: Q4.2.4,  Next: Q4.3.1,  Prev: Q4.2.3,  Up: Subsystems
27
28 Q4.2.4: How do I customize the From: line?
29 ------------------------------------------
30
31    How do I change the `From:' line?  I have set gnus-user-from-line to
32      Gail Gurman <gail.gurman@sybase.com>
33     , but XEmacs Gnus doesn't use it. Instead it uses
34      Gail Mara Gurman <gailg@deall>
35  and then complains that it's incorrect. Also, as you perhaps can see,
36 my Message-ID is screwy. How can I change that?
37
38 Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:
39
40      Set `user-mail-address' to `gail.gurman@sybase.com' or
41      `mail-host-address' to `sybase.com'.
42
43 \1f
44 File: xemacs-faq.info,  Node: Q4.3.1,  Next: Q4.3.2,  Prev: Q4.2.4,  Up: Subsystems
45
46 4.3: Other Mail & News
47 ======================
48
49 Q4.3.1: How can I read and/or compose MIME messages?
50 ----------------------------------------------------
51
52    VM supports MIME natively.
53
54    You probably want to use the Tools for MIME (tm).  *Note Q4.3.2::,
55 for details.
56
57    Trey Jackson <trey@cs.berkeley.edu> has an Emacs & MIME web page at
58 `http://bmrc.berkeley.edu/~trey/emacs/mime.html'.
59
60    Another possibility is RMIME.  You may find RMIME at
61 `http://www.cinti.net/~rmoody/rmime/index.html'.
62
63 \1f
64 File: xemacs-faq.info,  Node: Q4.3.2,  Next: Q4.3.3,  Prev: Q4.3.1,  Up: Subsystems
65
66 Q4.3.2: What is TM and where do I get it?
67 -----------------------------------------
68
69    TM stands for "Tools for MIME" and not Tiny MIME.  TM integrates
70 with all major XEmacs packages like Gnus (all flavors), VM, MH-E, and
71 mailcrypt.  It provides totally transparent and trouble-free MIME
72 support.  When appropriate a message will be decoded in place in an
73 XEmacs buffer.
74
75    TM now comes as a package with XEmacs 19.16 and XEmacs 20.2.
76
77    TM was written by MORIOKA Tomohiko <morioka@jaist.ac.jp> and
78 KOBAYASHI Shuhei <shuhei-k@jaist.ac.jp>.
79
80    It is based on the work of UMEDA Masanobu
81 <umerin@mse.kyutech.ac.jp>, the original writer of GNUS.
82
83    The following information is from the `README':
84
85    "tm" is a MIME package for GNU Emacs.  tm has following functions:
86
87    * MIME style multilingual header.
88
89    * MIME message viewer (mime/viewer-mode).
90
91    * MIME message composer (mime/editor-mode).
92
93    * MIME extenders for mh-e, GNUS, RMAIL and VM.
94
95    tm is available from following anonymous ftp sites:
96    * `ftp://ftp.unicamp.br/pub/mail/mime/tm/' (Brasil).
97
98    * `ftp://ftp.th-darmstadt.de/pub/editors/GNU-Emacs/lisp/mime/'
99      (Germany).
100
101    * `ftp://ftp.tnt.uni-hannover.de/pub/editors/xemacs/contrib/'
102      (Germany).
103
104    Don't let the installation procedure & instructions stop you from
105 trying this package out--it's much simpler than it looks, and once
106 installed, trivial to use.
107
108 \1f
109 File: xemacs-faq.info,  Node: Q4.3.3,  Next: Q4.3.4,  Prev: Q4.3.2,  Up: Subsystems
110
111 Q4.3.3: Why isn't this `movemail' program working?
112 --------------------------------------------------
113
114    Ben Wing <ben@xemacs.org> writes:
115
116      It wasn't chown'ed/chmod'd correctly.
117
118 \1f
119 File: xemacs-faq.info,  Node: Q4.3.4,  Next: Q4.3.5,  Prev: Q4.3.3,  Up: Subsystems
120
121 Q4.3.4: Movemail is also distributed by Netscape?  Can that cause problems?
122 ---------------------------------------------------------------------------
123
124    Steve Baur <steve@xemacs.org> writes:
125
126      Yes.  Always use the movemail installed with your XEmacs.  Failure
127      to do so can result in lost mail.
128
129    Please refer to Jamie Zawinski's <jwz@jwz.org> notes at
130 `http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/movemail.html'.
131 In particular, this document will show you how to make Netscape use the
132 version of movemail configured for your system by the person who built
133 XEmacs.
134
135 \1f
136 File: xemacs-faq.info,  Node: Q4.3.5,  Next: Q4.4.1,  Prev: Q4.3.4,  Up: Subsystems
137
138 Q4.3.5: Where do I find pstogif (required by tm)?
139 -------------------------------------------------
140
141    pstogif is part of the latex2html package.
142
143    Jan Vroonhof <vroonhof@math.ethz.ch> writes:
144
145    latex2html is best found at the CTAN hosts and their mirrors in
146 `tex-archive/support/latex2html'.
147
148    CTAN hosts are:
149
150    * `ftp://ftp.tex.ac.uk/tex-archive/support/latex2html/'.
151
152    * `ftp://ftp.dante.de/tex-archive/support/latex2html/'.
153
154    There is a good mirror at ftp.cdrom.com;
155 `ftp://ftp.cdrom.com/pub/tex/ctan/support/latex2html/'.
156
157 \1f
158 File: xemacs-faq.info,  Node: Q4.4.1,  Next: Q4.4.2,  Prev: Q4.3.5,  Up: Subsystems
159
160 4.4: Sparcworks, EOS, and WorkShop
161 ==================================
162
163 Q4.4.1: What is SPARCworks, EOS, and WorkShop?
164 ----------------------------------------------
165
166    John Turner <turner@lanl.gov> writes:
167
168      SPARCworks is SunSoft's development environment, comprising
169      compilers (C, C++, FORTRAN 77, Fortran 90, Ada, and Pascal), a
170      debugger, and other tools such as TeamWare (for configuration
171      management), MakeTool, etc.
172
173    See `http://www.sun.com/software/Developer-products/' for more info.
174
175    EOS stands for "Era on SPARCworks", but I don't know what Era stands
176 for.
177
178    EOS is the integration of XEmacs with the SPARCworks debugger.  It
179 allows one to use an XEmacs frame to view code (complete with
180 fontification, etc.), set breakpoints, print variables, etc., while
181 using the SPARCworks debugger.  It works very well and I use it all the
182 time.
183
184    Chuck Thompson <cthomp@xemacs.org> writes:
185
186      Era stood for "Emacs Rewritten Again".  It was what we were
187      calling the modified version of Lucid Emacs for Sun when I was
188      dragged, er, allowed to work on this wonderful editor.
189
190    Martin Buchholz <martin@xemacs.org> writes:
191
192      EOS is being replaced with a new graphical development environment
193      called Sun WorkShop, which is currently (07/96) in Alpha Test.
194      For more details, check out
195      `http://www.sun.com/software/Products/Developer-products'.
196
197 \1f
198 File: xemacs-faq.info,  Node: Q4.4.2,  Next: Q4.5.1,  Prev: Q4.4.1,  Up: Subsystems
199
200 Q4.4.2: How do I start the Sun Workshop support in XEmacs 21?
201 -------------------------------------------------------------
202
203    Add the switch --with-workshop to the configure command when building
204 XEmacs and put the following in one of your startup files (e.g.
205 site-start.el or .emacs):
206
207      (when (featurep 'tooltalk)
208        (load "tooltalk-macros")
209        (load "tooltalk-util")
210        (load "tooltalk-init"))
211      (when (featurep 'sparcworks)
212        (load "sunpro-init")
213        (load "ring")
214        (load "comint")
215        (load "annotations")
216        (sunpro-startup))
217
218    If you are not using the latest Workshop (5.0) you have to apply the
219 following patch:
220
221 --- /opt/SUNWspro/lib/eserve.el.ORIG    Fri May 14 15:23:26 1999
222 +++ /opt/SUNWspro/lib/eserve.el Fri May 14 15:24:54 1999
223 @@ -42,7 +42,7 @@
224  (defvar running-xemacs nil "t if we're running XEmacs")
225  (defvar running-emacs  nil "t if we're running GNU Emacs 19")
226
227 -(if (string-match "^\\(19\\|20\\)\..*\\(XEmacs\\|Lucid\\)" emacs-version)
228 +(if (string-match "\\(XEmacs\\|Lucid\\)" emacs-version)
229      (setq running-xemacs t)
230      (setq running-emacs  t))
231
232 \1f
233 File: xemacs-faq.info,  Node: Q4.5.1,  Next: Q4.6.1,  Prev: Q4.4.2,  Up: Subsystems
234
235 4.5: Energize
236 =============
237
238 Q4.5.1: What is/was Energize?
239 -----------------------------
240
241    David N Gray <gray@meteor.harlequin.com> writes:
242      The files in `lisp/energize' are to enable Emacs to interface with
243      the "Energize Programming System", a C and C++ development
244      environment, which was a product of Lucid, Inc.  Tragically, Lucid
245      went out of business in 1994, so although Energize is still a
246      great system, if you don't already have it, there isn't any way to
247      get it now.  (Unless you happen to be in Japan; INS Engineering
248      may still be selling it there.  Tartan bought the rights to sell
249      it in the rest of the world, but never did so.)
250
251 \1f
252 File: xemacs-faq.info,  Node: Q4.6.1,  Next: Q4.7.1,  Prev: Q4.5.1,  Up: Subsystems
253
254 4.6: Infodock
255 =============
256
257 Q4.6.1: What is Infodock?
258 -------------------------
259
260    InfoDock is an integrated productivity toolset, mainly aimed at
261 technical people.  It is developed and supported by InfoDock
262 Associates, a firm that offers custom support and development for
263 InfoDock, XEmacs and GNU Emacs.  ( `http://www.infodock.com',
264 <info@infodock.com>, +1 408 243 3300).
265
266    InfoDock is built atop the XEmacs variant of GNU Emacs and so has
267 all of the power of Emacs, but with an easier to use and more
268 comprehensive menu-based user interface.  The bottom portion of this
269 text describes how it differs from XEmacs and GNU Emacs from the Free
270 Software Foundation.
271
272    InfoDock is aimed at people who want a free, turn-key productivity
273 environment.  Although InfoDock is customizable, it is not intended for
274 people who like basic versions of Emacs which need to be customized
275 extensively for local use; standard Emacs distributions are better for
276 such uses.  InfoDock is for those people who want a complete,
277 pre-customized environment in one package, which they need not touch
278 more than once or twice a year to update to new revisions.
279
280    InfoDock is pre-built for SPARC SunOS/Solaris systems, PA-RISC HP-UX,
281 and Intel Linux systems.  It is intended for use on a color display,
282 although most features will work on monochrome monitors.  Simply unpack
283 InfoDock according to the instructions in the ID-INSTALL file and you
284 are ready to run.
285
286    The InfoDock Manual is concise, yet sufficient as a user guide for
287 users who have never used an Emacs-type editor before.  For users who
288 are already familiar with Emacs, it supplements the information in the
289 GNU Emacs Manual.
290
291    InfoDock menus are much more extensive and more mature than standard
292 Emacs menus.  Each menu offers a `Manual' item which displays
293 documentation associated with the menu's functions.
294
295 Four types of menubars are provided:
296   1. An extensive menubar providing access to global InfoDock commands.
297
298   2. Mode-specific menubars tailored to the current major mode.
299
300   3. A simple menubar for basic editing to help novices get started
301      with InfoDock.
302
303   4. The standard XEmacs menubar.
304
305    Most modes also include mode-specific popup menus.  Additionally,
306 region and rectangle popup menus are included.
307
308    `Hyperbole', the everyday information manager, is a core part of
309 InfoDock.  This provides context-sensitive mouse keys, a rolodex-type
310 contact manager, programmable hypertext buttons, and an autonumbered
311 outliner with embedded hyperlink anchors.
312
313    The `OO-Browser', a multi-language object-oriented code browser, is a
314 standard part of InfoDock.
315
316    InfoDock saves a more extensive set of user options than other Emacs
317 versions.
318
319    InfoDock inserts a useful file header in many file types, showing the
320 author, summary, and last modification time of each file.  A summary
321 program can then be used to summarize all of the files in a directory,
322 for easy MANIFEST file creation.
323
324    Your working set of buffers is automatically saved and restored (if
325 you answer yes to a prompt) between InfoDock sessions.
326
327    Refined color choices for code highlighting are provided for both
328 dark and light background display frames.
329
330    The `C-z' key prefix performs frame-based commands which parallel the
331 `C-x' key prefix for window-based commands.
332
333    The Smart Menu system is included for producing command menus on dumb
334 terminals.
335
336    Lisp libraries are better categorized according to function.
337
338    Extensions and improvements to many areas of Emacs are included,
339 such as: paragraph filling, mail reading with Rmail, shell handling,
340 outlining, code highlighting and browsing, and man page browsing.
341
342    InfoDock questions, answers and discussion should go to the mail list
343 <infodock@infodock.com>.  Use <infodock-request@infodock.com> to be
344 added or removed from the list.  Always include your InfoDock version
345 number when sending help requests.
346
347    InfoDock is available across the Internet via anonymous FTP.  To get
348 it, first move to a directory into which you want the InfoDock archive
349 files placed.  We will call this <DIST-DIR>.
350
351         cd <DIST-DIR>
352
353    Ftp to ftp.xemacs.org  (Internet Host ID = 128.174.252.16):
354
355         prompt> ftp ftp.xemacs.org
356
357    Login as `anonymous' with your own <user-id>@<site-name> as a
358 password.
359
360         Name (ftp.xemacs.org): anonymous
361         331 Guest login ok, send your complete e-mail address as password.
362         Password: -<your-user-id>@<your-domain>
363         230 Guest login ok, access restrictions apply.
364
365    Move to the location of the InfoDock archives:
366
367         ftp> cd pub/infodock
368
369    Set your transfer mode to binary:
370
371         ftp> bin
372         200 Type set to I.
373
374    Turn off prompting:
375
376         ftp> prompt
377         Interactive mode off.
378
379    Retrieve the InfoDock archives that you want, either by using a `get
380 <file>' for each file you want or by using the following to get a
381 complete distribution, including all binaries:
382
383         ftp> mget ID-INSTALL
384         ftp> mget id-*
385
386    Close the FTP connection:
387
388         ftp> quit
389         221 Goodbye.
390
391    Read the `ID-INSTALL' file which you just retrieved for step-by-step
392 installation instructions.
393
394 \1f
395 File: xemacs-faq.info,  Node: Q4.7.1,  Next: Q4.7.2,  Prev: Q4.6.1,  Up: Subsystems
396
397 4.7: Other Unbundled Packages
398 =============================
399
400 Q4.7.1: What is AUC TeX?  Where do you get it?
401 ----------------------------------------------
402
403    AUC TeX is a package written by Per Abrahamsen <abraham@dina.kvl.dk>.
404 Starting with XEmacs 19.16, AUC TeX is bundled with XEmacs.  The
405 following information is from the `README' and website.
406
407    AUC TeX is an extensible package that supports writing and formatting
408 TeX files for most variants of GNU Emacs. Many different macro packages
409 are supported, including AMS TeX, LaTeX, and TeXinfo.
410
411    The most recent version is always available by ftp at
412 `ftp://sunsite.auc.dk/packages/auctex/auctex.tar.gz'.
413
414    In case you don't have access to anonymous ftp, you can get it by an
415 email request to <ftpmail@decwrl.dec.com>.
416
417    WWW users may want to check out the AUC TeX page at
418 `http://sunsite.auc.dk/auctex/'.
419
420 \1f
421 File: xemacs-faq.info,  Node: Q4.7.2,  Next: Q4.7.3,  Prev: Q4.7.1,  Up: Subsystems
422
423 Q4.7.2: Are there any Emacs Lisp Spreadsheets?
424 ----------------------------------------------
425
426    Yes.  Check out "dismal" (which stands for Dis' Mode Ain't Lotus) at
427 `ftp://cs.nyu.edu/pub/local/fox/dismal/'.
428
429 \1f
430 File: xemacs-faq.info,  Node: Q4.7.3,  Next: Q4.7.4,  Prev: Q4.7.2,  Up: Subsystems
431
432 Q4.7.3: [This question intentionally left blank]
433 ------------------------------------------------
434
435 \1f
436 File: xemacs-faq.info,  Node: Q4.7.4,  Next: Q4.7.5,  Prev: Q4.7.3,  Up: Subsystems
437
438 Q4.7.4: Problems installing AUC TeX.
439 ------------------------------------
440
441    Jan Vroonhof <vroonhof@math.ethz.ch> writes:
442
443      AUC TeX works fine on both stock Emacs and XEmacs has been doing
444      so for a very very long time. This is mostly due to the work of
445      Per Abrahamsen <abraham@dina.kvl.dk> (clap clap) in particular his
446      `easymenu' package.  Which leads to what is probably the problem...
447
448    Most problems with AUC TeX are one of two things:
449
450    * The TeX-lisp-directory in `tex-site.el' and the makefile don't
451      match.
452
453      Fix: make sure you configure AUC TeX properly *before* installing.
454
455    * You have an old version of easymenu.el in your path.
456
457      Fix: use `locate-library' and remove old versions to make sure it
458      *only* finds the one that came with XEmacs.
459
460 \1f
461 File: xemacs-faq.info,  Node: Q4.7.5,  Next: Q4.7.6,  Prev: Q4.7.4,  Up: Subsystems
462
463 Q4.7.5: Is there a reason for an Emacs package not to be included in XEmacs?
464 ----------------------------------------------------------------------------
465
466    The reason for an Emacs package not to be included in XEmacs is
467 usually one or more of the following:
468
469   1. The package has not been ported to XEmacs.  This will typically
470      happen when it uses GNU-Emacs-specific features, which make it
471      fail under XEmacs.
472
473      Porting a package to XEmacs can range from a trivial amount of
474      change to a partial or full rewrite.  Fortunately, the authors of
475      modern packages usually choose to support both Emacsen themselves.
476
477   2. The package has been decided not to be appropriate for XEmacs.  It
478      may have an equivalent or better replacement within XEmacs, in
479      which case the developers may choose not to burden themselves with
480      supporting an additional package.
481
482      Each package bundled with XEmacs means more work for the
483      maintainers, whether they want it or not.  If you are ready to
484      take over the maintenance responsibilities for the package you
485      port, be sure to say so--we will more likely include it.
486
487   3. The package simply hasn't been noted by the XEmacs development.  If
488      that's the case, the messages like yours are very useful for
489      attracting our attention.
490
491   4. The package was noted by the developers, but they simply haven't
492      yet gotten around to including/porting it.  Wait for the next
493      release or, even better, offer your help.  It will be gladly
494      accepted and appreciated.
495
496 \1f
497 File: xemacs-faq.info,  Node: Q4.7.6,  Prev: Q4.7.5,  Up: Subsystems
498
499 Q4.7.5: Is there a MatLab mode?
500 -------------------------------
501
502    Yes, a matlab mode and other items are available at the MathWorks'
503 emacs_add_ons ftp directory
504 (ftp://ftp.mathworks.com/pub/contrib/emacs_add_ons).
505
506 \1f
507 File: xemacs-faq.info,  Node: Miscellaneous,  Next: MS Windows,  Prev: Subsystems,  Up: Top
508
509 5 The Miscellaneous Stuff
510 *************************
511
512    This is part 5 of the XEmacs Frequently Asked Questions list.  This
513 section is devoted to anything that doesn't fit neatly into the other
514 sections.
515
516 * Menu:
517
518 Major & Minor Modes:
519 * Q5.0.1::      How can I do source code highlighting using font-lock?
520 * Q5.0.2::      I do not like cc-mode.  How do I use the old c-mode?
521 * Q5.0.3::      How do I get `More' Syntax Highlighting on by default?
522 * Q5.0.4::      How can I enable auto-indent?
523 * Q5.0.5::      How can I get XEmacs to come up in text/auto-fill mode by default?
524 * Q5.0.6::      How do I start up a second shell buffer?
525 * Q5.0.7::      Telnet from shell filters too much.
526 * Q5.0.8::      Why does edt emulation not work?
527 * Q5.0.9::      How can I emulate VI and use it as my default mode?
528 * Q5.0.10::     [This question intentionally left blank]
529 * Q5.0.11::     How do I turn on filladapt for all buffers?
530 * Q5.0.12::     How do I disable gnuserv from opening a new frame?
531 * Q5.0.13::     How do I start gnuserv so that each subsequent XEmacs is a client?
532 * Q5.0.14::     Strange things are happening in Shell Mode.
533 * Q5.0.15::     Where do I get the latest CC Mode?
534 * Q5.0.16::     I find auto-show-mode disconcerting.  How do I turn it off?
535 * Q5.0.17::     How can I get two instances of info?
536 * Q5.0.18::     [This question intentionally left blank]
537 * Q5.0.19::     Is there something better than LaTeX mode?
538 * Q5.0.20::     Is there a way to start a new XEmacs if there's no gnuserv running, and otherwise use gnuclient?
539
540 Emacs Lisp Programming Techniques:
541 * Q5.1.1::      The difference in key sequences between XEmacs and GNU Emacs?
542 * Q5.1.2::      Can I generate "fake" keyboard events?
543 * Q5.1.3::      Could you explain `read-kbd-macro' in more detail?
544 * Q5.1.4::      What is the performance hit of `let'?
545 * Q5.1.5::      What is the recommended use of `setq'?
546 * Q5.1.6::      What is the typical misuse of `setq'?
547 * Q5.1.7::      I like the `do' form of cl, does it slow things down?
548 * Q5.1.8::      I like recursion, does it slow things down?
549 * Q5.1.9::      How do I put a glyph as annotation in a buffer?
550 * Q5.1.10::     `map-extents' won't traverse all of my extents!
551 * Q5.1.11::     My elisp program is horribly slow.  Is there an easy way to find out where it spends time?
552
553 Sound:
554 * Q5.2.1::      How do I turn off the sound?
555 * Q5.2.2::      How do I get funky sounds instead of a boring beep?
556 * Q5.2.3::      What's NAS, how do I get it?
557 * Q5.2.4::      Sunsite sounds don't play.
558
559 Miscellaneous:
560 * Q5.3.1::      How do you make XEmacs indent CL if-clauses correctly?
561 * Q5.3.2::      Fontifying hangs when editing a postscript file.
562 * Q5.3.3::      How can I print WYSIWYG a font-locked buffer?
563 * Q5.3.4::      Getting M-x lpr to work with postscript printer.
564 * Q5.3.5::      How do I specify the paths that XEmacs uses for finding files?
565 * Q5.3.6::      [This question intentionally left blank]
566 * Q5.3.7::      Can I have the end of the buffer delimited in some way?
567 * Q5.3.8::      How do I insert today's date into a buffer?
568 * Q5.3.9::      Are only certain syntactic character classes available for abbrevs?
569 * Q5.3.10::     How can I get those oh-so-neat X-Face lines?
570 * Q5.3.11::     How do I add new Info directories?
571 * Q5.3.12::     What do I need to change to make printing work?
572
573 \1f
574 File: xemacs-faq.info,  Node: Q5.0.1,  Next: Q5.0.2,  Prev: Miscellaneous,  Up: Miscellaneous
575
576 5.0: Major & Minor Modes
577 ========================
578
579 Q5.0.1: How can I do source code highlighting using font-lock?
580 --------------------------------------------------------------
581
582    For most modes, font-lock is already set up and just needs to be
583 turned on.  This can be done by `M-x font-lock-mode', or by having
584 XEmacs automatically start it by adding lines like:
585
586      (add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
587      (add-hook 'dired-mode-hook      'turn-on-font-lock)
588
589    to your `.emacs'.  See the file `etc/sample.emacs' for more examples.
590
591    See also `Syntax Highlighting' from the `Options' menu.  Remember to
592 save options.
593
594 \1f
595 File: xemacs-faq.info,  Node: Q5.0.2,  Next: Q5.0.3,  Prev: Q5.0.1,  Up: Miscellaneous
596
597 Q5.0.2: I do not like cc-mode.  How do I use the old c-mode?
598 ------------------------------------------------------------
599
600    Well, first off, consider if you really want to do this.  cc-mode is
601 much more powerful than the old c-mode.  If you're having trouble
602 getting your old offsets to work, try using `c-set-offset' instead.
603 You might also consider using the package `cc-compat'.
604
605    But, if you still insist, add the following lines to your `.emacs':
606
607      (fmakunbound 'c-mode)
608      (makunbound 'c-mode-map)
609      (fmakunbound 'c++-mode)
610      (makunbound 'c++-mode-map)
611      (makunbound 'c-style-alist)
612      (load-library "old-c-mode")
613      (load-library "old-c++-mode")
614
615    This must be done before any other reference is made to either
616 c-mode or c++-mode.
617
618 \1f
619 File: xemacs-faq.info,  Node: Q5.0.3,  Next: Q5.0.4,  Prev: Q5.0.2,  Up: Miscellaneous
620
621 Q5.0.3: How do I get `More' Syntax Highlighting on by default?
622 --------------------------------------------------------------
623
624    Use the following code in your `.emacs':
625
626      (setq-default font-lock-maximum-decoration t)
627
628    In versions of XEmacs prior to 19.14, you had to use a kludgy
629 solution like this:
630
631      (setq c-font-lock-keywords c-font-lock-keywords-2
632            c++-font-lock-keywords c++-font-lock-keywords-2
633            lisp-font-lock-keywords lisp-font-lock-keywords-2)
634
635    It will work for C, C++ and Lisp.
636
637    See also `Syntax Highlighting' from the `Options' menu.  Remember to
638 save options.
639
640 \1f
641 File: xemacs-faq.info,  Node: Q5.0.4,  Next: Q5.0.5,  Prev: Q5.0.3,  Up: Miscellaneous
642
643 Q5.0.4: How can I enable auto-indent?
644 -------------------------------------
645
646    Put the following line in your `.emacs':
647
648      (setq indent-line-function 'indent-relative-maybe)
649
650    If you want to get fancy, try the `filladapt' package available
651 standard with XEmacs.  Put this into your `.emacs':
652
653      (require 'filladapt)
654      (add-hook 'text-mode-hook    'turn-on-filladapt-mode)
655      ;;; and others ...
656
657    You can customize filling and adaptive filling with Customize.
658 Select from the `Options' menu
659 `Customize->Emacs->->Editing->Fill->Fill...' or type `M-x customize
660 <RET> fill <RET>'.
661
662    Note that well-behaving text-lookalike modes will run
663 `text-mode-hook' by default (e.g. that's what Message does).  For the
664 nasty ones, you'll have to provide the `add-hook's yourself.
665
666    Please note that the `fa-extras' package is no longer useful.
667
668 \1f
669 File: xemacs-faq.info,  Node: Q5.0.5,  Next: Q5.0.6,  Prev: Q5.0.4,  Up: Miscellaneous
670
671 Q5.0.5: How can I get XEmacs to come up in text/auto-fill mode by default?
672 --------------------------------------------------------------------------
673
674    Try the following lisp in your `.emacs':
675
676      (setq default-major-mode 'text-mode)
677      (setq text-mode-hook 'turn-on-auto-fill)
678
679    *WARNING*: note that changing the value of `default-major-mode' from
680 `fundamental-mode' can break a large amount of built-in code that
681 expects newly created buffers to be in `fundamental-mode'.  (Changing
682 from `fundamental-mode' to `text-mode' might not wreak too much havoc,
683 but changing to something more exotic like a lisp-mode would break many
684 Emacs packages).
685
686    Note that Emacs by default starts up in buffer `*scratch*' in
687 `initial-major-mode', which defaults to `lisp-interaction-mode'. Thus
688 adding the following form to your Emacs init file will cause the
689 initial `*scratch*' buffer to be put into auto-fill'ed `text-mode':
690
691      (setq initial-major-mode
692            (lambda ()
693              (text-mode)
694              (turn-on-auto-fill)))
695
696    Note that after your init file is loaded, if
697 `inhibit-startup-message' is `nil' (the default) and the startup buffer
698 is `*scratch*' then the startup message will be inserted into
699 `*scratch*'; it will be removed after a timeout by erasing the entire
700 `*scratch*' buffer.  Keep in mind this default usage of `*scratch*' if
701 you desire any prior manipulation of `*scratch*' from within your Emacs
702 init file. In particular, anything you insert into `*scratch*' from
703 your init file will be later erased. Also, if you change the mode of
704 the `*scratch*' buffer, be sure that this will not interfere with
705 possible later insertion of the startup message (e.g. if you put
706 `*scratch*' into a nonstandard mode that has automatic font lock rules,
707 then the startup message might get fontified in a strange foreign
708 manner, e.g. as code in some programming language).
709
710 \1f
711 File: xemacs-faq.info,  Node: Q5.0.6,  Next: Q5.0.7,  Prev: Q5.0.5,  Up: Miscellaneous
712
713 Q5.0.6: How do I start up a second shell buffer?
714 ------------------------------------------------
715
716    In the `*shell*' buffer:
717
718      M-x rename-buffer <RET> *shell-1* <RET>
719      M-x shell RET
720
721    This will then start a second shell.  The key is that no buffer named
722 `*shell*' can exist.  It might be preferable to use `M-x
723 rename-uniquely' to rename the `*shell*' buffer instead of `M-x
724 rename-buffer'.
725
726    Alternately, you can set the variable `shell-multiple-shells'.  If
727 the value of this variable is non-nil, each time shell mode is invoked,
728 a new shell is made
729
730 \1f
731 File: xemacs-faq.info,  Node: Q5.0.7,  Next: Q5.0.8,  Prev: Q5.0.6,  Up: Miscellaneous
732
733 Q5.0.7: Telnet from shell filters too much
734 ------------------------------------------
735
736    I'm using the Emacs `M-x shell' function, and I would like to invoke
737 and use a telnet session within it.  Everything works fine except that
738 now all `^M''s are filtered out by Emacs.  Fixes?
739
740    Use `M-x rsh' or `M-x telnet' to open remote sessions rather than
741 doing rsh or telnet within the local shell buffer.  Starting with
742 XEmacs-20.3 you can also use `M-x ssh' to open secure remote session if
743 you have `ssh' installed.
744
745 \1f
746 File: xemacs-faq.info,  Node: Q5.0.8,  Next: Q5.0.9,  Prev: Q5.0.7,  Up: Miscellaneous
747
748 Q5.0.8: Why does edt emulation not work?
749 ----------------------------------------
750
751    We don't know, but you can use tpu-edt emulation instead, which works
752 fine and is a little fancier than the standard edt emulation.  To do
753 this, add the following line to your `.emacs':
754
755      (tpu-edt)
756
757    If you don't want it to replace `C-h' with an edt-style help menu
758 add this as well:
759
760      (global-set-key [(control h)] 'help-for-help)
761
762 \1f
763 File: xemacs-faq.info,  Node: Q5.0.9,  Next: Q5.0.10,  Prev: Q5.0.8,  Up: Miscellaneous
764
765 Q5.0.9: How can I emulate VI and use it as my default mode?
766 -----------------------------------------------------------
767
768    Our recommended VI emulator is viper. To make viper-mode the default,
769 add this to your `.emacs':
770
771      (viper-mode)
772
773    Michael Kifer <kifer@CS.SunySB.EDU> writes:
774
775      This should be added as close to the top of `.emacs' as you can get
776      it, otherwise some minor modes may not get viper-ized.
777
778 \1f
779 File: xemacs-faq.info,  Node: Q5.0.10,  Next: Q5.0.11,  Prev: Q5.0.9,  Up: Miscellaneous
780
781 Q5.0.10: [This question intentionally left blank]
782 -------------------------------------------------
783
784    Obsolete question, left blank to avoid renumbering
785
786 \1f
787 File: xemacs-faq.info,  Node: Q5.0.11,  Next: Q5.0.12,  Prev: Q5.0.10,  Up: Miscellaneous
788
789 Q5.0.11: How do I turn on filladapt for all buffers?
790 ----------------------------------------------------
791
792    Filladapt is a minor mode and minor modes are traditionally off by
793 default.  The following added to your `.emacs' will turn it on for all
794 buffers:
795
796      (setq-default filladapt-mode t)
797
798    Use `turn-on-filladapt-mode' to turn Filladapt on in particular
799 major modes, like this:
800
801      (add-hook 'text-mode-hook 'turn-on-filladapt-mode)
802
803 \1f
804 File: xemacs-faq.info,  Node: Q5.0.12,  Next: Q5.0.13,  Prev: Q5.0.11,  Up: Miscellaneous
805
806 Q5.0.12: How do I disable gnuserv from opening a new frame?
807 -----------------------------------------------------------
808
809    If you set the `gnuserv-frame' variable to the frame that should be
810 used to display buffers that are pulled up, a new frame will not be
811 created. For example, you could put
812
813      (setq gnuserv-frame (selected-frame))
814
815    early on in your `.emacs', to ensure that the first frame created is
816 the one used for your gnuserv buffers.
817
818    Starting in 19.15, there is an option to set the gnuserv target to
819 the current frame.  See `Options->"Other Window" Location->Make current
820 frame gnuserv target'
821
822    Starting with XEmacs-20.3 you can also change this with Customize.
823 Select from the `Options' menu
824 `Customize->Emacs->Environment->Gnuserv->Gnuserv Frame...' or type `M-x
825 customize <RET> gnuserv <RET>'.
826
827 \1f
828 File: xemacs-faq.info,  Node: Q5.0.13,  Next: Q5.0.14,  Prev: Q5.0.12,  Up: Miscellaneous
829
830 Q5.0.13: How do I start gnuserv so that each subsequent XEmacs is a client?
831 ---------------------------------------------------------------------------
832
833    Put the following in your `.emacs' file to start the server:
834
835      (gnuserv-start)
836
837    Start your first XEmacs as usual.  After that, you can do:
838
839      gnuclient randomfilename
840
841    from the command line to get your existing XEmacs process to open a
842 new frame and visit randomfilename in that window. When you're done
843 editing randomfilename, hit `C-x #' to kill the buffer and get rid of
844 the frame.
845
846    See also man page of gnuclient.
847
848 \1f
849 File: xemacs-faq.info,  Node: Q5.0.14,  Next: Q5.0.15,  Prev: Q5.0.13,  Up: Miscellaneous
850
851 Q5.0.14: Strange things are happening in Shell Mode.
852 ----------------------------------------------------
853
854    Sometimes (i.e. it's not repeatable, and I can't work out why it
855 happens) when I'm typing into shell mode, I hit return and only a
856 portion of the command is given to the shell, and a blank prompt is
857 returned.  If I hit return again, the rest of the previous command is
858 given to the shell.
859
860    Martin Buchholz <martin@xemacs.org> writes:
861
862      There is a known problem with interaction between `csh' and the
863      `filec' option and XEmacs.  You should add the following to your
864      `.cshrc':
865
866           if ( "$TERM" == emacs || "$TERM" == unknown ) unset filec
867
868 \1f
869 File: xemacs-faq.info,  Node: Q5.0.15,  Next: Q5.0.16,  Prev: Q5.0.14,  Up: Miscellaneous
870
871 Q5.0.15: Where do I get the latest CC Mode?
872 -------------------------------------------
873
874    Barry A. Warsaw <bwarsaw@cnri.reston.va.us> writes:
875
876      This can be had from `http://www.python.org/emacs/'.
877
878 \1f
879 File: xemacs-faq.info,  Node: Q5.0.16,  Next: Q5.0.17,  Prev: Q5.0.15,  Up: Miscellaneous
880
881 Q5.0.16: I find auto-show-mode disconcerting.  How do I turn it off?
882 --------------------------------------------------------------------
883
884    `auto-show-mode' controls whether or not a horizontal scrollbar
885 magically appears when a line is too long to be displayed.  This is
886 enabled by default.  To turn it off, put the following in your `.emacs':
887
888      (setq auto-show-mode nil)
889      (setq-default auto-show-mode nil)
890
891 \1f
892 File: xemacs-faq.info,  Node: Q5.0.17,  Next: Q5.0.18,  Prev: Q5.0.16,  Up: Miscellaneous
893
894 Q5.0.17: How can I get two instances of info?
895 ---------------------------------------------
896
897    You can't.  The `info' package does not provide for multiple info
898 buffers.
899
900 \1f
901 File: xemacs-faq.info,  Node: Q5.0.18,  Next: Q5.0.19,  Prev: Q5.0.17,  Up: Miscellaneous
902
903 Q5.0.18: [This question intentionally left blank]
904 -------------------------------------------------
905
906 \1f
907 File: xemacs-faq.info,  Node: Q5.0.19,  Next: Q5.0.20,  Prev: Q5.0.18,  Up: Miscellaneous
908
909 Q5.0.19: Is there something better than LaTeX mode?
910 ---------------------------------------------------
911
912    David Kastrup <dak@fsnif.neuroinformatik.ruhr-uni-bochum.de> writes:
913
914      The standard TeX modes leave much to be desired, and are somewhat
915      leniently maintained.  Serious TeX users use AUC TeX (*note
916      Q4.7.1::).
917
918 \1f
919 File: xemacs-faq.info,  Node: Q5.0.20,  Next: Q5.1.1,  Prev: Q5.0.19,  Up: Miscellaneous
920
921 Q5.0.20: Is there a way to start a new XEmacs if there's no gnuserv running, and otherwise use gnuclient?
922 ---------------------------------------------------------------------------------------------------------
923
924    Jan Vroonhof <vroonhof@math.ethz.ch> writes:
925      Here is one of the solutions, we have this in a script called
926      `etc/editclient.sh'.
927            #!/bin/sh
928            if gnuclient -batch -eval t >/dev/null 2>&1
929            then
930              exec gnuclient ${1+"$@"}
931            else
932              xemacs -unmapped -f gnuserv-start &
933              until gnuclient -batch -eval t >/dev/null 2>&1
934              do
935                 sleep 1
936              done
937              exec gnuclient ${1+"$@"}
938            fi
939
940      Note that there is a known problem when running XEmacs and
941      'gnuclient -nw' on the same TTY.
942
943 \1f
944 File: xemacs-faq.info,  Node: Q5.1.1,  Next: Q5.1.2,  Prev: Q5.0.20,  Up: Miscellaneous
945
946 5.1: Emacs Lisp Programming Techniques
947 ======================================
948
949 Q5.1.1: What is the difference in key sequences between XEmacs and GNU Emacs?
950 -----------------------------------------------------------------------------
951
952    Erik Naggum <clerik@naggum.no> writes;
953
954      Emacs has a legacy of keyboards that produced characters with
955      modifier bits, and therefore map a variety of input systems into
956      this scheme even today.  XEmacs is instead optimized for X events.
957      This causes an incompatibility in the way key sequences are
958      specified, but both Emacs and XEmacs will accept a key sequence as
959      a vector of lists of modifiers that ends with a key, e.g., to bind
960      `M-C-a', you would say `[(meta control a)]' in both Emacsen.
961      XEmacs has an abbreviated form for a single key, just (meta
962      control a).  Emacs has an abbreviated form for the Control and the
963      Meta modifiers to string-characters (the ASCII characters), as in
964      `\M-\C-a'.  XEmacs users need to be aware that the abbreviated
965      form works only for one-character key sequences, while Emacs users
966      need to be aware that the string-character is rather limited.
967      Specifically, the string-character can accommodate only 256
968      different values, 128 of which have the Meta modifier and 128 of
969      which have not.  In each of these blocks, only 32 characters have
970      the Control modifier.  Whereas `[(meta control A)]' differs from
971      `[(meta control a)]' because the case differs, `\M-\C-a' and
972      `\M-\C-A' do not.  Programmers are advised to use the full common
973      form, both because it is more readable and less error-prone, and
974      because it is supported by both Emacsen.
975
976    Another (even safer) way to be sure of the key-sequences is to use
977 the `read-kbd-macro' function, which takes a string like `C-c <up>',
978 and converts it to the internal key representation of the Emacs you
979 use.  The function is available both on XEmacs and GNU Emacs.
980
981 \1f
982 File: xemacs-faq.info,  Node: Q5.1.2,  Next: Q5.1.3,  Prev: Q5.1.1,  Up: Miscellaneous
983
984 Q5.1.2: Can I generate "fake" keyboard events?
985 ----------------------------------------------
986
987    I wonder if there is an interactive function that can generate
988 "fake" keyboard events.  This way, I could simply map them inside
989 XEmacs.
990
991    This seems to work:
992
993      (defun cg--generate-char-event (ch)
994        "Generate an event, as if ch has been typed"
995        (dispatch-event (character-to-event ch)))
996      
997      ;;  Backspace and Delete stuff
998      (global-set-key [backspace]
999        (lambda () (interactive) (cg--generate-char-event 127)))
1000      (global-set-key [unknown_keysym_0x4]
1001        (lambda () (interactive) (cg--generate-char-event 4)))
1002
1003 \1f
1004 File: xemacs-faq.info,  Node: Q5.1.3,  Next: Q5.1.4,  Prev: Q5.1.2,  Up: Miscellaneous
1005
1006 Q5.1.3: Could you explain `read-kbd-macro' in more detail?
1007 ----------------------------------------------------------
1008
1009    The `read-kbd-macro' function returns the internal Emacs
1010 representation of a human-readable string (which is its argument).
1011 Thus:
1012
1013      (read-kbd-macro "C-c C-a")
1014      => [(control ?c) (control ?a)]
1015      
1016      (read-kbd-macro "C-c C-. <up>")
1017      => [(control ?c) (control ?.) up]
1018
1019    In GNU Emacs the same forms will be evaluated to what GNU Emacs
1020 understands internally--the sequences `"\C-x\C-c"' and `[3 67108910
1021 up]', respectively.
1022
1023    The exact "human-readable" syntax is defined in the docstring of
1024 `edmacro-mode'.  I'll repeat it here, for completeness.
1025
1026      Format of keyboard macros during editing:
1027
1028      Text is divided into "words" separated by whitespace.  Except for
1029      the words described below, the characters of each word go directly
1030      as characters of the macro.  The whitespace that separates words is
1031      ignored.  Whitespace in the macro must be written explicitly, as in
1032      `foo <SPC> bar <RET>'.
1033
1034         * The special words `RET', `SPC', `TAB', `DEL', `LFD', `ESC',
1035           and `NUL' represent special control characters.  The words
1036           must be written in uppercase.
1037
1038         * A word in angle brackets, e.g., `<return>', `<down>', or
1039           `<f1>', represents a function key.  (Note that in the standard
1040           configuration, the function key `<return>' and the control key
1041           <RET> are synonymous.)  You can use angle brackets on the
1042           words <RET>, <SPC>, etc., but they are not required there.
1043
1044         * Keys can be written by their ASCII code, using a backslash
1045           followed by up to six octal digits.  This is the only way to
1046           represent keys with codes above \377.
1047
1048         * One or more prefixes `M-' (meta), `C-' (control), `S-'
1049           (shift), `A-' (alt), `H-' (hyper), and `s-' (super) may
1050           precede a character or key notation.  For function keys, the
1051           prefixes may go inside or outside of the brackets: `C-<down>'
1052           == `<C-down>'.  The prefixes may be written in any order:
1053           `M-C-x' == `C-M-x'.
1054
1055           Prefixes are not allowed on multi-key words, e.g., `C-abc',
1056           except that the Meta prefix is allowed on a sequence of
1057           digits and optional minus sign: `M--123' == `M-- M-1 M-2 M-3'.
1058
1059         * The `^' notation for control characters also works: `^M' ==
1060           `C-m'.
1061
1062         * Double angle brackets enclose command names: `<<next-line>>'
1063           is shorthand for `M-x next-line <RET>'.
1064
1065         * Finally, `REM' or `;;' causes the rest of the line to be
1066           ignored as a comment.
1067
1068      Any word may be prefixed by a multiplier in the form of a decimal
1069      number and `*': `3*<right>' == `<right> <right> <right>', and
1070      `10*foo' == `foofoofoofoofoofoofoofoofoofoo'.
1071
1072      Multiple text keys can normally be strung together to form a word,
1073      but you may need to add whitespace if the word would look like one
1074      of the above notations: `; ; ;' is a keyboard macro with three
1075      semicolons, but `;;;' is a comment.  Likewise, `\ 1 2 3' is four
1076      keys but `\123' is a single key written in octal, and `< right >'
1077      is seven keys but `<right>' is a single function key.  When in
1078      doubt, use whitespace.
1079
1080 \1f
1081 File: xemacs-faq.info,  Node: Q5.1.4,  Next: Q5.1.5,  Prev: Q5.1.3,  Up: Miscellaneous
1082
1083 Q5.1.4: What is the performance hit of `let'?
1084 ---------------------------------------------
1085
1086    In most cases, not noticeable.  Besides, there's no avoiding
1087 `let'--you have to bind your local variables, after all.  Some pose a
1088 question whether to nest `let's, or use one `let' per function.  I
1089 think because of clarity and maintenance (and possible future
1090 implementation), `let'-s should be used (nested) in a way to provide
1091 the clearest code.
1092
1093 \1f
1094 File: xemacs-faq.info,  Node: Q5.1.5,  Next: Q5.1.6,  Prev: Q5.1.4,  Up: Miscellaneous
1095
1096 Q5.1.5: What is the recommended use of `setq'?
1097 ----------------------------------------------
1098
1099    * Global variables
1100
1101      You will typically `defvar' your global variable to a default
1102      value, and use `setq' to set it later.
1103
1104      It is never a good practice to `setq' user variables (like
1105      `case-fold-search', etc.), as it ignores the user's choice
1106      unconditionally.  Note that `defvar' doesn't change the value of a
1107      variable if it was bound previously.  If you wish to change a
1108      user-variable temporarily, use `let':
1109
1110           (let ((case-fold-search nil))
1111             ...                                   ; code with searches that must be case-sensitive
1112             ...)
1113
1114      You will notice the user-variables by their docstrings beginning
1115      with an asterisk (a convention).
1116
1117    * Local variables
1118
1119      Bind them with `let', which will unbind them (or restore their
1120      previous value, if they were bound) after exiting from the `let'
1121      form.  Change the value of local variables with `setq' or whatever
1122      you like (e.g. `incf', `setf' and such).  The `let' form can even
1123      return one of its local variables.
1124
1125      Typical usage:
1126
1127           ;; iterate through the elements of the list returned by
1128           ;; `hairy-function-that-returns-list'
1129           (let ((l (hairy-function-that-returns-list)))
1130             (while l
1131               ... do something with (car l) ...
1132               (setq l (cdr l))))
1133
1134      Another typical usage includes building a value simply to work
1135      with it.
1136
1137           ;; Build the mode keymap out of the key-translation-alist
1138           (let ((inbox (file-truename (expand-file-name box)))
1139                 (i 0))
1140             ... code dealing with inbox ...
1141             inbox)
1142
1143      This piece of code uses the local variable `inbox', which becomes
1144      unbound (or regains old value) after exiting the form.  The form
1145      also returns the value of `inbox', which can be reused, for
1146      instance:
1147
1148           (setq foo-processed-inbox
1149                 (let .....))
1150
1151 \1f
1152 File: xemacs-faq.info,  Node: Q5.1.6,  Next: Q5.1.7,  Prev: Q5.1.5,  Up: Miscellaneous
1153
1154 Q5.1.6: What is the typical misuse of `setq' ?
1155 ----------------------------------------------
1156
1157    A typical misuse is probably `setq'ing a variable that was meant to
1158 be local.  Such a variable will remain bound forever, never to be
1159 garbage-collected.  For example, the code doing:
1160
1161      (defun my-function (whatever)
1162        (setq a nil)
1163        ... build a large list ...
1164        ... and exit ...)
1165
1166    does a bad thing, as `a' will keep consuming memory, never to be
1167 unbound.  The correct thing is to do it like this:
1168
1169      (defun my-function (whatever)
1170        (let (a)                              ; default initialization is to nil
1171          ... build a large list ...
1172          ... and exit, unbinding `a' in the process  ...)
1173
1174    Not only is this prettier syntactically, but it makes it possible for
1175 Emacs to garbage-collect the objects which `a' used to reference.
1176
1177    Note that even global variables should not be `setq'ed without
1178 `defvar'ing them first, because the byte-compiler issues warnings.  The
1179 reason for the warning is the following:
1180
1181      (defun flurgoze nil)                    ; ok, global internal variable
1182      ...
1183      
1184      (setq flurghoze t)                      ; ops!  a typo, but semantically correct.
1185                                              ; however, the byte-compiler warns.
1186      
1187      While compiling toplevel forms:
1188      ** assignment to free variable flurghoze
1189
1190 \1f
1191 File: xemacs-faq.info,  Node: Q5.1.7,  Next: Q5.1.8,  Prev: Q5.1.6,  Up: Miscellaneous
1192
1193 Q5.1.7: I like the `do' form of cl, does it slow things down?
1194 -------------------------------------------------------------
1195
1196    It shouldn't.  Here is what Dave Gillespie has to say about cl.el
1197 performance:
1198
1199      Many of the advanced features of this package, such as `defun*',
1200      `loop', and `setf', are implemented as Lisp macros.  In
1201      byte-compiled code, these complex notations will be expanded into
1202      equivalent Lisp code which is simple and efficient.  For example,
1203      the forms
1204
1205           (incf i n)
1206           (push x (car p))
1207
1208      are expanded at compile-time to the Lisp forms
1209
1210           (setq i (+ i n))
1211           (setcar p (cons x (car p)))
1212
1213      which are the most efficient ways of doing these respective
1214      operations in Lisp.  Thus, there is no performance penalty for
1215      using the more readable `incf' and `push' forms in your compiled
1216      code.
1217
1218      _Interpreted_ code, on the other hand, must expand these macros
1219      every time they are executed.  For this reason it is strongly
1220      recommended that code making heavy use of macros be compiled.  (The
1221      features labelled "Special Form" instead of "Function" in this
1222      manual are macros.)  A loop using `incf' a hundred times will
1223      execute considerably faster if compiled, and will also
1224      garbage-collect less because the macro expansion will not have to
1225      be generated, used, and thrown away a hundred times.
1226
1227      You can find out how a macro expands by using the `cl-prettyexpand'
1228      function.
1229
1230 \1f
1231 File: xemacs-faq.info,  Node: Q5.1.8,  Next: Q5.1.9,  Prev: Q5.1.7,  Up: Miscellaneous
1232
1233 Q5.1.8: I like recursion, does it slow things down?
1234 ---------------------------------------------------
1235
1236    Yes.  Emacs byte-compiler cannot do much to optimize recursion.  But
1237 think well whether this is a real concern in Emacs.  Much of the Emacs
1238 slowness comes from internal mechanisms such as redisplay, or from the
1239 fact that it is an interpreter.
1240
1241    Please try not to make your code much uglier to gain a very small
1242 speed gain.  It's not usually worth it.
1243
1244 \1f
1245 File: xemacs-faq.info,  Node: Q5.1.9,  Next: Q5.1.10,  Prev: Q5.1.8,  Up: Miscellaneous
1246
1247 Q5.1.9: How do I put a glyph as annotation in a buffer?
1248 -------------------------------------------------------
1249
1250    Here is a solution that will insert the glyph annotation at the
1251 beginning of buffer:
1252
1253      (make-annotation (make-glyph '([FORMAT :file FILE]
1254                                     [string :data "fallback-text"]))
1255                       (point-min)
1256                       'text
1257                       (current-buffer))
1258
1259    Replace `FORMAT' with an unquoted symbol representing the format of
1260 the image (e.g. `xpm', `xbm', `gif', `jpeg', etc.)  Instead of `FILE',
1261 use the image file name (e.g.
1262 `/usr/local/lib/xemacs-20.2/etc/recycle.xpm').
1263
1264    You can turn this to a function (that optionally prompts you for a
1265 file name), and inserts the glyph at `(point)' instead of `(point-min)'.
1266
1267 \1f
1268 File: xemacs-faq.info,  Node: Q5.1.10,  Next: Q5.1.11,  Prev: Q5.1.9,  Up: Miscellaneous
1269
1270 Q5.1.10: `map-extents' won't traverse all of my extents!
1271 --------------------------------------------------------
1272
1273    I tried to use `map-extents' to do an operation on all the extents
1274 in a region.  However, it seems to quit after processing a random number
1275 of extents.  Is it buggy?
1276
1277    No.  The documentation of `map-extents' states that it will iterate
1278 across the extents as long as FUNCTION returns `nil'.  Unexperienced
1279 programmers often forget to return `nil' explicitly, which results in
1280 buggy code.  For instance, the following code is supposed to delete all
1281 the extents in a buffer, and issue as many `fubar!' messages.
1282
1283      (map-extents (lambda (ext ignore)
1284                     (delete-extent ext)
1285                     (message "fubar!")))
1286
1287    Instead, it will delete only the first extent, and stop right there -
1288 because `message' will return a non-nil value.  The correct code is:
1289
1290      (map-extents (lambda (ext ignore)
1291                     (delete-extent ext)
1292                     (message "fubar!")
1293                     nil))
1294
1295 \1f
1296 File: xemacs-faq.info,  Node: Q5.1.11,  Next: Q5.2.1,  Prev: Q5.1.10,  Up: Miscellaneous
1297
1298 Q5.1.11: My elisp program is horribly slow.  Is there
1299 -----------------------------------------------------
1300
1301    an easy way to find out where it spends time?
1302
1303    zHrvoje Niksic <hniksic@xemacs.org> writes:
1304      Under XEmacs 20.4 and later  you can use `M-x
1305      profile-key-sequence', press a key (say <RET> in the Gnus Group
1306      buffer), and get the results using `M-x profile-results'.  It
1307      should give you an idea of where the time is being spent.
1308