1 This is ../info/xemacs-faq.info, produced by makeinfo version 4.0 from
4 INFO-DIR-SECTION XEmacs Editor
6 * FAQ: (xemacs-faq). XEmacs FAQ.
10 File: xemacs-faq.info, Node: Q4.2.3, Next: Q4.2.4, Prev: Q4.2.2, Up: Subsystems
12 Q4.2.3: How do I make Gnus stay within a single frame?
13 ------------------------------------------------------
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:
19 (defun toolbar-news ()
22 It will redefine the callback function of the icon to just call
23 `gnus', without all the fancy frame stuff.
26 File: xemacs-faq.info, Node: Q4.2.4, Next: Q4.3.1, Prev: Q4.2.3, Up: Subsystems
28 Q4.2.4: How do I customize the From: line?
29 ------------------------------------------
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?
38 Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:
40 Set `user-mail-address' to `gail.gurman@sybase.com' or
41 `mail-host-address' to `sybase.com'.
44 File: xemacs-faq.info, Node: Q4.3.1, Next: Q4.3.2, Prev: Q4.2.4, Up: Subsystems
46 4.3: Other Mail & News
47 ======================
49 Q4.3.1: How can I read and/or compose MIME messages?
50 ----------------------------------------------------
52 VM supports MIME natively.
54 You probably want to use the Tools for MIME (tm). *Note Q4.3.2::,
57 Trey Jackson <trey@cs.berkeley.edu> has an Emacs & MIME web page at
58 `http://bmrc.berkeley.edu/~trey/emacs/mime.html'.
60 Another possibility is RMIME. You may find RMIME at
61 `http://www.cinti.net/~rmoody/rmime/index.html'.
64 File: xemacs-faq.info, Node: Q4.3.2, Next: Q4.3.3, Prev: Q4.3.1, Up: Subsystems
66 Q4.3.2: What is TM and where do I get it?
67 -----------------------------------------
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
75 TM now comes as a package with XEmacs 19.16 and XEmacs 20.2.
77 TM was written by MORIOKA Tomohiko <morioka@jaist.ac.jp> and
78 KOBAYASHI Shuhei <shuhei-k@jaist.ac.jp>.
80 It is based on the work of UMEDA Masanobu
81 <umerin@mse.kyutech.ac.jp>, the original writer of GNUS.
83 The following information is from the `README':
85 "tm" is a MIME package for GNU Emacs. tm has following functions:
87 * MIME style multilingual header.
89 * MIME message viewer (mime/viewer-mode).
91 * MIME message composer (mime/editor-mode).
93 * MIME extenders for mh-e, GNUS, RMAIL and VM.
95 tm is available from following anonymous ftp sites:
96 * `ftp://ftp.unicamp.br/pub/mail/mime/tm/' (Brasil).
98 * `ftp://ftp.th-darmstadt.de/pub/editors/GNU-Emacs/lisp/mime/'
101 * `ftp://ftp.tnt.uni-hannover.de/pub/editors/xemacs/contrib/'
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.
109 File: xemacs-faq.info, Node: Q4.3.3, Next: Q4.3.4, Prev: Q4.3.2, Up: Subsystems
111 Q4.3.3: Why isn't this `movemail' program working?
112 --------------------------------------------------
114 Ben Wing <ben@xemacs.org> writes:
116 It wasn't chown'ed/chmod'd correctly.
119 File: xemacs-faq.info, Node: Q4.3.4, Next: Q4.3.5, Prev: Q4.3.3, Up: Subsystems
121 Q4.3.4: Movemail is also distributed by Netscape? Can that cause problems?
122 ---------------------------------------------------------------------------
124 Steve Baur <steve@xemacs.org> writes:
126 Yes. Always use the movemail installed with your XEmacs. Failure
127 to do so can result in lost mail.
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
136 File: xemacs-faq.info, Node: Q4.3.5, Next: Q4.4.1, Prev: Q4.3.4, Up: Subsystems
138 Q4.3.5: Where do I find pstogif (required by tm)?
139 -------------------------------------------------
141 pstogif is part of the latex2html package.
143 Jan Vroonhof <vroonhof@math.ethz.ch> writes:
145 latex2html is best found at the CTAN hosts and their mirrors in
146 `tex-archive/support/latex2html'.
150 * `ftp://ftp.tex.ac.uk/tex-archive/support/latex2html/'.
152 * `ftp://ftp.dante.de/tex-archive/support/latex2html/'.
154 There is a good mirror at ftp.cdrom.com;
155 `ftp://ftp.cdrom.com/pub/tex/ctan/support/latex2html/'.
158 File: xemacs-faq.info, Node: Q4.4.1, Next: Q4.4.2, Prev: Q4.3.5, Up: Subsystems
160 4.4: Sparcworks, EOS, and WorkShop
161 ==================================
163 Q4.4.1: What is SPARCworks, EOS, and WorkShop?
164 ----------------------------------------------
166 John Turner <turner@lanl.gov> writes:
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.
173 See `http://www.sun.com/software/Developer-products/' for more info.
175 EOS stands for "Era on SPARCworks", but I don't know what Era stands
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
184 Chuck Thompson <cthomp@xemacs.org> writes:
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.
190 Martin Buchholz <martin@xemacs.org> writes:
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'.
198 File: xemacs-faq.info, Node: Q4.4.2, Next: Q4.5.1, Prev: Q4.4.1, Up: Subsystems
200 Q4.4.2: How do I start the Sun Workshop support in XEmacs 21?
201 -------------------------------------------------------------
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):
207 (when (featurep 'tooltalk)
208 (load "tooltalk-macros")
209 (load "tooltalk-util")
210 (load "tooltalk-init"))
211 (when (featurep 'sparcworks)
218 If you are not using the latest Workshop (5.0) you have to apply the
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
224 (defvar running-xemacs nil "t if we're running XEmacs")
225 (defvar running-emacs nil "t if we're running GNU Emacs 19")
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))
233 File: xemacs-faq.info, Node: Q4.5.1, Next: Q4.6.1, Prev: Q4.4.2, Up: Subsystems
238 Q4.5.1: What is/was Energize?
239 -----------------------------
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.)
252 File: xemacs-faq.info, Node: Q4.6.1, Next: Q4.7.1, Prev: Q4.5.1, Up: Subsystems
257 Q4.6.1: What is Infodock?
258 -------------------------
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).
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
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.
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
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
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.
295 Four types of menubars are provided:
296 1. An extensive menubar providing access to global InfoDock commands.
298 2. Mode-specific menubars tailored to the current major mode.
300 3. A simple menubar for basic editing to help novices get started
303 4. The standard XEmacs menubar.
305 Most modes also include mode-specific popup menus. Additionally,
306 region and rectangle popup menus are included.
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.
313 The `OO-Browser', a multi-language object-oriented code browser, is a
314 standard part of InfoDock.
316 InfoDock saves a more extensive set of user options than other Emacs
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.
324 Your working set of buffers is automatically saved and restored (if
325 you answer yes to a prompt) between InfoDock sessions.
327 Refined color choices for code highlighting are provided for both
328 dark and light background display frames.
330 The `C-z' key prefix performs frame-based commands which parallel the
331 `C-x' key prefix for window-based commands.
333 The Smart Menu system is included for producing command menus on dumb
336 Lisp libraries are better categorized according to function.
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.
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.
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>.
353 Ftp to ftp.xemacs.org (Internet Host ID = 128.174.252.16):
355 prompt> ftp ftp.xemacs.org
357 Login as `anonymous' with your own <user-id>@<site-name> as a
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.
365 Move to the location of the InfoDock archives:
369 Set your transfer mode to binary:
377 Interactive mode off.
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:
386 Close the FTP connection:
391 Read the `ID-INSTALL' file which you just retrieved for step-by-step
392 installation instructions.
395 File: xemacs-faq.info, Node: Q4.7.1, Next: Q4.7.2, Prev: Q4.6.1, Up: Subsystems
397 4.7: Other Unbundled Packages
398 =============================
400 Q4.7.1: What is AUC TeX? Where do you get it?
401 ----------------------------------------------
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.
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.
411 The most recent version is always available by ftp at
412 `ftp://sunsite.auc.dk/packages/auctex/auctex.tar.gz'.
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>.
417 WWW users may want to check out the AUC TeX page at
418 `http://sunsite.auc.dk/auctex/'.
421 File: xemacs-faq.info, Node: Q4.7.2, Next: Q4.7.3, Prev: Q4.7.1, Up: Subsystems
423 Q4.7.2: Are there any Emacs Lisp Spreadsheets?
424 ----------------------------------------------
426 Yes. Check out "dismal" (which stands for Dis' Mode Ain't Lotus) at
427 `ftp://cs.nyu.edu/pub/local/fox/dismal/'.
430 File: xemacs-faq.info, Node: Q4.7.3, Next: Q4.7.4, Prev: Q4.7.2, Up: Subsystems
432 Q4.7.3: [This question intentionally left blank]
433 ------------------------------------------------
436 File: xemacs-faq.info, Node: Q4.7.4, Next: Q4.7.5, Prev: Q4.7.3, Up: Subsystems
438 Q4.7.4: Problems installing AUC TeX.
439 ------------------------------------
441 Jan Vroonhof <vroonhof@math.ethz.ch> writes:
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...
448 Most problems with AUC TeX are one of two things:
450 * The TeX-lisp-directory in `tex-site.el' and the makefile don't
453 Fix: make sure you configure AUC TeX properly *before* installing.
455 * You have an old version of easymenu.el in your path.
457 Fix: use `locate-library' and remove old versions to make sure it
458 *only* finds the one that came with XEmacs.
461 File: xemacs-faq.info, Node: Q4.7.5, Next: Q4.7.6, Prev: Q4.7.4, Up: Subsystems
463 Q4.7.5: Is there a reason for an Emacs package not to be included in XEmacs?
464 ----------------------------------------------------------------------------
466 The reason for an Emacs package not to be included in XEmacs is
467 usually one or more of the following:
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
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.
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.
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.
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.
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.
497 File: xemacs-faq.info, Node: Q4.7.6, Prev: Q4.7.5, Up: Subsystems
499 Q4.7.5: Is there a MatLab mode?
500 -------------------------------
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).
507 File: xemacs-faq.info, Node: Miscellaneous, Next: MS Windows, Prev: Subsystems, Up: Top
509 5 The Miscellaneous Stuff
510 *************************
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
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?
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?
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.
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?
574 File: xemacs-faq.info, Node: Q5.0.1, Next: Q5.0.2, Prev: Miscellaneous, Up: Miscellaneous
576 5.0: Major & Minor Modes
577 ========================
579 Q5.0.1: How can I do source code highlighting using font-lock?
580 --------------------------------------------------------------
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:
586 (add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
587 (add-hook 'dired-mode-hook 'turn-on-font-lock)
589 to your `.emacs'. See the file `etc/sample.emacs' for more examples.
591 See also `Syntax Highlighting' from the `Options' menu. Remember to
595 File: xemacs-faq.info, Node: Q5.0.2, Next: Q5.0.3, Prev: Q5.0.1, Up: Miscellaneous
597 Q5.0.2: I do not like cc-mode. How do I use the old c-mode?
598 ------------------------------------------------------------
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'.
605 But, if you still insist, add the following lines to your `.emacs':
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")
615 This must be done before any other reference is made to either
619 File: xemacs-faq.info, Node: Q5.0.3, Next: Q5.0.4, Prev: Q5.0.2, Up: Miscellaneous
621 Q5.0.3: How do I get `More' Syntax Highlighting on by default?
622 --------------------------------------------------------------
624 Use the following code in your `.emacs':
626 (setq-default font-lock-maximum-decoration t)
628 In versions of XEmacs prior to 19.14, you had to use a kludgy
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)
635 It will work for C, C++ and Lisp.
637 See also `Syntax Highlighting' from the `Options' menu. Remember to
641 File: xemacs-faq.info, Node: Q5.0.4, Next: Q5.0.5, Prev: Q5.0.3, Up: Miscellaneous
643 Q5.0.4: How can I enable auto-indent?
644 -------------------------------------
646 Put the following line in your `.emacs':
648 (setq indent-line-function 'indent-relative-maybe)
650 If you want to get fancy, try the `filladapt' package available
651 standard with XEmacs. Put this into your `.emacs':
654 (add-hook 'text-mode-hook 'turn-on-filladapt-mode)
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
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.
666 Please note that the `fa-extras' package is no longer useful.
669 File: xemacs-faq.info, Node: Q5.0.5, Next: Q5.0.6, Prev: Q5.0.4, Up: Miscellaneous
671 Q5.0.5: How can I get XEmacs to come up in text/auto-fill mode by default?
672 --------------------------------------------------------------------------
674 Try the following lisp in your `.emacs':
676 (setq default-major-mode 'text-mode)
677 (setq text-mode-hook 'turn-on-auto-fill)
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
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':
691 (setq initial-major-mode
694 (turn-on-auto-fill)))
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).
711 File: xemacs-faq.info, Node: Q5.0.6, Next: Q5.0.7, Prev: Q5.0.5, Up: Miscellaneous
713 Q5.0.6: How do I start up a second shell buffer?
714 ------------------------------------------------
716 In the `*shell*' buffer:
718 M-x rename-buffer <RET> *shell-1* <RET>
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
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,
731 File: xemacs-faq.info, Node: Q5.0.7, Next: Q5.0.8, Prev: Q5.0.6, Up: Miscellaneous
733 Q5.0.7: Telnet from shell filters too much
734 ------------------------------------------
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?
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.
746 File: xemacs-faq.info, Node: Q5.0.8, Next: Q5.0.9, Prev: Q5.0.7, Up: Miscellaneous
748 Q5.0.8: Why does edt emulation not work?
749 ----------------------------------------
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':
757 If you don't want it to replace `C-h' with an edt-style help menu
760 (global-set-key [(control h)] 'help-for-help)
763 File: xemacs-faq.info, Node: Q5.0.9, Next: Q5.0.10, Prev: Q5.0.8, Up: Miscellaneous
765 Q5.0.9: How can I emulate VI and use it as my default mode?
766 -----------------------------------------------------------
768 Our recommended VI emulator is viper. To make viper-mode the default,
769 add this to your `.emacs':
773 Michael Kifer <kifer@CS.SunySB.EDU> writes:
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.
779 File: xemacs-faq.info, Node: Q5.0.10, Next: Q5.0.11, Prev: Q5.0.9, Up: Miscellaneous
781 Q5.0.10: [This question intentionally left blank]
782 -------------------------------------------------
784 Obsolete question, left blank to avoid renumbering
787 File: xemacs-faq.info, Node: Q5.0.11, Next: Q5.0.12, Prev: Q5.0.10, Up: Miscellaneous
789 Q5.0.11: How do I turn on filladapt for all buffers?
790 ----------------------------------------------------
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
796 (setq-default filladapt-mode t)
798 Use `turn-on-filladapt-mode' to turn Filladapt on in particular
799 major modes, like this:
801 (add-hook 'text-mode-hook 'turn-on-filladapt-mode)
804 File: xemacs-faq.info, Node: Q5.0.12, Next: Q5.0.13, Prev: Q5.0.11, Up: Miscellaneous
806 Q5.0.12: How do I disable gnuserv from opening a new frame?
807 -----------------------------------------------------------
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
813 (setq gnuserv-frame (selected-frame))
815 early on in your `.emacs', to ensure that the first frame created is
816 the one used for your gnuserv buffers.
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'
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>'.
828 File: xemacs-faq.info, Node: Q5.0.13, Next: Q5.0.14, Prev: Q5.0.12, Up: Miscellaneous
830 Q5.0.13: How do I start gnuserv so that each subsequent XEmacs is a client?
831 ---------------------------------------------------------------------------
833 Put the following in your `.emacs' file to start the server:
837 Start your first XEmacs as usual. After that, you can do:
839 gnuclient randomfilename
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
846 See also man page of gnuclient.
849 File: xemacs-faq.info, Node: Q5.0.14, Next: Q5.0.15, Prev: Q5.0.13, Up: Miscellaneous
851 Q5.0.14: Strange things are happening in Shell Mode.
852 ----------------------------------------------------
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
860 Martin Buchholz <martin@xemacs.org> writes:
862 There is a known problem with interaction between `csh' and the
863 `filec' option and XEmacs. You should add the following to your
866 if ( "$TERM" == emacs || "$TERM" == unknown ) unset filec
869 File: xemacs-faq.info, Node: Q5.0.15, Next: Q5.0.16, Prev: Q5.0.14, Up: Miscellaneous
871 Q5.0.15: Where do I get the latest CC Mode?
872 -------------------------------------------
874 Barry A. Warsaw <bwarsaw@cnri.reston.va.us> writes:
876 This can be had from `http://www.python.org/emacs/'.
879 File: xemacs-faq.info, Node: Q5.0.16, Next: Q5.0.17, Prev: Q5.0.15, Up: Miscellaneous
881 Q5.0.16: I find auto-show-mode disconcerting. How do I turn it off?
882 --------------------------------------------------------------------
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':
888 (setq auto-show-mode nil)
889 (setq-default auto-show-mode nil)
892 File: xemacs-faq.info, Node: Q5.0.17, Next: Q5.0.18, Prev: Q5.0.16, Up: Miscellaneous
894 Q5.0.17: How can I get two instances of info?
895 ---------------------------------------------
897 You can't. The `info' package does not provide for multiple info
901 File: xemacs-faq.info, Node: Q5.0.18, Next: Q5.0.19, Prev: Q5.0.17, Up: Miscellaneous
903 Q5.0.18: [This question intentionally left blank]
904 -------------------------------------------------
907 File: xemacs-faq.info, Node: Q5.0.19, Next: Q5.0.20, Prev: Q5.0.18, Up: Miscellaneous
909 Q5.0.19: Is there something better than LaTeX mode?
910 ---------------------------------------------------
912 David Kastrup <dak@fsnif.neuroinformatik.ruhr-uni-bochum.de> writes:
914 The standard TeX modes leave much to be desired, and are somewhat
915 leniently maintained. Serious TeX users use AUC TeX (*note
919 File: xemacs-faq.info, Node: Q5.0.20, Next: Q5.1.1, Prev: Q5.0.19, Up: Miscellaneous
921 Q5.0.20: Is there a way to start a new XEmacs if there's no gnuserv running, and otherwise use gnuclient?
922 ---------------------------------------------------------------------------------------------------------
924 Jan Vroonhof <vroonhof@math.ethz.ch> writes:
925 Here is one of the solutions, we have this in a script called
928 if gnuclient -batch -eval t >/dev/null 2>&1
930 exec gnuclient ${1+"$@"}
932 xemacs -unmapped -f gnuserv-start &
933 until gnuclient -batch -eval t >/dev/null 2>&1
937 exec gnuclient ${1+"$@"}
940 Note that there is a known problem when running XEmacs and
941 'gnuclient -nw' on the same TTY.
944 File: xemacs-faq.info, Node: Q5.1.1, Next: Q5.1.2, Prev: Q5.0.20, Up: Miscellaneous
946 5.1: Emacs Lisp Programming Techniques
947 ======================================
949 Q5.1.1: What is the difference in key sequences between XEmacs and GNU Emacs?
950 -----------------------------------------------------------------------------
952 Erik Naggum <clerik@naggum.no> writes;
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.
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.
982 File: xemacs-faq.info, Node: Q5.1.2, Next: Q5.1.3, Prev: Q5.1.1, Up: Miscellaneous
984 Q5.1.2: Can I generate "fake" keyboard events?
985 ----------------------------------------------
987 I wonder if there is an interactive function that can generate
988 "fake" keyboard events. This way, I could simply map them inside
993 (defun cg--generate-char-event (ch)
994 "Generate an event, as if ch has been typed"
995 (dispatch-event (character-to-event ch)))
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)))
1004 File: xemacs-faq.info, Node: Q5.1.3, Next: Q5.1.4, Prev: Q5.1.2, Up: Miscellaneous
1006 Q5.1.3: Could you explain `read-kbd-macro' in more detail?
1007 ----------------------------------------------------------
1009 The `read-kbd-macro' function returns the internal Emacs
1010 representation of a human-readable string (which is its argument).
1013 (read-kbd-macro "C-c C-a")
1014 => [(control ?c) (control ?a)]
1016 (read-kbd-macro "C-c C-. <up>")
1017 => [(control ?c) (control ?.) up]
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
1023 The exact "human-readable" syntax is defined in the docstring of
1024 `edmacro-mode'. I'll repeat it here, for completeness.
1026 Format of keyboard macros during editing:
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>'.
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.
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.
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.
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:
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'.
1059 * The `^' notation for control characters also works: `^M' ==
1062 * Double angle brackets enclose command names: `<<next-line>>'
1063 is shorthand for `M-x next-line <RET>'.
1065 * Finally, `REM' or `;;' causes the rest of the line to be
1066 ignored as a comment.
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'.
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.
1081 File: xemacs-faq.info, Node: Q5.1.4, Next: Q5.1.5, Prev: Q5.1.3, Up: Miscellaneous
1083 Q5.1.4: What is the performance hit of `let'?
1084 ---------------------------------------------
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
1094 File: xemacs-faq.info, Node: Q5.1.5, Next: Q5.1.6, Prev: Q5.1.4, Up: Miscellaneous
1096 Q5.1.5: What is the recommended use of `setq'?
1097 ----------------------------------------------
1101 You will typically `defvar' your global variable to a default
1102 value, and use `setq' to set it later.
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':
1110 (let ((case-fold-search nil))
1111 ... ; code with searches that must be case-sensitive
1114 You will notice the user-variables by their docstrings beginning
1115 with an asterisk (a convention).
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.
1127 ;; iterate through the elements of the list returned by
1128 ;; `hairy-function-that-returns-list'
1129 (let ((l (hairy-function-that-returns-list)))
1131 ... do something with (car l) ...
1134 Another typical usage includes building a value simply to work
1137 ;; Build the mode keymap out of the key-translation-alist
1138 (let ((inbox (file-truename (expand-file-name box)))
1140 ... code dealing with inbox ...
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
1148 (setq foo-processed-inbox
1152 File: xemacs-faq.info, Node: Q5.1.6, Next: Q5.1.7, Prev: Q5.1.5, Up: Miscellaneous
1154 Q5.1.6: What is the typical misuse of `setq' ?
1155 ----------------------------------------------
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:
1161 (defun my-function (whatever)
1163 ... build a large list ...
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:
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 ...)
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.
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:
1181 (defun flurgoze nil) ; ok, global internal variable
1184 (setq flurghoze t) ; ops! a typo, but semantically correct.
1185 ; however, the byte-compiler warns.
1187 While compiling toplevel forms:
1188 ** assignment to free variable flurghoze
1191 File: xemacs-faq.info, Node: Q5.1.7, Next: Q5.1.8, Prev: Q5.1.6, Up: Miscellaneous
1193 Q5.1.7: I like the `do' form of cl, does it slow things down?
1194 -------------------------------------------------------------
1196 It shouldn't. Here is what Dave Gillespie has to say about cl.el
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,
1208 are expanded at compile-time to the Lisp forms
1211 (setcar p (cons x (car p)))
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
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.
1227 You can find out how a macro expands by using the `cl-prettyexpand'
1231 File: xemacs-faq.info, Node: Q5.1.8, Next: Q5.1.9, Prev: Q5.1.7, Up: Miscellaneous
1233 Q5.1.8: I like recursion, does it slow things down?
1234 ---------------------------------------------------
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.
1241 Please try not to make your code much uglier to gain a very small
1242 speed gain. It's not usually worth it.
1245 File: xemacs-faq.info, Node: Q5.1.9, Next: Q5.1.10, Prev: Q5.1.8, Up: Miscellaneous
1247 Q5.1.9: How do I put a glyph as annotation in a buffer?
1248 -------------------------------------------------------
1250 Here is a solution that will insert the glyph annotation at the
1251 beginning of buffer:
1253 (make-annotation (make-glyph '([FORMAT :file FILE]
1254 [string :data "fallback-text"]))
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').
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)'.
1268 File: xemacs-faq.info, Node: Q5.1.10, Next: Q5.1.11, Prev: Q5.1.9, Up: Miscellaneous
1270 Q5.1.10: `map-extents' won't traverse all of my extents!
1271 --------------------------------------------------------
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?
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.
1283 (map-extents (lambda (ext ignore)
1285 (message "fubar!")))
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:
1290 (map-extents (lambda (ext ignore)
1296 File: xemacs-faq.info, Node: Q5.1.11, Next: Q5.2.1, Prev: Q5.1.10, Up: Miscellaneous
1298 Q5.1.11: My elisp program is horribly slow. Is there
1299 -----------------------------------------------------
1301 an easy way to find out where it spends time?
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.