comparison lisp/international/latin1-disp.el @ 50125:a9135466b161

(ucs-tables): Don't require. (latin1-display-face): New. (latin1-display-char): Use it.
author Dave Love <fx@gnu.org>
date Thu, 13 Mar 2003 23:00:49 +0000
parents 0d8b17d428b5
children 0c3a51473a57
comparison
equal deleted inserted replaced
50124:d4f965eb8fd5 50125:a9135466b161
47 47
48 ;;; Code: 48 ;;; Code:
49 49
50 ;; Ensure `standard-display-table' is set up: 50 ;; Ensure `standard-display-table' is set up:
51 (require 'disp-table) 51 (require 'disp-table)
52 (require 'ucs-tables)
53 52
54 (defconst latin1-display-sets '(latin-2 latin-3 latin-4 latin-5 latin-8 53 (defconst latin1-display-sets '(latin-2 latin-3 latin-4 latin-5 latin-8
55 latin-9 arabic cyrillic greek hebrew) 54 latin-9 arabic cyrillic greek hebrew)
56 "The ISO8859 character sets with defined Latin-1 display sequences. 55 "The ISO8859 character sets with defined Latin-1 display sequences.
57 These are the nicknames for the sets and correspond to Emacs language 56 These are the nicknames for the sets and correspond to Emacs language
64 :group 'i18n) 63 :group 'i18n)
65 64
66 (defcustom latin1-display-format "{%s}" 65 (defcustom latin1-display-format "{%s}"
67 "A format string used to display the ASCII sequences. 66 "A format string used to display the ASCII sequences.
68 The default encloses the sequence in braces, but you could just use 67 The default encloses the sequence in braces, but you could just use
69 \"%s\" to avoid the braces." 68 \"%s\" to avoid the braces, maybe with a non-default value of
69 `latin1-display-face'."
70 :group 'latin1-display 70 :group 'latin1-display
71 :type 'string) 71 :type 'string)
72 72
73 ;;;###autoload 73 ;;;###autoload
74 (defcustom latin1-display nil 74 (defcustom latin1-display nil
150 These are taken from the tables in `internal.el' rather than the Quail 150 These are taken from the tables in `internal.el' rather than the Quail
151 input sequences." 151 input sequences."
152 :type 'boolean 152 :type 'boolean
153 :group 'latin1-display) 153 :group 'latin1-display)
154 154
155 (defcustom latin1-display-face 'default
156 "Face to use for displaying substituted ASCII sequences."
157 :type 'face
158 :version "21.4"
159 :group 'latin1-display)
160
155 (defun latin1-display-char (char display &optional alt-display) 161 (defun latin1-display-char (char display &optional alt-display)
156 "Make an entry in `standard-display-table' for CHAR using string DISPLAY. 162 "Make an entry in `standard-display-table' for CHAR using string DISPLAY.
157 If ALT-DISPLAY is provided, use that instead if 163 If ALT-DISPLAY is provided, use that instead if
158 `latin1-display-mnemonic' is non-nil. The actual string displayed is 164 `latin1-display-mnemonic' is non-nil. The actual string displayed is
159 formatted using `latin1-display-format'. 165 formatted using `latin1-display-format'.
164 asis." 170 asis."
165 (if (and (stringp alt-display) 171 (if (and (stringp alt-display)
166 latin1-display-mnemonic) 172 latin1-display-mnemonic)
167 (setq display alt-display)) 173 (setq display alt-display))
168 (if (stringp display) 174 (if (stringp display)
169 (standard-display-ascii char (format latin1-display-format display)) 175 (if (eq 'default latin1-display-face)
170 (aset standard-display-table char display))) 176 (standard-display-ascii char (format latin1-display-format display))
177 (aset standard-display-table char
178 (vconcat (mapcar (lambda (c)
179 (logior c (lsh (face-id latin1-display-face)
180 19)))
181 display))))
182 (aset standard-display-table char
183 (if (eq 'default latin1-display-face)
184 display
185 (logior display (lsh (face-id latin1-display-face) 19))))))
171 186
172 (defun latin1-display-identities (charset) 187 (defun latin1-display-identities (charset)
173 "Display each character in CHARSET as the corresponding Latin-1 character. 188 "Display each character in CHARSET as the corresponding Latin-1 character.
174 CHARSET is a symbol which is the nickname of a language environment 189 CHARSET is a symbol which is the nickname of a language environment
175 using an ISO8859 character set." 190 using an ISO8859 character set."