0
|
1 ;;; disp-table.el --- functions for dealing with char tables.
|
|
2
|
|
3 ;; Copyright (C) 1987, 1994 Free Software Foundation, Inc.
|
|
4 ;; Copyright (C) 1995 Sun Microsystems.
|
|
5
|
|
6 ;; Author: Howard Gayle
|
|
7 ;; Maintainer: FSF
|
|
8 ;; Keywords: i18n
|
|
9
|
|
10 ;; This file is part of XEmacs.
|
|
11
|
|
12 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
13 ;; under the terms of the GNU General Public License as published by
|
|
14 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
15 ;; any later version.
|
|
16
|
|
17 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20 ;; General Public License for more details.
|
|
21
|
|
22 ;; You should have received a copy of the GNU General Public License
|
16
|
23 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
25 ;; Boston, MA 02111-1307, USA.
|
0
|
26
|
|
27 ;;; Synched up with: Not synched with FSF.
|
|
28
|
|
29 ;;; #### Need lots of work. make-display-table depends on a value
|
|
30 ;;; that is a define in the C code. Maybe we should just move the
|
|
31 ;;; function into C.
|
|
32
|
|
33 ;;; #### display-tables-as-vectors is really evil and a big pain in
|
|
34 ;;; the ass.
|
|
35
|
|
36 ;;; Rewritten for XEmacs July 1995, Ben Wing.
|
|
37
|
|
38 ;;; Code:
|
|
39
|
|
40 (defun describe-display-table (dt)
|
|
41 "Describe the display table DT in a help buffer."
|
|
42 (with-displaying-help-buffer
|
2
|
43 (lambda ()
|
|
44 (princ "\nCharacter display glyph sequences:\n")
|
|
45 (save-excursion
|
|
46 (set-buffer standard-output)
|
|
47 (let ((vector (make-vector 256 nil))
|
|
48 (i 0))
|
|
49 (while (< i 256)
|
|
50 (aset vector i (aref dt i))
|
|
51 (setq i (1+ i)))
|
|
52 ;;; ### No such function `describe-vector'...
|
|
53 (describe-vector vector))))))
|
0
|
54
|
|
55 ;;;###autoload
|
|
56 (defun describe-current-display-table (&optional domain)
|
|
57 "Describe the display table in use in the selected window and buffer."
|
|
58 (interactive)
|
|
59 (or domain (setq domain (selected-window)))
|
|
60 (let ((disptab (specifier-instance current-display-table domain)))
|
|
61 (if disptab
|
|
62 (describe-display-table disptab)
|
|
63 (message "No display table"))))
|
|
64
|
|
65 ;;;###autoload
|
|
66 (defun make-display-table ()
|
|
67 "Return a new, empty display table."
|
|
68 (make-vector 256 nil))
|
|
69
|
|
70 ;; #### we need a generic frob-specifier function.
|
|
71 ;; #### this also needs to be redone like frob-face-property.
|
|
72
|
|
73 ;; Let me say one more time how much dynamic scoping sucks.
|
|
74
|
|
75 (defun frob-display-table (fdt-function fdt-locale)
|
|
76 (or fdt-locale (setq fdt-locale 'global))
|
|
77 (or (specifier-spec-list current-display-table fdt-locale)
|
|
78 (add-spec-to-specifier current-display-table (make-display-table)
|
|
79 fdt-locale))
|
|
80 (add-spec-list-to-specifier
|
|
81 current-display-table
|
|
82 (list (cons fdt-locale
|
|
83 (mapcar
|
2
|
84 (lambda (fdt-x)
|
|
85 (funcall fdt-function (cdr fdt-x))
|
|
86 fdt-x)
|
0
|
87 (cdar (specifier-spec-list current-display-table
|
|
88 fdt-locale)))))))
|
|
89
|
|
90 (defun standard-display-8bit-1 (dt l h)
|
|
91 (while (<= l h)
|
|
92 (aset dt l (char-to-string l))
|
|
93 (setq l (1+ l))))
|
|
94
|
|
95 ;;;###autoload
|
|
96 (defun standard-display-8bit (l h &optional locale)
|
|
97 "Display characters in the range L to H literally."
|
|
98 (frob-display-table
|
2
|
99 (lambda (x)
|
|
100 (standard-display-8bit-1 x l h))
|
0
|
101 locale))
|
|
102
|
|
103 (defun standard-display-default-1 (dt l h)
|
|
104 (while (<= l h)
|
|
105 (aset dt l nil)
|
|
106 (setq l (1+ l))))
|
|
107
|
|
108 ;;;###autoload
|
|
109 (defun standard-display-default (l h &optional locale)
|
|
110 "Display characters in the range L to H using the default notation."
|
|
111 (frob-display-table
|
2
|
112 (lambda (x)
|
|
113 (standard-display-default-1 x l h))
|
0
|
114 locale))
|
|
115
|
|
116 ;;;###autoload
|
|
117 (defun standard-display-ascii (c s &optional locale)
|
|
118 "Display character C using printable string S."
|
|
119 (frob-display-table
|
2
|
120 (lambda (x)
|
|
121 (aset x c s))
|
0
|
122 locale))
|
|
123
|
|
124
|
|
125 ;;; #### should frob in a 'tty locale.
|
|
126
|
|
127 ;;;###autoload
|
|
128 (defun standard-display-g1 (c sc &optional locale)
|
|
129 "Display character C as character SC in the g1 character set.
|
|
130 This function assumes that your terminal uses the SO/SI characters;
|
|
131 it is meaningless for an X frame."
|
|
132 (frob-display-table
|
2
|
133 (lambda (x)
|
|
134 (aset x c (concat "\016" (char-to-string sc) "\017")))
|
0
|
135 locale))
|
|
136
|
|
137
|
|
138 ;;; #### should frob in a 'tty locale.
|
|
139
|
|
140 ;;;###autoload
|
|
141 (defun standard-display-graphic (c gc &optional locale)
|
|
142 "Display character C as character GC in graphics character set.
|
|
143 This function assumes VT100-compatible escapes; it is meaningless for an
|
|
144 X frame."
|
|
145 (frob-display-table
|
2
|
146 (lambda (x)
|
|
147 (aset x c (concat "\e(0" (char-to-string gc) "\e(B")))
|
0
|
148 locale))
|
|
149
|
|
150 ;;; #### should frob in a 'tty locale.
|
|
151 ;;; #### the FSF equivalent of this makes this character be displayed
|
|
152 ;;; in the 'underline face. There's no current way to do this with
|
|
153 ;;; XEmacs display tables.
|
|
154
|
|
155 ;;;###autoload
|
|
156 (defun standard-display-underline (c uc &optional locale)
|
|
157 "Display character C as character UC plus underlining."
|
|
158 (frob-display-table
|
2
|
159 (lambda (x)
|
|
160 (aset x c (concat "\e[4m" (char-to-string uc) "\e[m")))
|
0
|
161 locale))
|
|
162
|
|
163 ;;;###autoload
|
|
164 (defun standard-display-european (arg &optional locale)
|
|
165 "Toggle display of European characters encoded with ISO 8859.
|
|
166 When enabled, characters in the range of 160 to 255 display not
|
|
167 as octal escapes, but as accented characters.
|
|
168 With prefix argument, enable European character display iff arg is positive."
|
|
169 (interactive "P")
|
|
170 (frob-display-table
|
2
|
171 (lambda (x)
|
|
172 (if (or (<= (prefix-numeric-value arg) 0)
|
|
173 (and (null arg)
|
|
174 (equal (aref x 160) (char-to-string 160))))
|
|
175 (standard-display-default-1 x 160 255)
|
|
176 (standard-display-8bit-1 x 160 255)))
|
0
|
177 locale))
|
|
178
|
|
179 (provide 'disp-table)
|
|
180
|
|
181 ;;; disp-table.el ends here
|