* configure.in: Doc fix.
[bpt/emacs.git] / lisp / disp-table.el
CommitLineData
c0274f38
ER
1;;; disp-table.el --- functions for dealing with char tables.
2
9750e079
ER
3;; Copyright (C) 1987 Free Software Foundation, Inc.
4
e5167999
ER
5;; Author: Howard Gayle
6;; Maintainer: FSF
9750e079 7;; Keywords: i14n
a2535589
JA
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
e5167999 13;; the Free Software Foundation; either version 2, or (at your option)
a2535589
JA
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
e5167999 25;;; Code:
a2535589 26
e31b61e6 27(defun describe-display-table (dt)
49116ac0 28 "Describe the display table DT in a help buffer."
a2535589 29 (with-output-to-temp-buffer "*Help*"
03131799 30 (princ "\nTruncation glyph: ")
a2535589 31 (prin1 (aref dt 256))
03131799 32 (princ "\nWrap glyph: ")
a2535589 33 (prin1 (aref dt 257))
03131799 34 (princ "\nEscape glyph: ")
a2535589 35 (prin1 (aref dt 258))
03131799 36 (princ "\nCtrl glyph: ")
a2535589 37 (prin1 (aref dt 259))
afb1e4b4 38 (princ "\nSelective display glyph sequence: ")
e31b61e6 39 (prin1 (aref dt 260))
afb1e4b4 40 (princ "\nCharacter display glyph sequences:\n")
a2535589
JA
41 (let ((vector (make-vector 256 nil))
42 (i 0))
43 (while (< i 256)
e31b61e6 44 (aset vector i (aref dt i))
a2535589
JA
45 (setq i (1+ i)))
46 (describe-vector vector))
47 (print-help-return-message)))
48
e31b61e6 49;;;###autoload
a2535589 50(defun describe-current-display-table ()
49116ac0 51 "Describe the display table in use in the selected window and buffer."
a2535589
JA
52 (interactive)
53 (describe-display-table
54 (or (window-display-table (selected-window))
55 buffer-display-table
56 standard-display-table)))
57
e31b61e6 58;;;###autoload
a2535589 59(defun make-display-table ()
e31b61e6 60 "Return a new, empty display table."
a2535589
JA
61 (make-vector 261 nil))
62
e31b61e6 63;;;###autoload
a2535589 64(defun standard-display-8bit (l h)
49116ac0 65 "Display characters in the range L to H literally."
a2535589
JA
66 (while (<= l h)
67 (if (and (>= l ?\ ) (< l 127))
68 (if standard-display-table (aset standard-display-table l nil))
69 (or standard-display-table
70 (setq standard-display-table (make-vector 261 nil)))
afb1e4b4 71 (aset standard-display-table l (vector l)))
a2535589
JA
72 (setq l (1+ l))))
73
e31b61e6 74;;;###autoload
a2535589
JA
75(defun standard-display-ascii (c s)
76 "Display character C using string S."
77 (or standard-display-table
78 (setq standard-display-table (make-vector 261 nil)))
82093c70 79 (aset standard-display-table c (apply 'vector (append s nil))))
a2535589 80
e31b61e6 81;;;###autoload
a2535589
JA
82(defun standard-display-g1 (c sc)
83 "Display character C as character SC in the g1 character set."
84 (or standard-display-table
85 (setq standard-display-table (make-vector 261 nil)))
86 (aset standard-display-table c
82093c70 87 (vector (create-glyph (concat "\016" (char-to-string sc) "\017")))))
a2535589 88
e31b61e6 89;;;###autoload
a2535589
JA
90(defun standard-display-graphic (c gc)
91 "Display character C as character GC in graphics character set."
92 (or standard-display-table
93 (setq standard-display-table (make-vector 261 nil)))
94 (aset standard-display-table c
82093c70 95 (vector (create-glyph (concat "\e(0" (char-to-string gc) "\e(B")))))
a2535589 96
e31b61e6 97;;;###autoload
a2535589
JA
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
82093c70 103 (vector (create-glyph (concat "\e[4m" (char-to-string uc) "\e[m")))))
03131799
RS
104
105;; Allocate a glyph code to display by sending STRING to the terminal.
e31b61e6 106;;;###autoload
03131799
RS
107(defun create-glyph (string)
108 (if (= (length glyph-table) 65536)
109 (error "No free glyph codes remain"))
110 (setq glyph-table (vconcat glyph-table (list string)))
111 (1- (length glyph-table)))
a2535589
JA
112
113(provide 'disp-table)
c0274f38
ER
114
115;;; disp-table.el ends here