This is Info file ../info/xemacs-faq.info, produced by Makeinfo-1.63
from the input file xemacs-faq.texi.


File: xemacs-faq.info,  Node: Top,  Next: 1. Introductory Questions,  Prev: (dir),  Up: (dir)

XEmacs FAQ
**********

   Version:  1995/08/29

   Current-Editor: Chuck Thompson <cthomp@cs.uiuc.edu>

   Copying Status: Freely Redistributable.  I take no liability for the
               correctness and safety of any procedures or advice given
               here.  This FAQ is distributed in the hope that it will
               be useful, but WITHOUT ANY WARRANTY; without even the
             implied warranty of MERCHANTABILITY or FITNESS FOR A
          PARTICULAR PURPOSE.

   This is a list of frequently asked questions for XEmacs users and
maintainers.

   You can obtain the latest version of this file by anonymous FTP from
site `ftp.cs.uiuc.edu:/pub/xemacs/faq/xemacs-faq.FORMAT' where FORMAT
is text, texinfo (the master copy), postscript, dvi, html, info.  Note
that the html version has 2 files.

   Thanks to the many who contributed, especially to JWZ
<jwz@netscape.com> for starting this whole wonderful mess...  Special
thanks to Tim Geisler <tmgeisle@faui80.informatik.uni-erlangen.de> for
the initial texinfo version and to Giacomo Boffi
<sboff@hp735.stru.polimi.it> for the initial HTML version.  Other
contributors (many left out, unfortunately, due to an old mail-purge)
include:
   * Juergen Nickelsen <nickel@prz.tu-berlin.de>

   * Evelyn Ginsparg <ginsparg@adra.com>

   * d3h554@foghorn.pnl.gov

   * Marty Hall <hall@aplcenmp.apl.jhu.edu>

   * Richard Caley <rjc@cogsci.ed.ac.uk>

   * fcg@philabs.Philips.COM

   * Stig <stig@hackvan.com>

   * Arup Mukherjee <arup+@cmu.edu>

   * Kevin R. Powell <powell@csl.ncsa.uiuc.edu>

   * Eric Eide <eeide@cs.utah.edu>

   * William G. Dubuque <wgd@martigny.ai.mit.edu>

   * Chris Flatters <cflatter@nrao.edu>

   * John A. Turner <turner@lanl.gov>

* Menu:

* top::                         XEmacs FAQ
* 1. Introductory Questions::.
* 2. Compiling XEmacs::.
* 3. Problems running XEmacs / weird messages::.
* 4. Customization - Emacs Lisp and the .emacs file::.
* 5. Customization - X resources::.
* 6. Changing textual fonts and colors::.
* 7. The modeline::.
* 8. The keyboard::.
* 9. The cursor::.
* 10. The mouse; cutting and pasting::.
* 11. Highlighting::.
* 12. The menubar and toolbar::.
* 13. Scrollbars::.
* 14. Frame Geometry::.
* 15. Window/icon title; window manager problems::.
* 16. Editing source code (C mode; Lisp mode; etc.)::.
* 17. Text mode::.
* 18. Shell mode::.
* 19. Mail; VM; GNUS; BBDB; and related::.
* 20. Printing::.
* 21. Gnuserv::.
* 22. Miscellaneous::.


File: xemacs-faq.info,  Node: 1. Introductory Questions,  Next: 2. Compiling XEmacs,  Prev: Top,  Up: Top

1. Introductory Questions
*************************

* Menu:

* 1.1.::          1.1. Preface
* 1.2.::          1.2. What is XEmacs?
* 1.3.::          1.3. What is the current version of XEmacs?
* 1.4.::          1.4. Where can I find it?
* 1.5.::          1.5. Why another version of Emacs?
* 1.6.::          1.6. What do `M-x', GNU, etc. mean?
* 1.7.::          1.7. Where can I get help for using XEmacs?
* 1.8.::          1.8. Where is the mailing list archived?
* 1.9.::          1.9. What is InfoDock, how does it relate to XEmacs, and how can I obtain it?


File: xemacs-faq.info,  Node: 1.1.,  Next: 1.2.,  Up: 1. Introductory Questions

1.1. Preface
============

   This is the introduction to a list of frequently asked questions
