annotate lisp/disp-table.el @ 20341:a63d7b065e0e

(AC_CHECK_FUNCS): Add strftime.
author Paul Eggert <eggert@twinsun.com>
date Mon, 24 Nov 1997 19:50:22 +0000
parents 1d832fd69760
children ae6b11cadfc6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;; disp-table.el --- functions for dealing with char tables.
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
3 ;; Copyright (C) 1987, 1994, 1995 Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
4
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
5 ;; Author: Erik Naggum <erik@naggum.no>
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
6 ;; Based on a previous version by Howard Gayle
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
7 ;; Maintainer: FSF
3012
d4b85bbedee8 Change "i14n" keyword to "i18n".
Jim Blandy <jimb@redhat.com>
parents: 2628
diff changeset
8 ;; Keywords: i18n
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
9
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
11
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
15 ;; any later version.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
16
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
21
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13822
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13822
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13822
diff changeset
25 ;; Boston, MA 02111-1307, USA.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
26
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 696
diff changeset
27 ;;; Code:
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
28
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
29 (put 'display-table 'char-table-extra-slots 6)
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
30
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
31 ;;;###autoload
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
32 (defun make-display-table ()
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
33 "Return a new, empty display table."
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
34 (make-char-table 'display-table nil))
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
35
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
36 (or standard-display-table
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
37 (setq standard-display-table (make-display-table)))
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
38
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
39 ;;; Display-table slot names. The property value says which slot.
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
40
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
41 (put 'truncation 'display-table-slot 0)
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
42 (put 'wrap 'display-table-slot 1)
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
43 (put 'escape 'display-table-slot 2)
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
44 (put 'control 'display-table-slot 3)
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
45 (put 'selective-display 'display-table-slot 4)
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
46 (put 'vertical-border 'display-table-slot 5)
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
47
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
48 ;;;###autoload
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
49 (defun display-table-slot (display-table slot)
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
50 "Return the value of the extra slot in DISPLAY-TABLE named SLOT.
13683
d628bf92f672 (display-table-slot,set-display-table-slot): Document the slot names.
Erik Naggum <erik@naggum.no>
parents: 13199
diff changeset
51 SLOT may be a number from 0 to 5 inclusive, or a slot name (symbol).
d628bf92f672 (display-table-slot,set-display-table-slot): Document the slot names.
Erik Naggum <erik@naggum.no>
parents: 13199
diff changeset
52 Valid symbols are `truncation', `wrap', `escape', `control',
d628bf92f672 (display-table-slot,set-display-table-slot): Document the slot names.
Erik Naggum <erik@naggum.no>
parents: 13199
diff changeset
53 `selective-display', and `vertical-border'."
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
54 (let ((slot-number
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
55 (if (numberp slot) slot
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
56 (or (get slot 'display-table-slot)
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
57 (error "Invalid display-table slot name: %s" slot)))))
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
58 (char-table-extra-slot display-table slot-number)))
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
59
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
60 ;;;###autoload
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
61 (defun set-display-table-slot (display-table slot value)
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
62 "Set the value of the extra slot in DISPLAY-TABLE named SLOT to VALUE.
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
63 SLOT may be a number from 0 to 5 inclusive, or a name (symbol).
13683
d628bf92f672 (display-table-slot,set-display-table-slot): Document the slot names.
Erik Naggum <erik@naggum.no>
parents: 13199
diff changeset
64 Valid symbols are `truncation', `wrap', `escape', `control',
d628bf92f672 (display-table-slot,set-display-table-slot): Document the slot names.
Erik Naggum <erik@naggum.no>
parents: 13199
diff changeset
65 `selective-display', and `vertical-border'."
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
66 (let ((slot-number
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
67 (if (numberp slot) slot
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
68 (or (get slot 'display-table-slot)
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
69 (error "Invalid display-table slot name: %s" slot)))))
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
70 (set-char-table-extra-slot display-table slot-number value)))
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
71
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
72 ;;;###autoload
2072
4a3438b8b92d Add autoload comments.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
73 (defun describe-display-table (dt)
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
74 "Describe the display table DT in a help buffer."
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
75 (with-output-to-temp-buffer "*Help*"
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
76 (princ "\nTruncation glyph: ")
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
77 (prin1 (display-table-slot dt 'truncation))
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
78 (princ "\nWrap glyph: ")
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
79 (prin1 (display-table-slot dt 'wrap))
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
80 (princ "\nEscape glyph: ")
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
81 (prin1 (display-table-slot dt 'escape))
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
82 (princ "\nCtrl glyph: ")
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
83 (prin1 (display-table-slot dt 'control))
2628
6b17fe69a82f * disp-table.el (describe-display-table): Don't use the term
Jim Blandy <jimb@redhat.com>
parents: 2523
diff changeset
84 (princ "\nSelective display glyph sequence: ")
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
85 (prin1 (display-table-slot dt 'selective-display))
8920
45e6d5476e7f * disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents: 7830
diff changeset
86 (princ "\nVertical window border glyph: ")
13199
9424e02a6e18 (display-table-slot, set-display-table-slot):
Richard M. Stallman <rms@gnu.org>
parents: 13164
diff changeset
87 (prin1 (display-table-slot dt 'vertical-border))
2628
6b17fe69a82f * disp-table.el (describe-display-table): Don't use the term
Jim Blandy <jimb@redhat.com>
parents: 2523
diff changeset
88 (princ "\nCharacter display glyph sequences:\n")
4936
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
89 (save-excursion
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
90 (set-buffer standard-output)
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
91 (let ((vector (make-vector 256 nil))
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
92 (i 0))
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
93 (while (< i 256)
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
94 (aset vector i (aref dt i))
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
95 (setq i (1+ i)))
9856
fdd2f06a7d11 (describe-display-table): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents: 8920
diff changeset
96 (describe-vector vector))
fdd2f06a7d11 (describe-display-table): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents: 8920
diff changeset
97 (help-mode))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
98 (print-help-return-message)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
99
2072
4a3438b8b92d Add autoload comments.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
100 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
101 (defun describe-current-display-table ()
4936
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
102 "Describe the display table in use in the selected window and buffer."
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
103 (interactive)
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
104 (let ((disptab (or (window-display-table (selected-window))
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
105 buffer-display-table
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
106 standard-display-table)))
4936
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
107 (if disptab
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
108 (describe-display-table disptab)
35e9402cb6bf (describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents: 3061
diff changeset
109 (message "No display table"))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
110
2072
4a3438b8b92d Add autoload comments.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
111 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
112 (defun standard-display-8bit (l h)
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
113 "Display characters in the range L to H literally."
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
114 (while (<= l h)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
115 (if (and (>= l ?\ ) (< l 127))
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
116 (aset standard-display-table l nil)
2628
6b17fe69a82f * disp-table.el (describe-display-table): Don't use the term
Jim Blandy <jimb@redhat.com>
parents: 2523
diff changeset
117 (aset standard-display-table l (vector l)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
118 (setq l (1+ l))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
119
2072
4a3438b8b92d Add autoload comments.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
120 ;;;###autoload
3033
8bf84289be17 * disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents: 3012
diff changeset
121 (defun standard-display-default (l h)
8bf84289be17 * disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents: 3012
diff changeset
122 "Display characters in the range L to H using the default notation."
8bf84289be17 * disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents: 3012
diff changeset
123 (while (<= l h)
8bf84289be17 * disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents: 3012
diff changeset
124 (if (and (>= l ?\ ) (< l 127))
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
125 (aset standard-display-table l nil)
3033
8bf84289be17 * disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents: 3012
diff changeset
126 (aset standard-display-table l nil))
8bf84289be17 * disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents: 3012
diff changeset
127 (setq l (1+ l))))
8bf84289be17 * disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents: 3012
diff changeset
128
10435
0f07f211973a (standard-display-ascii): Doc fix. Allow use with X.
Karl Heuer <kwzh@gnu.org>
parents: 9856
diff changeset
129 ;; This function does NOT take terminal-dependent escape sequences.
0f07f211973a (standard-display-ascii): Doc fix. Allow use with X.
Karl Heuer <kwzh@gnu.org>
parents: 9856
diff changeset
130 ;; For that, you need to go through create-glyph. Use one of the
0f07f211973a (standard-display-ascii): Doc fix. Allow use with X.
Karl Heuer <kwzh@gnu.org>
parents: 9856
diff changeset
131 ;; other functions below, or roll your own.
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
132 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
133 (defun standard-display-ascii (c s)
10435
0f07f211973a (standard-display-ascii): Doc fix. Allow use with X.
Karl Heuer <kwzh@gnu.org>
parents: 9856
diff changeset
134 "Display character C using printable string S."
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
135 (aset standard-display-table c (vconcat s)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
136
2072
4a3438b8b92d Add autoload comments.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
137 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
138 (defun standard-display-g1 (c sc)
6418
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
139 "Display character C as character SC in the g1 character set.
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
140 This function assumes that your terminal uses the SO/SI characters;
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
141 it is meaningless for an X frame."
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
142 (if window-system
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
143 (error "Cannot use string glyphs in a windowing system"))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
144 (aset standard-display-table c
2523
76685b00c607 Use `vector', not `make-rope'.
Richard M. Stallman <rms@gnu.org>
parents: 2072
diff changeset
145 (vector (create-glyph (concat "\016" (char-to-string sc) "\017")))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
146
2072
4a3438b8b92d Add autoload comments.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
147 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
148 (defun standard-display-graphic (c gc)
6418
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
149 "Display character C as character GC in graphics character set.
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
150 This function assumes VT100-compatible escapes; it is meaningless for an
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
151 X frame."
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
152 (if window-system
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
153 (error "Cannot use string glyphs in a windowing system"))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
154 (aset standard-display-table c
2523
76685b00c607 Use `vector', not `make-rope'.
Richard M. Stallman <rms@gnu.org>
parents: 2072
diff changeset
155 (vector (create-glyph (concat "\e(0" (char-to-string gc) "\e(B")))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
156
2072
4a3438b8b92d Add autoload comments.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
157 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
158 (defun standard-display-underline (c uc)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
159 "Display character C as character UC plus underlining."
6418
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
160 (if window-system (require 'faces))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
161 (aset standard-display-table c
6418
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
162 (vector
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
163 (if window-system
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
164 (logior uc (lsh (face-id (internal-find-face 'underline)) 8))
43dea22be493 (standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents: 6417
diff changeset
165 (create-glyph (concat "\e[4m" (char-to-string uc) "\e[m"))))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
166
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
167 ;; Allocate a glyph code to display by sending STRING to the terminal.
2072
4a3438b8b92d Add autoload comments.
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
168 ;;;###autoload
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
169 (defun create-glyph (string)
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
170 (if (= (length glyph-table) 65536)
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
171 (error "No free glyph codes remain"))
6417
81e96cd91613 (create-glyph): Don't use slots that look like ASCII.
Karl Heuer <kwzh@gnu.org>
parents: 4936
diff changeset
172 ;; Don't use slots that correspond to ASCII characters.
81e96cd91613 (create-glyph): Don't use slots that look like ASCII.
Karl Heuer <kwzh@gnu.org>
parents: 4936
diff changeset
173 (if (= (length glyph-table) 32)
81e96cd91613 (create-glyph): Don't use slots that look like ASCII.
Karl Heuer <kwzh@gnu.org>
parents: 4936
diff changeset
174 (setq glyph-table (vconcat glyph-table (make-vector 224 nil))))
696
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
175 (setq glyph-table (vconcat glyph-table (list string)))
904853a03d9a *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
176 (1- (length glyph-table)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
177
3061
1e0f5fb4fcf1 * disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents: 3033
diff changeset
178 ;;;###autoload
19066
f51eb6bca2dd (standard-display-european): New arg AUTO.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
179 (defun standard-display-european (arg &optional auto)
3061
1e0f5fb4fcf1 * disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents: 3033
diff changeset
180 "Toggle display of European characters encoded with ISO 8859.
1e0f5fb4fcf1 * disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents: 3033
diff changeset
181 When enabled, characters in the range of 160 to 255 display not
19850
6bd245888f10 (standard-display-european): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19845
diff changeset
182 as octal escapes, but as accented characters. Codes 146 and 160
6bd245888f10 (standard-display-european): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19845
diff changeset
183 display as apostrophe and space, even though they are not the ASCII
6bd245888f10 (standard-display-european): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19845
diff changeset
184 codes for apostrophe and space.
6bd245888f10 (standard-display-european): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19845
diff changeset
185
19066
f51eb6bca2dd (standard-display-european): New arg AUTO.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
186 With prefix argument, enable European character display iff arg is positive.
f51eb6bca2dd (standard-display-european): New arg AUTO.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
187
19618
6ce60af61e81 (standard-display-european): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19066
diff changeset
188 Normally, this function turns off `enable-multibyte-characters'
6ce60af61e81 (standard-display-european): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19066
diff changeset
189 for all Emacs buffers, because users who call this function
6ce60af61e81 (standard-display-european): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19066
diff changeset
190 probably want to edit European characters in single-byte mode.
6ce60af61e81 (standard-display-european): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19066
diff changeset
191
6ce60af61e81 (standard-display-european): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 19066
diff changeset
192 However, if the optional argument AUTO is non-nil, this function
19814
24d0221b94bc (standard-display-european): Arg AUTO
Richard M. Stallman <rms@gnu.org>
parents: 19679
diff changeset
193 does not alter `enable-multibyte-characters'.
24d0221b94bc (standard-display-european): Arg AUTO
Richard M. Stallman <rms@gnu.org>
parents: 19679
diff changeset
194 AUTO also specifies, in this case, the coding system for terminal output."
3033
8bf84289be17 * disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents: 3012
diff changeset
195 (interactive "P")
7830
1f9ae5be19a2 (standard-display-european): Treat 0 arg like negative.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
196 (if (or (<= (prefix-numeric-value arg) 0)
3061
1e0f5fb4fcf1 * disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents: 3033
diff changeset
197 (and (null arg)
13164
79eba40cdf02 New implementation with char-tables.
Erik Naggum <erik@naggum.no>
parents: 10435
diff changeset
198 (char-table-p standard-display-table)
13822
cbc1f90ea367 (standard-display-european): Make 160 display as space.
Richard M. Stallman <rms@gnu.org>
parents: 13794
diff changeset
199 ;; Test 161, because 160 displays as a space.
13794
47cdd806fcfc (standard-display-european): Test code 161, not 160.
Karl Heuer <kwzh@gnu.org>
parents: 13683
diff changeset
200 (equal (aref standard-display-table 161) [161])))
19814
24d0221b94bc (standard-display-european): Arg AUTO
Richard M. Stallman <rms@gnu.org>
parents: 19679
diff changeset
201 (progn
24d0221b94bc (standard-display-european): Arg AUTO
Richard M. Stallman <rms@gnu.org>
parents: 19679
diff changeset
202 (standard-display-default 160 255)
24d0221b94bc (standard-display-european): Arg AUTO
Richard M. Stallman <rms@gnu.org>
parents: 19679
diff changeset
203 (unless (eq window-system 'x)
24d0221b94bc (standard-display-european): Arg AUTO
Richard M. Stallman <rms@gnu.org>
parents: 19679
diff changeset
204 (set-terminal-coding-system nil)))
19066
f51eb6bca2dd (standard-display-european): New arg AUTO.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
205 ;; If the user does this explicitly,
f51eb6bca2dd (standard-display-european): New arg AUTO.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
206 ;; turn off multibyte chars for more compatibility.
f51eb6bca2dd (standard-display-european): New arg AUTO.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
207 (or auto
f51eb6bca2dd (standard-display-european): New arg AUTO.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
208 (setq-default enable-multibyte-characters nil))
13822
cbc1f90ea367 (standard-display-european): Make 160 display as space.
Richard M. Stallman <rms@gnu.org>
parents: 13794
diff changeset
209 (standard-display-8bit 160 255)
19845
f03431d49548 (standard-display-european): If AUTO is non-nil, intern it.
Richard M. Stallman <rms@gnu.org>
parents: 19814
diff changeset
210 (unless (or noninteractive (eq window-system 'x))
19814
24d0221b94bc (standard-display-european): Arg AUTO
Richard M. Stallman <rms@gnu.org>
parents: 19679
diff changeset
211 ;; Send those codes literally to a non-X terminal.
24d0221b94bc (standard-display-european): Arg AUTO
Richard M. Stallman <rms@gnu.org>
parents: 19679
diff changeset
212 ;; If AUTO is nil, we are using single-byte characters,
24d0221b94bc (standard-display-european): Arg AUTO
Richard M. Stallman <rms@gnu.org>
parents: 19679
diff changeset
213 ;; so it doesn't matter which one we use.
19920
1d832fd69760 (standard-display-european): Do something useful where AUTO is t or a symbol.
Richard M. Stallman <rms@gnu.org>
parents: 19850
diff changeset
214 (set-terminal-coding-system
1d832fd69760 (standard-display-european): Do something useful where AUTO is t or a symbol.
Richard M. Stallman <rms@gnu.org>
parents: 19850
diff changeset
215 (cond ((eq auto t) 'latin-1)
1d832fd69760 (standard-display-european): Do something useful where AUTO is t or a symbol.
Richard M. Stallman <rms@gnu.org>
parents: 19850
diff changeset
216 ((symbolp auto) (or auto 'latin-1))
1d832fd69760 (standard-display-european): Do something useful where AUTO is t or a symbol.
Richard M. Stallman <rms@gnu.org>
parents: 19850
diff changeset
217 ((stringp auto) (intern auto)))))
13822
cbc1f90ea367 (standard-display-european): Make 160 display as space.
Richard M. Stallman <rms@gnu.org>
parents: 13794
diff changeset
218 ;; Make non-line-break space display as a plain space.
cbc1f90ea367 (standard-display-european): Make 160 display as space.
Richard M. Stallman <rms@gnu.org>
parents: 13794
diff changeset
219 ;; Most X fonts do the wrong thing for code 160.
19679
77c1c650932b (standard-display-european): Map \222 to apostrophe.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19618
diff changeset
220 (aset standard-display-table 160 [32])
77c1c650932b (standard-display-european): Map \222 to apostrophe.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19618
diff changeset
221 ;; Most Windows programs send out apostrophe's as \222. Most X fonts
77c1c650932b (standard-display-european): Map \222 to apostrophe.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19618
diff changeset
222 ;; don't contain a character at that position. Map it to the ASCII
77c1c650932b (standard-display-european): Map \222 to apostrophe.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19618
diff changeset
223 ;; apostrophe.
77c1c650932b (standard-display-european): Map \222 to apostrophe.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19618
diff changeset
224 (aset standard-display-table 146 [39])
77c1c650932b (standard-display-european): Map \222 to apostrophe.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19618
diff changeset
225 ))
3033
8bf84289be17 * disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents: 3012
diff changeset
226
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
227 (provide 'disp-table)
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
228
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
229 ;;; disp-table.el ends here