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