(FAQ's) about XEmacs with answers.  This article contains a listing of
the questions; subsequent articles contain the questions and answers.

   This is not a substitute for general Emacs questions, and actually
includes nothing that might help a novice learn to use Emacs or XEmacs.
For that, check out the regular Emacs lists, the tutorial inside of
XEmacs (look on the Help menu), or the O'Reilly book `Learning GNU
Emacs'.  This FAQ focuses on specific issues regarding XEmacs.  If you
don't find the answer here, perhaps it really is a more general
question, and check the GNU Emacs FAQ for more information, as well.

   The FAQ list is posted to reduce the noise level in the
`comp.emacs.xemacs' newsgroup which results from the repetition of
frequently asked questions, wrong answers to these questions,
corrections to the wrong answers, corrections to the corrections,
debate, name calling, etc.  Also, it serves as a repository of the
canonical "best" answers to these questions.  However, if you know a
better answer or even a slight change that improves an answer, please
tell me!

   If you know the answer of a question is in the FAQ list, please
reply to the question by e-mail instead of posting.  Help reduce noise!

   Please suggest new questions, answers, wording changes, deletions,
etc.  The most helpful form for suggestions is a context diff (i.e. the
output of `diff -c').  Include `FAQ' in the subject of messages sent to
us about the FAQ list.

   Please do not send questions to us just because you do not want to
disturb a lot of people and you think we would know the answer.  We do
not have time to answer questions individually and keep up with
everything else we have to get done.

   Many thanks need to go to all contributors on the old
alt.lucid-emacs.* and current comp.emacs.xemacs groups.  This would
never have been collected without you.

   Any directories given are usually in reference to the base directory
formed by unpacking XEmacs.


File: xemacs-faq.info,  Node: 1.2.,  Next: 1.3.,  Prev: 1.1.,  Up: 1. Introductory Questions

1.2. What is XEmacs?
====================

   An alternative to GNU Emacs, originally based on an early alpha
version of FSF's version 19.  XEmacs was known as Lucid Emacs through
version 19.10.  Almost all features of GNU Emacs are supported in
XEmacs (the ones that aren't supported are generally implemented in a
better way in XEmacs).  The maintainers of XEmacs actively track
changes to GNU Emacs while also working to add new features never
before seen in Emacs.


File: xemacs-faq.info,  Node: 1.3.,  Next: 1.4.,  Prev: 1.2.,  Up: 1. Introductory Questions

1.3. What is the current version of XEmacs?
===========================================

   The current version is 19.13, released on September 1, 1995.


File: xemacs-faq.info,  Node: 1.4.,  Next: 1.5.,  Prev: 1.3.,  Up: 1. Introductory Questions

1.4. Where can I find it?
=========================

   The canonical source and binaries is found via anonymous FTP at

   `ftp.cs.uiuc.edu:/pub/xemacs'.


File: xemacs-faq.info,  Node: 1.5.,  Next: 1.6.,  Prev: 1.4.,  Up: 1. Introductory Questions

1.5. Why Another Version of Emacs?
==================================

   For a detailed description of the differences between GNU Emacs and
XEmacs, and a detailed history of XEmacs, see the file `etc/NEWS' in
the source distribution.  However, here is a list of some of the
reasons why we think you might consider using it:

   * It looks nicer

   * The XEmacs maintainers are generally more receptive to suggestions
     than the GNU Emacs maintainers

   * Many more bundled packages than GNU Emacs, all properly integrated
     with XEmacs

   * Binaries are available for many common operating systems

   * Face support on TTY's

   * A built-in toolbar

   * Better Motif compliance

   * Some internationalization support for European languages.  Full
     MULE (Multi-Lingual EMacs) support is being actively worked on.

   * Variable-width fonts

   * Variable-height lines

   * Marginal annotations

   * ToolTalk support

   * XEmacs can be used as an Xt widget, and can be embedded within
     another application

   * Horizontal and vertical scrollbars (using real toolkit scrollbars)

   * Better APIs (and performance) for attaching fonts, colors, and
     other properties to text

   * The ability to embed arbitrary graphics in a buffer

   * Completely compatible (at the C level) with the Xt-based toolkits


File: xemacs-faq.info,  Node: 1.6.,  Next: 1.7.,  Prev: 1.5.,  Up: 1. Introductory Questions

1.6. What do `M-x', GNU, etc. mean?
===================================

   This is really a general Emacs question, but a table of some common
terms/acronyms is provided here for your convenience.

   See the `GNU Emacs FAQ' for a more complete list.

`BLAT FOOP'
     Historical XEmacs error message

`C-x'
     "C-x" means that the Control key and the X key should be pressed
     together, like when you use the Shift key.

`E-Lisp'
     Same as "Emacs-Lisp".

`Emacs-Lisp'
     The dialect of Lisp supported by Emacs and XEmacs.  You use this to
     customize XEmacs.

`FAQ'
     Frequently asked question(s).

`FSF'
     The Free Software Foundation.

`GNU'
     "GNU" refers to products written by the Free Software Foundation.

`JWZ'
     Jamie Zawinski <jwz@netscape.com>, the former maintainer of Lucid
     Emacs (which XEmacs evolved from).

`M-x'
     "M-x" means that the Meta key and the X key should be pressed
     together, like when you use the Shift key.  Sometimes the Meta key
     is labelled `Alt' or with a diamond.  Some keyboards don't have a
     Meta key at all; then you can get the equivalent by typing the Esc
     key followed by the X key.

`RMS'
     Richard Stallman <rms@gnu.ai.mit.edu>, the author of GNU Emacs.

`VI'
     An editor used by those heretics that don't subscribe to the Emacs
     religion.


File: xemacs-faq.info,  Node: 1.7.,  Next: 1.8.,  Prev: 1.6.,  Up: 1. Introductory Questions

1.7. Where can I get help for using XEmacs?
===========================================

   Probably the easiest way, if everything is installed, is to use
info, by pressing `C-h i', or selecting `Emacs Info' from the Help Menu.
Also, `M-x apropos' will look for commands for you.

   Try reading this FAQ, examining the regular GNU Emacs FAQ (which can
be found with the Emacs 19 distribution) as well as at

   `http://www.eecs.nwu.edu/emacs/faq/' and reading the Usenet group
`comp.emacs.xemacs'.  If that does not help, try posting your question
to `comp.emacs.xemacs'.  If you cannot post or read Usenet news, there
is a corresponding mailing list which is available.  It can be
subscribed to by sending mail to

     xemacs-request@cs.uiuc.edu

   for subscription information and

     xemacs@cs.uiuc.edu

   to send messages to the list.

   To cancel a subscription, YOU MUST use the xemacs-request address.

   Bug reports should be sent to the same locations.


File: xemacs-faq.info,  Node: 1.8.,  Next: 1.9.,  Prev: 1.7.,  Up: 1. Introductory Questions

1.8. Where is the mailing list archived?
========================================

   The mailing list is archived in the directory

   `ftp.cs.uiuc.edu:/pub/xemacs/mlists/'.


File: xemacs-faq.info,  Node: 1.9.,  Prev: 1.8.,  Up: 1. Introductory Questions

1.9. What is InfoDock, how does it relate to XEmacs, and how can I obtain it?
=============================================================================

   InfoDock is an integrated productivity toolset, mainly aimed at
technical people.  It is built atop the XEmacs variant of GNU Emacs and
so has all of the power of Emacs, but with an easier to use and more
comprehensive menu-based user interface.  The next section describes how
it differs from XEmacs and GNU Emacs from the Free Software Foundation.

   The quickest way to get a feel for InfoDock is to browse the InfoDock
Manual, especially the section on tools.  This will help you decide
whether or not to download InfoDock for local use.  This manual is
available in gzipped Postscript form, alongside the InfoDock
distribution.  (See below for FTP retrieval instructions.)

   InfoDock is aimed at people who want a free, turn-key productivity
environment.  Although InfoDock is customizable, it is not intended for
people who like basic versions of Emacs which need to be customized
extensively for local use; standard Emacs distributions are better for
such uses.  InfoDock is for those people who want a complete,
pre-customized environment in one package, which they need not touch
more than once or twice a year to update to new revisions.

   InfoDock is pre-built for SPARCstations running SunOS V4 or V5
(Solaris).  It is intended for use on a color display, although most
features will work on monochrome monitors.  Simply unpack InfoDock
according to the instructions in the ID-INSTALL file and you are ready
to run.

   The InfoDock Manual is concise, yet sufficient as a user guide for
users who have never used an Emacs-type editor before.  For users who
are already familiar with Emacs, it supplements the information in the
GNU Emacs Manual.

   InfoDock menus are much more extensive and more mature than standard
Emacs menus.  Each menu offers a `Manual' item which displays
documentation associated with the menu's functions.

   Three types of menubars are provided:
  1. An extensive menubar providing access to global InfoDock commands.

  2. Mode-specific menubars tailored to the current major mode.

  3. A simple menubar for basic editing to help novices get started
     with InfoDock.

   Most modes also include mode-specific popup menus.  Additionally,
region and rectangle popup menus are included.
   * `Hyperbole', the everyday information manager, is a core part of
     InfoDock.  This provides context-sensitive mouse keys, a
     rolodex-type contact manager, programmable hypertext buttons, and
     an autonumbered outliner with embedded hyperlink anchors.

   * `PIEmail', the prototype Personalized Information Environment Mail
     Tool, is included.

   * The `OO-Browser', a multi-language object-oriented code browser,
     is a standard part of InfoDock.

   InfoDock saves a more extensive set of user options than other Emacs
versions.

   InfoDock inserts a useful file header in many file types, showing the
author, summary, and last modification time of each file.  A summary
program can then be used to summarize all of the files in a directory,
for easy MANIFEST file creation.

   Your working set of buffers is automatically saved and restored (if
you answer yes to a prompt) between InfoDock sessions.

   Refined color choices for code highlighting are provided for both
dark and light background display frames.

   The `C-z' key prefix performs frame-based commands which parallel the
`C-x' key prefix for window-based commands.

   The Smart Menu system is included for producing command menus on dumb
terminals. (InfoDock does not yet run on dumb terminals but will in
1995.)

   Lisp libraries are better categorized according to function.

   Extensions and improvements to many areas of Emacs are included,
such as: paragraph filling, mail reading with Rmail, shell handling,
outlining, code highlighting and browsing, and man page browsing.

   InfoDock questions, answers and discussion should go to the mail list
`infodock@hub.ucsb.edu'.  Use `infodock-request@hub.ucsb.edu' to be
added or removed from the list.  Always include your InfoDock version
number when sending help requests.

   InfoDock is available across the Internet via anonymous FTP.  To get
it, first move to a directory into which you want the InfoDock archive
files placed.  We will call this <DIST-DIR>.

        cd <DIST-DIR>

   FTP to ftp.cs.uiuc.edu  (Internet Host ID = 128.174.252.1):

        prompt> ftp ftp.cs.uiuc.edu

   Login as `anonymous' with your own <user-id>@<site-name> as a
password.

        Name (ftp.cs.uiuc.edu): anonymous
        331 Guest login ok, send your complete e-mail address as password.
        Password: -<your-user-id@your-domain>
        230 Guest login ok, access restrictions apply.

   Move to the location of the InfoDock archives:

        ftp> cd pub/xemacs/infodock

   Set your transfer mode to binary:

        ftp> bin
        200 Type set to I.

   Turn off prompting:

        ftp> prompt
        Interactive mode off.

   Retrieve the InfoDock archives that you want, either by using a `get
<file>' for each file you want or by using the following to get a
complete distribution, including all binaries:

        ftp> mget ID-INSTALL
        ftp> mget id-*

   Close the FTP connection:

        ftp> quit
        221 Goodbye.

   Read the `ID-INSTALL' file which you just retrieved for step-by-step
installation instructions.


File: xemacs-faq.info,  Node: 2. Compiling XEmacs,  Next: 3. Problems running XEmacs / weird messages,  Prev: 1. Introductory Questions,  Up: Top

2. Compiling XEmacs
*******************

* Menu:

* 2.1.::          2.1. What is the best way to compile XEmacs with the netaudio system, since I have got the netaudio system compiled but installed at a weird place, I am not root.  Also in the READMEs it does not say anything about compiling with the audioserver?


File: xemacs-faq.info,  Node: 2.1.,  Up: 2. Compiling XEmacs

2.1. What is the best way to compile XEmacs with the netaudio system, since I have got the netaudio system compiled but installed at a weird place, I am not root.  Also in the READMEs it does not say anything about compiling with the audioserver?
======================================================================================================================================================================================================================================================

   You should only need to add some stuff to the configure command
line.  To tell it to compile in netaudio support:

     --with-sound=both

   (Or `--with-sound=nas' if you don't want native sound support for
some reason.) To tell it where to find the netaudio includes and
libraries:

     --site-libraries=WHATEVER
     --site-includes=WHATEVER

   Then (fingers crossed) it should compile and it will use netaudio if
