Go to the first, previous, next, last section, table of contents.

Display Tables

You can use the display table feature to control how all 256 possible character codes display on the screen. This is useful for displaying European languages that have letters not in the ASCII character set.

The display table maps each character code into a sequence of glyphs, each glyph being an image that takes up one character position on the screen. You can also define how to display each glyph on your terminal, using the glyph table.

Display Tables Proper

Use make-display-table to create a display table. The table initially has nil in all elements.

A display table is actually an array of 261 elements. The first 256 elements of a display table control how to display each possible text character. The value should be nil or a vector (which is a sequence of glyphs; see below). nil as an element means to display that character following the usual display conventions.

The remaining five elements of a display table serve special purposes (nil means use the default stated below):

256
The glyph for the end of a truncated screen line (the default for this is `\').
257
The glyph for the end of a continued line (the default is `$').
258
The glyph for the indicating an octal character code (the default is `\').
259
The glyph for indicating a control characters (the default is `^').
260
The vector of glyphs for indicating the presence of invisible lines (the default is `...').

Each buffer typically has its own display table. The display table for the current buffer is stored in buffer-display-table. (This variable automatically becomes local if you set it.) If this variable is nil, the value of standard-display-table is used in that buffer.

Each window can have its own display table, which overrides the display table of the buffer it is showing.

If neither the selected window nor the current buffer has a display table, and if standard-display-table is nil, then Emacs uses the usual display conventions:

The usual display conventions are also used for any character whose entry in the active display table is nil. This means that when you set up a display table, you need not specify explicitly what to do with each character, only the characters for which you want unusual behavior.

Glyphs

A glyph stands for an image that takes up a single character position on the screen. A glyph is represented in Lisp as an integer.

The meaning of each integer, as a glyph, is defined by the glyph table, which is the value of the variable glyph-table. It should be a vector; the gth element defines glyph code g. The possible definitions of a glyph code are:

integer
Define this glyph code as an alias for code integer. This is used with X Windows to specify a face code.
string
Send the characters in string to the terminal to output this glyph. This alternative is available only for character terminals, not with X.
nil
This glyph is simple. On an ordinary terminal, the glyph code mod 256 is the character to output. With X, the glyph code mod 256 is character to output, and the glyph code divided by 256 specifies the face code to use while outputting it.

Any glyph code beyond the length of the glyph table is automatically simple.

If glyph-table is nil, then all possible glyph codes are simple.

A face is a named combination of a font and a pair of colors (foreground and background). A glyph code can specify a face id number to use for displaying that glyph.

ISO Latin 1

If you have a terminal that can handle the entire ISO Latin 1 character set, you can arrange to use that character set as follows:

(require 'disp-table)
(standard-display-8bit 0 255)

If you are editing buffers written in the ISO Latin 1 character set and your terminal doesn't handle anything but ASCII, you can load the file iso-ascii to set up a display table which makes the other ISO characters display as sequences of ASCII characters. For example, the character "o with umlaut" displays as `{"o}'.

Some European countries have terminals that don't support ISO Latin 1 but do support the special characters for that country's language. You can define a display table to work one language using such terminals. For an example, see `lisp/iso-swed.el', which handles certain Swedish terminals.

You can load the appropriate display table for your terminal automatically by writing a terminal-specific Lisp file for the terminal type.


Go to the first, previous, next, last section, table of contents.