Mercurial > emacs
annotate lisp/disp-table.el @ 11800:a2f009e1b85b
(init_system_name): Clean up signedness mismatch.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 12 May 1995 06:52:50 +0000 |
parents | 0f07f211973a |
children | 79eba40cdf02 |
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 |
7300 | 3 ;; Copyright (C) 1987, 1994 Free Software Foundation, Inc. |
845 | 4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
5 ;; Author: Howard Gayle |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
6 ;; Maintainer: FSF |
3012
d4b85bbedee8
Change "i14n" keyword to "i18n".
Jim Blandy <jimb@redhat.com>
parents:
2628
diff
changeset
|
7 ;; Keywords: i18n |
36 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; 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
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
36 | 14 ;; any later version. |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
696
diff
changeset
|
25 ;;; Code: |
36 | 26 |
8920
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
27 (defconst display-table-len 262 |
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
28 "The proper length of a display table.") |
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
29 |
2072 | 30 (defun describe-display-table (dt) |
584 | 31 "Describe the display table DT in a help buffer." |
36 | 32 (with-output-to-temp-buffer "*Help*" |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
33 (princ "\nTruncation glyph: ") |
36 | 34 (prin1 (aref dt 256)) |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
35 (princ "\nWrap glyph: ") |
36 | 36 (prin1 (aref dt 257)) |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
37 (princ "\nEscape glyph: ") |
36 | 38 (prin1 (aref dt 258)) |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
39 (princ "\nCtrl glyph: ") |
36 | 40 (prin1 (aref dt 259)) |
2628
6b17fe69a82f
* disp-table.el (describe-display-table): Don't use the term
Jim Blandy <jimb@redhat.com>
parents:
2523
diff
changeset
|
41 (princ "\nSelective display glyph sequence: ") |
2072 | 42 (prin1 (aref dt 260)) |
8920
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
43 (princ "\nVertical window border glyph: ") |
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
44 (prin1 (aref dt 261)) |
2628
6b17fe69a82f
* disp-table.el (describe-display-table): Don't use the term
Jim Blandy <jimb@redhat.com>
parents:
2523
diff
changeset
|
45 (princ "\nCharacter display glyph sequences:\n") |
4936
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
46 (save-excursion |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
47 (set-buffer standard-output) |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
48 (let ((vector (make-vector 256 nil)) |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
49 (i 0)) |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
50 (while (< i 256) |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
51 (aset vector i (aref dt i)) |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
52 (setq i (1+ i))) |
9856
fdd2f06a7d11
(describe-display-table): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents:
8920
diff
changeset
|
53 (describe-vector vector)) |
fdd2f06a7d11
(describe-display-table): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents:
8920
diff
changeset
|
54 (help-mode)) |
36 | 55 (print-help-return-message))) |
56 | |
2072 | 57 ;;;###autoload |
36 | 58 (defun describe-current-display-table () |
4936
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
59 "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
|
60 (interactive) |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
61 (let ((disptab |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
62 (or (window-display-table (selected-window)) |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
63 buffer-display-table |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
64 standard-display-table))) |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
65 (if disptab |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
66 (describe-display-table disptab) |
35e9402cb6bf
(describe-current-display-table):
Richard M. Stallman <rms@gnu.org>
parents:
3061
diff
changeset
|
67 (message "No display table")))) |
36 | 68 |
2072 | 69 ;;;###autoload |
36 | 70 (defun make-display-table () |
2072 | 71 "Return a new, empty display table." |
8920
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
72 (make-vector display-table-len nil)) |
36 | 73 |
2072 | 74 ;;;###autoload |
36 | 75 (defun standard-display-8bit (l h) |
584 | 76 "Display characters in the range L to H literally." |
36 | 77 (while (<= l h) |
78 (if (and (>= l ?\ ) (< l 127)) | |
79 (if standard-display-table (aset standard-display-table l nil)) | |
80 (or standard-display-table | |
8920
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
81 (setq standard-display-table (make-vector display-table-len nil))) |
2628
6b17fe69a82f
* disp-table.el (describe-display-table): Don't use the term
Jim Blandy <jimb@redhat.com>
parents:
2523
diff
changeset
|
82 (aset standard-display-table l (vector l))) |
36 | 83 (setq l (1+ l)))) |
84 | |
2072 | 85 ;;;###autoload |
3033
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
86 (defun standard-display-default (l h) |
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
87 "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
|
88 (while (<= l h) |
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
89 (if (and (>= l ?\ ) (< l 127)) |
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
90 (if standard-display-table (aset standard-display-table l nil)) |
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
91 (or standard-display-table |
8920
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
92 (setq standard-display-table (make-vector display-table-len nil))) |
3033
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
93 (aset standard-display-table l nil)) |
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
94 (setq l (1+ l)))) |
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
95 |
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
96 ;;;###autoload |
10435
0f07f211973a
(standard-display-ascii): Doc fix. Allow use with X.
Karl Heuer <kwzh@gnu.org>
parents:
9856
diff
changeset
|
97 ;; 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
|
98 ;; 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
|
99 ;; other functions below, or roll your own. |
36 | 100 (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
|
101 "Display character C using printable string S." |
36 | 102 (or standard-display-table |
8920
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
103 (setq standard-display-table (make-vector display-table-len nil))) |
2523
76685b00c607
Use `vector', not `make-rope'.
Richard M. Stallman <rms@gnu.org>
parents:
2072
diff
changeset
|
104 (aset standard-display-table c (apply 'vector (append s nil)))) |
36 | 105 |
2072 | 106 ;;;###autoload |
36 | 107 (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
|
108 "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
|
109 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
|
110 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
|
111 (if window-system |
43dea22be493
(standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents:
6417
diff
changeset
|
112 (error "Cannot use string glyphs in a windowing system")) |
36 | 113 (or standard-display-table |
8920
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
114 (setq standard-display-table (make-vector display-table-len nil))) |
36 | 115 (aset standard-display-table c |
2523
76685b00c607
Use `vector', not `make-rope'.
Richard M. Stallman <rms@gnu.org>
parents:
2072
diff
changeset
|
116 (vector (create-glyph (concat "\016" (char-to-string sc) "\017"))))) |
36 | 117 |
2072 | 118 ;;;###autoload |
36 | 119 (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
|
120 "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
|
121 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
|
122 X frame." |
43dea22be493
(standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents:
6417
diff
changeset
|
123 (if window-system |
43dea22be493
(standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents:
6417
diff
changeset
|
124 (error "Cannot use string glyphs in a windowing system")) |
36 | 125 (or standard-display-table |
8920
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
126 (setq standard-display-table (make-vector display-table-len nil))) |
36 | 127 (aset standard-display-table c |
2523
76685b00c607
Use `vector', not `make-rope'.
Richard M. Stallman <rms@gnu.org>
parents:
2072
diff
changeset
|
128 (vector (create-glyph (concat "\e(0" (char-to-string gc) "\e(B"))))) |
36 | 129 |
2072 | 130 ;;;###autoload |
36 | 131 (defun standard-display-underline (c uc) |
132 "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
|
133 (if window-system (require 'faces)) |
36 | 134 (or standard-display-table |
8920
45e6d5476e7f
* disp-table.el: Add support for new window border display table
Jim Blandy <jimb@redhat.com>
parents:
7830
diff
changeset
|
135 (setq standard-display-table (make-vector display-table-len nil))) |
36 | 136 (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
|
137 (vector |
43dea22be493
(standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents:
6417
diff
changeset
|
138 (if window-system |
43dea22be493
(standard-display-ascii): Error if using a windowing system.
Karl Heuer <kwzh@gnu.org>
parents:
6417
diff
changeset
|
139 (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
|
140 (create-glyph (concat "\e[4m" (char-to-string uc) "\e[m")))))) |
36 | 141 |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
142 ;; Allocate a glyph code to display by sending STRING to the terminal. |
2072 | 143 ;;;###autoload |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
144 (defun create-glyph (string) |
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
145 (if (= (length glyph-table) 65536) |
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
146 (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
|
147 ;; 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
|
148 (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
|
149 (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
|
150 (setq glyph-table (vconcat glyph-table (list string))) |
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
151 (1- (length glyph-table))) |
36 | 152 |
3061
1e0f5fb4fcf1
* disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents:
3033
diff
changeset
|
153 ;;;###autoload |
3033
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
154 (defun standard-display-european (arg) |
3061
1e0f5fb4fcf1
* disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents:
3033
diff
changeset
|
155 "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
|
156 When enabled, characters in the range of 160 to 255 display not |
1e0f5fb4fcf1
* disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents:
3033
diff
changeset
|
157 as octal escapes, but as accented characters. |
1e0f5fb4fcf1
* disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents:
3033
diff
changeset
|
158 With prefix argument, enable European character display iff arg is positive." |
3033
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
159 (interactive "P") |
7830
1f9ae5be19a2
(standard-display-european): Treat 0 arg like negative.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
160 (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
|
161 (and (null arg) |
1e0f5fb4fcf1
* disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents:
3033
diff
changeset
|
162 (vectorp standard-display-table) |
1e0f5fb4fcf1
* disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents:
3033
diff
changeset
|
163 (>= (length standard-display-table) 161) |
1e0f5fb4fcf1
* disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents:
3033
diff
changeset
|
164 (equal (aref standard-display-table 160) [160]))) |
1e0f5fb4fcf1
* disp-table.el (standard-display-european): Doc fix. Make
Jim Blandy <jimb@redhat.com>
parents:
3033
diff
changeset
|
165 (standard-display-default 160 255) |
3033
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
166 (standard-display-8bit 160 255))) |
8bf84289be17
* disp-table.el (standard-display-default): New function.
Jim Blandy <jimb@redhat.com>
parents:
3012
diff
changeset
|
167 |
36 | 168 (provide 'disp-table) |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
169 |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
170 ;;; disp-table.el ends here |