you have a server running corresponding to the X server. The netaudio
server has to be there when XEmacs starts. If the netaudio server goes
away and another is run, XEmacs should cope (fingers crossed, error
handling in netaudio isn't perfect).

   BTW, netaudio has been renamed as it has a name clash with something
else, so if you see references to NAS or Network Audio System, it's the

   same thing.  It also might be found at

     ftp.x.org:/contrib/audio/nas/
     ftp.ncd.com:/pub/ncd/technology/src/nas/


File: xemacs-faq.info,  Node: 3. Problems running XEmacs / weird messages,  Next: 4. Customization - Emacs Lisp and the .emacs file,  Prev: 2. Compiling XEmacs,  Up: Top

3. Problems running XEmacs / weird messages
*******************************************

* Menu:

* 3.1.::          3.1. Help! XEmacs just crashed on me!
* 3.2.::          3.2. When I try to use some particular option of some particular package, I get a cryptic error in the minibuffer.
* 3.3.::          3.3. I get tons of translation table syntax error messages during startup.  How do I get rid of them?
* 3.4.::          3.4. How can I avoid the startup warnings about deducing proper fonts?
* 3.5.::          3.5. Help! I can not get XEmacs to display on my Envizex X-terminal!
* 3.6.::          3.6. Why do I get weird messages about giftoppm and ppmdither not being found?
* 3.7.::          3.7. How can I avoid those messages about deleting excess backup files?
* 3.8.::          3.8. Help! XEmacs just locked up my X server on my Linux box!


File: xemacs-faq.info,  Node: 3.1.,  Next: 3.2.,  Up: 3. Problems running XEmacs / weird messages

3.1. Help! XEmacs just crashed on me!
=====================================

   First of all, don't panic.  Whenever XEmacs crashes, it tries
extremely hard to auto-save all of your files before dying. (The main
time that this will not happen is if the machine physically lost power
or if you killed the XEmacs process using `kill -9'.) The next time you
try to edit those files, you will be informed that a more recent
auto-save file exists.  You can use `M-x recover-file' to retrieve the
auto-saved version of the file.

   Now, XEmacs is not perfect, and there may occasionally be times, or
particular sequences of actions, that cause it to crash.  If you can
come up with a reproducible way of doing this (or even if you have a
pretty good memory of exactly what you were doing at the time), the
maintainers would be very interested in knowing about it.  Post a
message to `comp.emacs.xemacs' or send mail to `xemacs@cs.uiuc.edu'.

   If at all possible, include a stack backtrace of the core dump that
was produced.  This shows where exactly things went wrong, and makes it
much easier to diagnose problems.  To do this, you need to locate the
core file (it's called `core', and is usually sitting in the directory
that you started XEmacs from, or your home directory if that other
directory was not writable).  Then, go to that directory and execute a
command like

     gdb `which xemacs` core

   and then issue the command `where' to get the stack backtrace.  (You
might have to use `dbx' or some similar debugger in place of `gdb'.  If
you don't have any such debugger available, complain to your system
administrator.)

   It's possible that a core file didn't get produced, in which case
you're out of luck.  Go complain to your system administrator and tell
him not to disable core files by default. (If you explicitly disabled
core files, then double shame on you!)


File: xemacs-faq.info,  Node: 3.2.,  Next: 3.3.,  Prev: 3.1.,  Up: 3. Problems running XEmacs / weird messages

3.2. When I try to use some particular option of some particular package, I get a cryptic error in the minibuffer.
==================================================================================================================

   If you can't figure out what's going on, try typing `ESC ESC' and
issuing the command

     (setq debug-on-error t)

   and then try and make the error happen again.  This will give you a
backtrace that may be enlightening.  If not, try reading farther down in
this FAQ; if that fails, you could try posting to `comp.emacs.xemacs'
(making sure to include the backtrace) and someone may be able to help.


File: xemacs-faq.info,  Node: 3.3.,  Next: 3.4.,  Prev: 3.2.,  Up: 3. Problems running XEmacs / weird messages

3.3. I get tons of translation table syntax error messages during startup.  How do I get rid of them?
=====================================================================================================

   There are two causes of this problem.  The first usually only strikes
people using the prebuilt binaries.  The culprit in both cases is the
file `XKeysymDB'.
   * The binary cannot find the XKeysymDB file.  The location is
     hardcoded at compile time so if the system the binary was built on
     puts it a different place than your system does, you have
     problems.  To fix, set the environment variable `XKEYSYMDB' to the
     location of the XKeysymDB file on your system or to the location
     of the one included with XEmacs which should be at:

          <xemacs_root_directory>/lib/xemacs-19.13/etc/XKeysymDB

   * The binary is finding the XKeysymDB but it is out-of-date on your
     system and does not contain the necessary lines.  Either ask your
     system administrator to replace it with the one which comes with
     XEmacs (which is the stock R6 version and is backwards compatible)
     or set your `XKEYSYMDB' variable to the location of XEmacs's
     described above.


File: xemacs-faq.info,  Node: 3.4.,  Next: 3.5.,  Prev: 3.3.,  Up: 3. Problems running XEmacs / weird messages

3.4. How can I avoid the startup warnings about deducing proper fonts?
======================================================================

   This is highly dependent on your installation, but try with the
following font as your base font for XEmacs and see what it does:

     -adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1

   More precisely, do the following in your resource file:

     Emacs.default.attributeFont: -adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1


File: xemacs-faq.info,  Node: 3.5.,  Next: 3.6.,  Prev: 3.4.,  Up: 3. Problems running XEmacs / weird messages

3.5. Help!  I can not get XEmacs to display on my Envizex X-terminal!
=====================================================================

   Try setting the DISPLAY variable using the numeric IP address of the
host you are running XEmacs from.


File: xemacs-faq.info,  Node: 3.6.,  Next: 3.7.,  Prev: 3.5.,  Up: 3. Problems running XEmacs / weird messages

3.6.  Why do I get weird messages about giftoppm and ppmdither not being found?
===============================================================================

   Because they are not.  You are probably trying to read some HTML
files, or using W3-mode as your Web client.  To display inline
pictures, this requires the above programs (which can be found in the
netpbm package or its older version, pbmplus).  The netpbm package can
be found at

   `ftp.x.org', or any of its mirror sites.  It can also be found at
`ftp.cs.uiuc.edu:/pub/xemacs/aux'.


File: xemacs-faq.info,  Node: 3.7.,  Next: 3.8.,  Prev: 3.6.,  Up: 3. Problems running XEmacs / weird messages

3.7.  How can I avoid those messages about deleting excess backup files?
========================================================================

   Try the following Emacs-Lisp:

     (setq version-control t)
     (setq kept-old-versions 0)
     (setq kept-new-versions 8)
     (if (string-match "XEmacs\\|Lucid" emacs-version)
        (setq trim-versions-without-asking t)
        (setq delete-old-versions t))


File: xemacs-faq.info,  Node: 3.8.,  Prev: 3.7.,  Up: 3. Problems running XEmacs / weird messages

3.8.  Help! XEmacs just locked up my X server on my Linux box!
==============================================================

   There have been several reports of the X server locking up under
Linux.  In all reported cases removing speedo and scaled fonts from the
font path corrected the problem.  This can be done with the command
'xset'.

   It is possible that using a font server may also solve the problem.


File: xemacs-faq.info,  Node: 4. Customization - Emacs Lisp and the .emacs file,  Next: 5. Customization - X resources,  Prev: 3. Problems running XEmacs / weird messages,  Up: Top

4. Customization - Emacs Lisp and the .emacs file
*************************************************

* Menu:

* 4.1.::          4.1. How can `.emacs' determine which of the family of emacsen I am using?
* 4.2.::          4.2. How can I detect a color display?
* 4.3.::          4.3. How can I evaluate emacs-lisp expressions without switching to the *scratch* buffer?
* 4.4.::          4.4. If you put (setq tab-width 6) in your `.emacs' file it does not work!  Is there a reason for this.  If you do it at the EVAL prompt it works fine!! How strange.
* 4.5.::          4.5. How can I add directories to the load-path?
* 4.6.::          4.6. How to check if a lisp function is defined or not?
* 4.7.::          4.7.  Can I force the output of (list-faces) to a buffer other than the minibuffer since it is too wide to fit?


File: xemacs-faq.info,  Node: 4.1.,  Next: 4.2.,  Up: 4. Customization - Emacs Lisp and the .emacs file

4.1. How can `.emacs' determine which of the family of Emacsen I am using?
==========================================================================

   To determine if you are currently running GNU Emacs 18, GNU Emacs 19,
XEmacs 19, or Epoch, and use appropriate code, check out the example
given in `etc/sample.emacs'.  There are other nifty things in there as
well!  Alternatively, there is a package, `emacs-vers.el', available at
an Emacs-Lisp archive near you; try searching

     archive.cis.ohio-state.edu:/pub/gnu/emacs/elisp-archive/misc/


File: xemacs-faq.info,  Node: 4.2.,  Next: 4.3.,  Prev: 4.1.,  Up: 4. Customization - Emacs Lisp and the .emacs file

4.2. How can I detect a color display?
======================================

   You can test the return value of the function `(device-class)', as
in:

     (if (eq (device-class) 'color)
         (progn
           (set-face-foreground  'font-lock-comment-face "Grey")
           (set-face-foreground  'font-lock-string-face "Red")
           ....
           ))


File: xemacs-faq.info,  Node: 4.3.,  Next: 4.4.,  Prev: 4.2.,  Up: 4. Customization - Emacs Lisp and the .emacs file

4.3. How can I evaluate Emacs-Lisp expressions without switching to the *scratch* buffer?
=========================================================================================

     (put 'eval-expression 'disabled nil)

   This sets it so that hitting `ESC ESC' lets you type a single
expression to be evaluated.  This line can also be put into your
`.emacs'.


File: xemacs-faq.info,  Node: 4.4.,  Next: 4.5.,  Prev: 4.3.,  Up: 4. Customization - Emacs Lisp and the .emacs file

4.4. If you put (setq tab-width 6) in your `.emacs' file it does not work!  Is there a reason for this.  If you do it at the EVAL prompt it works fine!! How strange.
=====================================================================================================================================================================

   Use setq-default, since tab-width is all-buffer-local.


File: xemacs-faq.info,  Node: 4.5.,  Next: 4.6.,  Prev: 4.4.,  Up: 4. Customization - Emacs Lisp and the .emacs file

4.5. How can I add directories to the load-path?
================================================

   Here are two ways to do that, one that puts your directories at the
front of the load-path, the other at the end:

     ;;; Add things at the beginning of the load-path
     (setq load-path (cons "bar" load-path))
     (setq load-path (cons "foo" load-path))
     
     ;;; Add things at the end
     (setq load-path (append load-path '("foo" "bar")))


File: xemacs-faq.info,  Node: 4.6.,  Next: 4.7.,  Prev: 4.5.,  Up: 4. Customization - Emacs Lisp and the .emacs file

4.6. How to check if a lisp function is defined or not?
=======================================================

   Use the following elisp:

     (fboundp 'foo)

   It's always a mistake, under all circumstances, to test
`emacs-version' or any similar variables, in case they are not bound,
unless you do the above.

   Instead, use feature-tests, such as featurep or boundp or fboundp, or
even simple behavioural tests, eg  (defvar foo-old-losing-code?
(condition-case nil (progn (losing-code t) nil)
        (wrong-number-of-arguments t)))

   There is an incredible amount of broken code out there which could
work much better more often in more places if it did the above instead
of trying to divine its environment from the value of one variable.


File: xemacs-faq.info,  Node: 4.7.,  Prev: 4.6.,  Up: 4. Customization - Emacs Lisp and the .emacs file

4.7.  Can I force the output of (face-list) to a buffer other than the minibuffer since it is too wide to fit?
==============================================================================================================

   Evaluate the expression in the "*scratch*" buffer with point on the
rightmost paren and typing `C-j'.


File: xemacs-faq.info,  Node: 5. Customization - X resources,  Next: 6. Changing textual fonts and colors,  Prev: 4. Customization - Emacs Lisp and the .emacs file,  Up: Top

5. Customization - X resources
******************************

* Menu:

* 5.1.::          5.1. Where is a list of X resources?


File: xemacs-faq.info,  Node: 5.1.,  Up: 5. Customization - X resources

5.1. Where is a list of X resources?
====================================

   Search through the NEWS file for "X Resources".  A fairly
comprehensive list is given after it.

   In addition, an app-defaults file is supplied, `etc/Emacs.ad',
listing the defaults.  The file `etc/sample.Xdefaults' gives a set of
defaults that you might consider.  It is essentially the same as
`etc/Emacs.ad' but some entries are slightly altered.  Be careful about
installing the contents of this file into your `.Xdefaults'
(.Xresources) file if you use FSF GNU Emacs under X11 as well.


File: xemacs-faq.info,  Node: 6. Changing textual fonts and colors,  Next: 7. The modeline,  Prev: 5. Customization - X resources,  Up: Top

6. Changing textual fonts and colors
************************************

* Menu:

* 6.1.::          6.1. How do I set the text, menu and modeline fonts?
* 6.2.::          6.2. How can I set the background/foreground colors when highlighting a region?
* 6.3.::          6.3. How can I set the most commonly used color options from my `.emacs' instead of from my `.Xdefaults'?


File: xemacs-faq.info,  Node: 6.1.,  Next: 6.2.,  Up: 6. Changing textual fonts and colors

6.1. How do I set the text, menu and modeline fonts?
====================================================

   Note that you should use `Emacs.' and not `Emacs*' when setting face
values.

   In `.Xdefaults':

     Emacs.default.attributeFont:  -*-*-medium-r-*-*-*-120-*-*-m-*-*-*
     Emacs*menubar*font:           fixed
     Emacs.modeline.attributeFont: fixed

   This is confusing because modeline is a face, and can be found listed
with all faces in the current mode by using M-x set-face-font (enter) ?.
It uses the face specification of "attributeFont", while menubar is a
normal X thing that uses the specification "font".  With Motif it may be
necessary to use "fontList" instead of "font".  (Please rewrite this if
you understand this better than me ...  A general description of faces
would be very useful.  I am just saying that menubar is a FAQ because
it's not a face and not listed.)


File: xemacs-faq.info,  Node: 6.2.,  Next: 6.3.,  Prev: 6.1.,  Up: 6. Changing textual fonts and colors

6.2. How can I set the background/foreground colors when highlighting a region?
===============================================================================

   You can change the face `zmacs-region' either in your `.Xdefaults':

     Emacs.zmacs-region.attributeForeground: firebrick
     Emacs.zmacs-region.attributeBackground: lightseagreen

   or in your `.emacs':

     (set-face-background 'zmacs-region "red")
     (set-face-foreground 'zmacs-region "yellow")


File: xemacs-faq.info,  Node: 6.3.,  Prev: 6.2.,  Up: 6. Changing textual fonts and colors

6.3. How can I set the most commonly used color options from my `.emacs' instead of from my `.Xdefaults'?
=========================================================================================================

     (set-face-background 'default "bisque")          ; frame background
     (set-face-foreground 'default "black")           ; normal text
     (set-face-background 'zmacs-region "red")   ; When selecting w/
                                                      ; mouse
     (set-face-foreground 'zmacs-region "yellow")
     (set-face-font  'default "*courier-bold-r*120-100-100*")
     (set-face-background 'highlight "blue")          ; Ie when selecting buffers
     (set-face-foreground 'highlight "yellow")
     (set-face-background 'modeline "blue")           ; Line at bottom of buffer
     (set-face-foreground 'modeline "white")
     (set-face-font  'modeline "*bold-r-normal*140-100-100*")
     (set-face-background 'isearch "yellow")          ; When highlighting while
                                                      ; searching
     (set-face-foreground 'isearch "red")
     (setq x-pointer-foreground-color "black")        ; Adds to bg color,
                                                      ; so keep black
     (setq x-pointer-background-color "blue")         ; This is color you really
                                                    ; want ptr/crsr


File: xemacs-faq.info,  Node: 7. The modeline,  Next: 8. The keyboard,  Prev: 6. Changing textual fonts and colors,  Up: Top

7. The modeline
***************

* Menu:

* 7.1.::          7.1. How can I make the modeline go away?
* 7.2.::          7.2. How do you have XEmacs display the line number in the modeline?
* 7.3.::          7.3. How do I get XEmacs to put the time of day on the modeline?
* 7.4.::          7.4. How can one change the color of the modeline based on the mode used? i.e. red for C mode, green for TeX mode etc.?


File: xemacs-faq.info,  Node: 7.1.,  Next: 7.2.,  Up: 7. The modeline

7.1. How can I make the modeline go away?
=========================================

   (set-specifier has-modeline-p nil)


File: xemacs-faq.info,  Node: 7.2.,  Next: 7.3.,  Prev: 7.1.,  Up: 7. The modeline

7.2. How do you have XEmacs display the line number in the modeline?
====================================================================

   Add the following line to your `.emacs' file:

     (setq line-number-mode t)


File: xemacs-faq.info,  Node: 7.3.,  Next: 7.4.,  Prev: 7.2.,  Up: 7. The modeline

7.3. How do I get XEmacs to put the time of day on the modeline?
================================================================

     (display-time)


File: xemacs-faq.info,  Node: 7.4.,  Prev: 7.3.,  Up: 7. The modeline

7.4. How can one change the color of the modeline based on the mode used? i.e. red for C mode, green for TeX mode etc.?
=======================================================================================================================

   You can use something like the following:

     (add-hook 'lisp-mode-hook
             '(lambda () (set-face-background 'modeline "red" (current-buffer))
                         (set-face-foreground 'modeline "yellow" (current-buffer))))

   Then, when editing a Lisp file (ie went into Lisp mode), the modeline
colors change from the default set in your `.emacs'.  The change will
only be made in the buffer you just entered (which contains the Lisp
file you are editing) and will not affect the modeline colors anywhere
else.

   Notes:

   * The hook is the mode name plus "-hook". Ie c-mode-hook,
     c++-mode-hook, emacs-lisp-mode-hook (ie your `.emacs' or a xx.el
     file), lisp-interaction-mode-hook (the *scratch* buffer),
     text-mode-hook, etc.

   * Be sure to use add-hook, not (setq c-mode-hook xxxx), otherwise
     you will erase anything that anybody has already put on the hook.

   * You can also do (set-face-font 'modeline `font'), eg (set-face-font
     'modeline "*bold-r-normal*140-100-100*" (current-buffer)) if you
     wish the modeline font to vary based on the current mode.


File: xemacs-faq.info,  Node: 8. The keyboard,  Next: 9. The cursor,  Prev: 7. The modeline,  Up: Top

8. The keyboard
***************

* Menu:

* 8.1.::          8.1. What is the difference in key sequences between XEmacs and GNU Emacs?
* 8.2.::          8.2. How can I make XEmacs recognize the Alt key of my HP workstation as a Meta key?
* 8.3.::          8.3. How can I stop the down-arrow-key from adding empty lines at the bottom of my buffers?
* 8.4.::          8.4. I wonder if there is an interactive function that can generate "fake" keyboard events. This way, I could simply map them inside XEmacs.
* 8.5.::          8.5. I am trying to bind C-. to scroll up by one line and C-; to scroll down by one line...
* 8.6.::          8.6. I cannot manage to globally bind my Delete key to something other than the default.  How does one do this?
* 8.7.::          8.7. How can I bind complex functions (or macros) to keys?
* 8.8.::          8.8. Can the cursor keys scroll the screen a line at a time, rather than the default half page jump?  I tend it to find it disorienting.
* 8.9.::          8.9. How to map "Help" key alone on Sun type4 keyboard?
* 8.10.::          8.10. How can you type in special characters in XEmacs?


File: xemacs-faq.info,  Node: 8.1.,  Next: 8.2.,  Up: 8. The keyboard

8.1. What is the difference in in key sequences between XEmacs and GNU Emacs?
=============================================================================

   The real question might be rephrased as "When should one use the
quoted list, vector, or escaped string representations of key
sequences?"  Is there any particular advantage to one representation
over another?

   From Richard Mlynarik <mly@adoc.xerox.com>:

(meta a)
     is a convenience shorthand for the sequence `[(meta a)]'.
     `(global-set-key 'a 'foo)' means the same thing as
     `(global-set-key '[a] 'foo)'.  It could be argued that allowing
     such a shorthand just leads to sloppiness and bugs, but it's
     there, and it isn't likely to go away.

[(meta a)]
     is The Right Thing.  It corresponds in a one-to-one way with the
     internal representation of key-sequences in keymaps.

[Meta-a]
     is typical FSF Emacs 19 brain damage.  As is usual, an existing,
     functional design is ignored (XEmacs) and an incompatible and
     technically worse kludge is used.

"\ea"
     is compatible with Emacs 18, but suffers from ASCII Seven-Bit Brain
     Damage.  I also find it harder to read.  Use this if you're trying
     to write code which works in every Emacs, but be aware that you
     can not express all Possible key-sequences (`control-9', `f1',
     etc.) using this.


File: xemacs-faq.info,  Node: 8.2.,  Next: 8.3.,  Prev: 8.1.,  Up: 8. The keyboard

8.2. How can I make XEmacs recognize the Alt key of my HP workstation as a Meta key?
====================================================================================

   Put the following line into a file and load it with xmodmap(1) before
starting XEmacs:

     remove Mod1 = Mode_switch


File: xemacs-faq.info,  Node: 8.3.,  Next: 8.4.,  Prev: 8.2.,  Up: 8. The keyboard

8.3. How can I stop the down-arrow-key from adding empty lines at the bottom of my buffers?
===========================================================================================

   Add the following line to your `.emacs' file:

     (setq next-line-add-newlines nil)


File: xemacs-faq.info,  Node: 8.4.,  Next: 8.5.,  Prev: 8.3.,  Up: 8. The keyboard

8.4. I wonder if there is an interactive function that can generate "fake" keyboard events. This way, I could simply map them inside XEmacs.
============================================================================================================================================

   This seems to work:
     (defun cg--generate-char-event (ch)
       "Generate an event, as if ch has been typed"
       (dispatch-event (character-to-event ch)))
     
     ;;  Backspace and Delete stuff
     (global-set-key '(backspace)
                     '(lambda () (interactive) (cg--generate-char-event 127)))
     (global-set-key '(unknown_keysym_0x4)
                     '(lambda () (interactive) (cg--generate-char-event 4)))


File: xemacs-faq.info,  Node: 8.5.,  Next: 8.6.,  Prev: 8.4.,  Up: 8. The keyboard

8.5. I am trying to bind C-. to scroll up by one line and C-; to scroll down by one line...
===========================================================================================

   Add the following (Thanks to Richard Mlynarik <mly@adoc.xerox.com>
and Wayne Newberry <wayne@zen.cac.stratus.com>) to `.emacs':

     (defun scroll-up-one-line ()
       (interactive)
       (scroll-up 1))
     
     (defun scroll-down-one-line ()
       (interactive)
       (scroll-down 1))
     
     (global-set-key [(control ?.)]   'scroll-up-one-line)        ; C-.
     (global-set-key [(control ?;)]   'scroll-down-one-line)      ; C-;

   The key point is that you can only bind simple functions to keys;
you can not bind a key to a function that you're also passing arguments
to.  (See <A HREF="#ss8.7">8.7 How can I bind complex functions</A> for
a better answer.)


File: xemacs-faq.info,  Node: 8.6.,  Next: 8.7.,  Prev: 8.5.,  Up: 8. The keyboard

8.6. I cannot manage to globally bind my Delete key to something other than the default.  How does one do this?
===============================================================================================================

     (defun Foo ()
       (interactive)
         (message "You hit DELETE"))
     
     (global-set-key "\C-?" 'Foo)

   However, some modes explicitly bind Delete, so you would need to add
a hook that does `local-set-key' for them.


File: xemacs-faq.info,  Node: 8.7.,  Next: 8.8.,  Prev: 8.6.,  Up: 8. The keyboard

8.7. How can I bind complex functions (or macros) to keys?
==========================================================

   As an example, say you want the PASTE key on a Sun keyboard to
insert the current Primary X selection at point. You can accomplish
this with:

     (define-key global-map 'f18 'x-insert-selection)

   However, this only works if there is a current X selection (the
selection will be highlighted).  The functionality I like is for the
PASTE key to insert the current X selection if there is one, otherwise
insert the contents of the clipboard.  To do this you need to pass
arguments to x-insert-selection.  This is done by wrapping the call in a
'lambda form:

     (define-key global-map 'f18
       (function (lambda () (interactive) (x-insert-selection t nil))))

   This binds the 'f18 key to a "generic" functional object.  The
interactive spec is required because only interactive functions can be
bound to keys.  Also take a look at the doc for "function".

   For the FAQ example you could use:

     (global-set-key [(control ?.)]
     		(function (lambda () (interactive) (scroll-up 1))))
     (global-set-key [(control ?;)]
     	        (function (lambda () (interactive) (scroll-up -1))))

   This is fine if you only need a few functions within the lambda
body.  If you're doing more it's cleaner to define a separate function
as in the original FAQ example (<A HREF="#ss11.3">question 11.3</A>).


File: xemacs-faq.info,  Node: 8.8.,  Next: 8.9.,  Prev: 8.7.,  Up: 8. The keyboard

8.8. Can the cursor keys scroll the screen a line at a time, rather than the default half page jump?  I tend it to find it disorienting.
========================================================================================================================================

   Try this:

     (defun scroll-one-line-up (&optional arg)
       "Scroll the selected window up (forward in the text) one line (or N lines)."
       (interactive "p")
       (scroll-up (or arg 1)))
     
     (defun scroll-one-line-down (&optional arg)
       "Scroll the selected window down (backward in the text) one line (or N)."
       (interactive "p")
       (scroll-down (or arg 1)))
     
     (global-set-key 'up 'scroll-one-line-up)
     (global-set-key 'down  'scroll-one-line-down)

   The following will also work but will affect more than just the
cursor keys (i.e. C-n and C-p):

     (setq scroll-step 1)


File: xemacs-faq.info,  Node: 8.9.,  Next: 8.10.,  Prev: 8.8.,  Up: 8. The keyboard

8.9. How to map "Help" key alone on Sun type4 keyboard?
=======================================================

   The following works in GNU Emacs 19:

     (global-set-key [help] 'help-command)  		;; Help

   The following works in XEmacs 19.13 with the addition of shift:

     (global-set-key [(shift help)] 'help-command)  		;; Help

   But it doesn't work alone.  This is in the file `PROBLEMS' which
should have come with your XEmacs installation:

   *Emacs ignores the help key when running OLWM*.

   OLWM grabs the help key, and retransmits it to the appropriate
client using XSendEvent.  Allowing Emacs to react to synthetic events is
a security hole, so this is turned off by default.  You can enable it by
setting the variable x-allow-sendevents to t.  You can also cause fix
this by telling OLWM to not grab the help key, with the null binding
`OpenWindows.KeyboardCommand.Help:'.


File: xemacs-faq.info,  Node: 8.10.,  Prev: 8.9.,  Up: 8. The keyboard

8.10. How can you type in special characters in XEmacs?
=======================================================

   One way is to use the package `x-compose'.  Then you can use
sequences like `Compose " a' to get d (a-umlaut), etc.


File: xemacs-faq.info,  Node: 9. The cursor,  Next: 10. The mouse; cutting and pasting,  Prev: 8. The keyboard,  Up: Top

9. The cursor
*************

* Menu:

* 9.1.::          9.1. Is there a way to make the bar cursor a little thicker than one-pixel thick since I lose it?
* 9.2.::          9.2. On the same subject - is there a way to get back the old "block" cursor where the cursor covers the character in front of the point?


File: xemacs-faq.info,  Node: 9.1.,  Next: 9.2.,  Up: 9. The cursor

9.1. Is there a way to make the bar cursor a little thicker than one-pixel thick since I lose it?
=================================================================================================

   For a 1 pixel bar cursor, use:

     (setq bar-cursor t)

   For a 2 pixel bar cursor, use:

     (setq bar-cursor 'anything-else)

   You can use a color to make it stand out better:

     Emacs*cursorColor:	Red


File: xemacs-faq.info,  Node: 9.2.,  Prev: 9.1.,  Up: 9. The cursor

9.2. On the same subject - is there a way to get back the old "block" cursor where the cursor covers the character in front of the point?
=========================================================================================================================================

     (setq bar-cursor nil)

