A display table is a special-purpose char-table (see Char-Tables), with display-table
as its subtype, which is used to override the usual character display conventions. This section describes how to make, inspect, and assign elements to a display table object.
This creates and returns a display table. The table initially has nil
in all elements.
The ordinary elements of the display table are indexed by character codes; the element at index c says how to display the character code c. The value should be nil
(which means to display the character c according to the usual display conventions; see Usual Display), or a vector of glyph codes (which means to display the character c as those glyphs; see Glyphs).
Warning: if you use the display table to change the display of newline characters, the whole buffer will be displayed as one long line.
The display table also has six extra slots which serve special purposes. Here is a table of their meanings; nil
in any slot means to use the default for that slot, as stated below.
The glyph for the end of a truncated screen line (the default for this is ‘$’). See Glyphs. On graphical terminals, Emacs by default uses arrows in the fringes to indicate truncation, so the display table has no effect, unless you disable the fringes (see Window Fringes in the GNU Emacs Manual).
The glyph for the end of a continued line (the default is ‘\’). On graphical terminals, Emacs by default uses curved arrows in the fringes to indicate continuation, so the display table has no effect, unless you disable the fringes.
The glyph for indicating a character displayed as an octal character code (the default is ‘\’).
The glyph for indicating a control character (the default is ‘^’).
A vector of glyphs for indicating the presence of invisible lines (the default is ‘...’). See Selective Display.
The glyph used to draw the border between side-by-side windows (the default is ‘|’). See Splitting Windows. This currently has effect only on text terminals; on graphical terminals, if vertical scroll bars are supported and in use, a scroll bar separates the two windows, and if there are no vertical scroll bars and no dividers (see Window Dividers), Emacs uses a thin line to indicate the border.
For example, here is how to construct a display table that mimics the effect of setting ctl-arrow
to a non-nil
value (see Glyphs, for the function make-glyph-code
):
(setq disptab (make-display-table)) (dotimes (i 32) (or (= i ?\t) (= i ?\n) (aset disptab i (vector (make-glyph-code ?^ 'escape-glyph) (make-glyph-code (+ i 64) 'escape-glyph))))) (aset disptab 127 (vector (make-glyph-code ?^ 'escape-glyph) (make-glyph-code ?? 'escape-glyph)))))
This function returns the value of the extra slot slot of display-table. The argument slot may be a number from 0 to 5 inclusive, or a slot name (symbol). Valid symbols are truncation
, wrap
, escape
, control
, selective-display
, and vertical-border
.
This function stores value in the extra slot slot of display-table. The argument slot may be a number from 0 to 5 inclusive, or a slot name (symbol). Valid symbols are truncation
, wrap
, escape
, control
, selective-display
, and vertical-border
.
This function displays a description of the display table display-table in a help buffer.
This command displays a description of the current display table in a help buffer.
Copyright © 1990-1996, 1998-2019 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
https://www.gnu.org/software/emacs/manual/html_node/elisp/Display-Tables.html