Mercurial > emacs
annotate lisp/disp-table.el @ 727:540b047ece4d
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 24 Jun 1992 05:09:26 +0000 |
parents | 904853a03d9a |
children | 4f28bd14272c |
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 |
36 | 3 ;; Copyright (C) 1987 Free Software Foundation, Inc. |
4 | |
5 ;; This file is part of GNU Emacs. | |
6 | |
7 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
8 ;; it under the terms of the GNU General Public License as published by | |
9 ;; the Free Software Foundation; either version 1, or (at your option) | |
10 ;; any later version. | |
11 | |
12 ;; GNU Emacs is distributed in the hope that it will be useful, | |
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 ;; GNU General Public License for more details. | |
16 | |
17 ;; You should have received a copy of the GNU General Public License | |
18 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
19 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | |
21 | |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
22 ;; Written by Howard Gayle. |
36 | 23 |
24 (defun rope-to-vector (rope) | |
25 (let* ((len (/ (length rope) 2)) | |
26 (vector (make-vector len nil)) | |
27 (i 0)) | |
28 (while (< i len) | |
29 (aset vector i (rope-elt rope i)) | |
30 (setq i (1+ i))))) | |
31 | |
32 (defun describe-display-table (DT) | |
584 | 33 "Describe the display table DT in a help buffer." |
36 | 34 (with-output-to-temp-buffer "*Help*" |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
35 (princ "\nTruncation glyph: ") |
36 | 36 (prin1 (aref dt 256)) |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
37 (princ "\nWrap glyph: ") |
36 | 38 (prin1 (aref dt 257)) |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
39 (princ "\nEscape glyph: ") |
36 | 40 (prin1 (aref dt 258)) |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
41 (princ "\nCtrl glyph: ") |
36 | 42 (prin1 (aref dt 259)) |
43 (princ "\nSelective display rope: ") | |
44 (prin1 (rope-to-vector (aref dt 260))) | |
45 (princ "\nCharacter display ropes:\n") | |
46 (let ((vector (make-vector 256 nil)) | |
47 (i 0)) | |
48 (while (< i 256) | |
49 (aset vector i | |
50 (if (stringp (aref dt i)) | |
51 (rope-to-vector (aref dt i)) | |
52 (aref dt i))) | |
53 (setq i (1+ i))) | |
54 (describe-vector vector)) | |
55 (print-help-return-message))) | |
56 | |
57 (defun describe-current-display-table () | |
584 | 58 "Describe the display table in use in the selected window and buffer." |
36 | 59 (interactive) |
60 (describe-display-table | |
61 (or (window-display-table (selected-window)) | |
62 buffer-display-table | |
63 standard-display-table))) | |
64 | |
65 (defun make-display-table () | |
66 (make-vector 261 nil)) | |
67 | |
68 (defun standard-display-8bit (l h) | |
584 | 69 "Display characters in the range L to H literally." |
36 | 70 (while (<= l h) |
71 (if (and (>= l ?\ ) (< l 127)) | |
72 (if standard-display-table (aset standard-display-table l nil)) | |
73 (or standard-display-table | |
74 (setq standard-display-table (make-vector 261 nil))) | |
75 (aset standard-display-table l l)) | |
76 (setq l (1+ l)))) | |
77 | |
78 (defun standard-display-ascii (c s) | |
79 "Display character C using string S." | |
80 (or standard-display-table | |
81 (setq standard-display-table (make-vector 261 nil))) | |
82 (aset standard-display-table c (apply 'make-rope (append s nil)))) | |
83 | |
84 (defun standard-display-g1 (c sc) | |
85 "Display character C as character SC in the g1 character set." | |
86 (or standard-display-table | |
87 (setq standard-display-table (make-vector 261 nil))) | |
88 (aset standard-display-table c | |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
89 (make-rope (create-glyph (concat "\016" (char-to-string sc) "\017"))))) |
36 | 90 |
91 (defun standard-display-graphic (c gc) | |
92 "Display character C as character GC in graphics character set." | |
93 (or standard-display-table | |
94 (setq standard-display-table (make-vector 261 nil))) | |
95 (aset standard-display-table c | |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
96 (make-rope (create-glyph (concat "\e(0" (char-to-string gc) "\e(B"))))) |
36 | 97 |
98 (defun standard-display-underline (c uc) | |
99 "Display character C as character UC plus underlining." | |
100 (or standard-display-table | |
101 (setq standard-display-table (make-vector 261 nil))) | |
102 (aset standard-display-table c | |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
103 (make-rope (create-glyph (concat "\e[4m" (char-to-string uc) "\e[m"))))) |
36 | 104 |
696
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
105 ;; Allocate a glyph code to display by sending STRING to the terminal. |
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
106 (defun create-glyph (string) |
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
107 (if (= (length glyph-table) 65536) |
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
108 (error "No free glyph codes remain")) |
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
109 (setq glyph-table (vconcat glyph-table (list string))) |
904853a03d9a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
662
diff
changeset
|
110 (1- (length glyph-table))) |
36 | 111 |
112 (provide 'disp-table) | |
662
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
113 |
8a533acedb77
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
114 ;;; disp-table.el ends here |