4 Display Functions

This is part 4 of the XEmacs Frequently Asked Questions list. This
section is devoted to the display-related capabilities of XEmacs
(fonts, colors, modeline, menubar, toolbar, scrollbar, etc.) and how
to customize them.

This is confusing because `default' and `modeline' are face
names, and can be found listed with all faces in the current mode by
using M-x set-face-font (enter) ?. They use the face-specific
resource `attributeFont'.

On the other hand, `menubar' is a normal X thing that uses the
resource `font'. With Motif it may be necessary to use
`fontList' instead of `font'. In non-Motif
configurations with Mule it is necessary to use `fontSet'
instead of `font'. (Sorry, there just is no simple recipe here.)

Q4.0.5: How can I limit color map usage?

I'm using Netscape (or another color grabber like XEmacs);
is there any way to limit the number of available colors in the color map?

Answer: No, but you can start Netscape before XEmacs, and it will use
the closest available color if the colormap is full. You can also limit
the number of colors Netscape uses, using the flags -mono, -ncols <#> or
-install (for mono, limiting to <#> colors, or for using a private color
map).

If you have the money, another solution would be to use a truecolor or
direct color video.

Q4.0.8: How do I display non-ASCII characters?

If you're using a Mule-enabled XEmacs, then display is automatic. If
you're not seeing the characters you expect, either (1) you don't have
appropriate fonts available or (2) XEmacs did not correctly detect the
coding system (@xref{Recognize Coding, , , xemacs}). In case (1),
install fonts as is customary for your platform. In case (2), you
need to tell XEmacs explicitly what coding systems you're using.
@xref{Specify Coding, , , xemacs}.

If your XEmacs is not Mule-enabled, and for some reason getting a
Mule-enabled XEmacs seems like the wrong thing to do, all is not lost.
You can arrange it by brute force. In `event-Xt.c' (suppress the
urge to look in this file--play Doom instead, because you'll survive
longer), it is written:

In a non-Mule world, a user can still have a multi-lingual editor, by
doing (set-face-font "-*-iso8859-2" (current-buffer)) for all
their Latin-2 buffers, etc.

4.1: Syntax Highlighting (Font Lock)

Q4.1.1: How can I do source code highlighting using font-lock?

For most modes, font-lock is already set up and just needs to be turned
on. This can be done by adding the line:

(require 'font-lock)

to your `init.el'. (You can turn it on for the
current buffer and session only by M-x font-lock-mode.) See the
file `etc/sample.init.el' (`etc/sample.emacs' in XEmacs
versions prior to 21.4) for more information.

See also Syntax Highlighting from the Options menu.
Remember to save options.

Q4.2.4: How can I change the modeline color based on the mode used?

Then, when editing a Lisp file (i.e. when in Lisp mode), the modeline
colors change from the default set in your `init.el'.
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. eg. c-mode-hook,
c++-mode-hook, emacs-lisp-mode-hook (used for your
`init.el' 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.

There are additional modeline faces, modeline-buffer-id,
modeline-mousable, and modeline-mousable-minor-mode, which
you may want to customize.

Q4.4.5: Resources like Emacs*menubar*font are not working?

I am trying to use a resource like Emacs*menubar*font to set the
font of the menubar but it's not working.

In Motif, the use of `font' resources is obsoleted in order to
support internationalization. If you are using the real Motif menubar,
this resource is not recognized at all; you have to say:

Emacs*menubar*fontList: FONT

If you are using the Lucid menubar, for backward compatibility with
existing user configurations, the `font' resource is recognized.
Since this is not supported by Motif itself, the code is a kludge and
the `font' resource will be recognized only if the `fontList'
resource resource is unset. This means that the resource

*fontList: FONT

will override

Emacs*menubar*font: FONT

even though the latter is more specific.

In non-Motif configurations using `--with-mule' and
`--with-xfs' it is necessary to use the fontSet
resource instead of the font resource. The backward
compatibility kludge was never implemented for non-Motif builds.
Example:

Q4.6.4: Moving the scrollbar can move the point; can I disable this?

When I move the scrollbar in an XEmacs window, it moves the point as
well, which should not be the default behavior. Is this a bug or a
feature? Can I disable it?

The current behavior is a feature, not a bug. Point remains at the same
buffer position as long as that position does not scroll off the screen.
In that event, point will end up in either the upper-left or lower-left
hand corner.

Q4.6.7: I find auto-show-mode disconcerting. How do I turn it off?

auto-show-mode controls whether or not a horizontal scrollbar
magically appears when a line is too long to be displayed. This is
enabled by default. To turn it off, put the following in your
`init.el':