Mercurial > emacs
comparison lisp/international/mule.el @ 19760:ad4989a73bf0
(charset-quoted-standard-p): New function.
Use it instead of quoted-symbol-p.
(charset-id): Use charset-quoted-standard-p.
(quoted-symbol-p): Function deleted.
(set-terminal-coding-system): Specify default to read-coding-system.
(set-keyboard-coding-system): Likewise.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 05 Sep 1997 05:43:29 +0000 |
parents | dec0b076a378 |
children | 8ccbf79d4294 |
comparison
equal
deleted
inserted
replaced
19759:8dbed9d176fe | 19760:ad4989a73bf0 |
---|---|
73 (message "Loading %s...done" file)) | 73 (message "Loading %s...done" file)) |
74 t))) | 74 t))) |
75 | 75 |
76 ;; API (Application Program Interface) for charsets. | 76 ;; API (Application Program Interface) for charsets. |
77 | 77 |
78 ;; Return t if OBJ is a quoted symbol. | 78 ;; Return t if OBJ is a quoted symbol |
79 (defsubst quoted-symbol-p (obj) | 79 ;; and the symbol is the name of a standard charset. |
80 (and (listp obj) (eq (car obj) 'quote))) | 80 (defsubst charset-quoted-standard-p (obj) |
81 (and (listp obj) (eq (car obj) 'quote) | |
82 (symbolp (car-safe (cdr obj))) | |
83 (let ((vector (get (car-safe (cdr obj)) 'charset))) | |
84 (and (vectorp vector) | |
85 (< (aref vector 0) 160))))) | |
81 | 86 |
82 (defsubst charsetp (object) | 87 (defsubst charsetp (object) |
83 "T is OBJECT is a charset." | 88 "T is OBJECT is a charset." |
84 (and (symbolp object) (vectorp (get object 'charset)))) | 89 (and (symbolp object) (vectorp (get object 'charset)))) |
85 | 90 |
123 `get-charset-property' respectively." | 128 `get-charset-property' respectively." |
124 (get charset 'charset)) | 129 (get charset 'charset)) |
125 | 130 |
126 (defmacro charset-id (charset) | 131 (defmacro charset-id (charset) |
127 "Return charset identification number of CHARSET." | 132 "Return charset identification number of CHARSET." |
128 (if (and (listp charset) (eq (car charset) 'quote)) | 133 (if (charset-quoted-standard-p charset) |
129 (aref (charset-info (nth 1 charset)) 0) | 134 (aref (charset-info (nth 1 charset)) 0) |
130 `(aref (charset-info ,charset) 0))) | 135 `(aref (charset-info ,charset) 0))) |
131 | 136 |
132 (defmacro charset-bytes (charset) | 137 (defmacro charset-bytes (charset) |
133 "Return bytes of CHARSET. | 138 "Return bytes of CHARSET. |
134 See the function `charset-info' for more detail." | 139 See the function `charset-info' for more detail." |
135 (if (quoted-symbol-p charset) | 140 (if (charset-quoted-standard-p charset) |
136 (aref (charset-info (nth 1 charset)) 1) | 141 (aref (charset-info (nth 1 charset)) 1) |
137 `(aref (charset-info ,charset) 1))) | 142 `(aref (charset-info ,charset) 1))) |
138 | 143 |
139 (defmacro charset-dimension (charset) | 144 (defmacro charset-dimension (charset) |
140 "Return dimension of CHARSET. | 145 "Return dimension of CHARSET. |
141 See the function `charset-info' for more detail." | 146 See the function `charset-info' for more detail." |
142 (if (quoted-symbol-p charset) | 147 (if (charset-quoted-standard-p charset) |
143 (aref (charset-info (nth 1 charset)) 2) | 148 (aref (charset-info (nth 1 charset)) 2) |
144 `(aref (charset-info ,charset) 2))) | 149 `(aref (charset-info ,charset) 2))) |
145 | 150 |
146 (defmacro charset-chars (charset) | 151 (defmacro charset-chars (charset) |
147 "Return character numbers contained in a dimension of CHARSET. | 152 "Return character numbers contained in a dimension of CHARSET. |
148 See the function `charset-info' for more detail." | 153 See the function `charset-info' for more detail." |
149 (if (quoted-symbol-p charset) | 154 (if (charset-quoted-standard-p charset) |
150 (aref (charset-info (nth 1 charset)) 3) | 155 (aref (charset-info (nth 1 charset)) 3) |
151 `(aref (charset-info ,charset) 3))) | 156 `(aref (charset-info ,charset) 3))) |
152 | 157 |
153 (defmacro charset-width (charset) | 158 (defmacro charset-width (charset) |
154 "Return width (how many column occupied on a screen) of CHARSET. | 159 "Return width (how many column occupied on a screen) of CHARSET. |
155 See the function `charset-info' for more detail." | 160 See the function `charset-info' for more detail." |
156 (if (quoted-symbol-p charset) | 161 (if (charset-quoted-standard-p charset) |
157 (aref (charset-info (nth 1 charset)) 4) | 162 (aref (charset-info (nth 1 charset)) 4) |
158 `(aref (charset-info ,charset) 4))) | 163 `(aref (charset-info ,charset) 4))) |
159 | 164 |
160 (defmacro charset-direction (charset) | 165 (defmacro charset-direction (charset) |
161 "Return direction of CHARSET. | 166 "Return direction of CHARSET. |
162 See the function `charset-info' for more detail." | 167 See the function `charset-info' for more detail." |
163 (if (quoted-symbol-p charset) | 168 (if (charset-quoted-standard-p charset) |
164 (aref (charset-info (nth 1 charset)) 5) | 169 (aref (charset-info (nth 1 charset)) 5) |
165 `(aref (charset-info ,charset) 5))) | 170 `(aref (charset-info ,charset) 5))) |
166 | 171 |
167 (defmacro charset-iso-final-char (charset) | 172 (defmacro charset-iso-final-char (charset) |
168 "Return final char of CHARSET. | 173 "Return final char of CHARSET. |
169 See the function `charset-info' for more detail." | 174 See the function `charset-info' for more detail." |
170 (if (quoted-symbol-p charset) | 175 (if (charset-quoted-standard-p charset) |
171 (aref (charset-info (nth 1 charset)) 8) | 176 (aref (charset-info (nth 1 charset)) 8) |
172 `(aref (charset-info ,charset) 8))) | 177 `(aref (charset-info ,charset) 8))) |
173 | 178 |
174 (defmacro charset-iso-graphic-plane (charset) | 179 (defmacro charset-iso-graphic-plane (charset) |
175 "Return graphic plane of CHARSET. | 180 "Return graphic plane of CHARSET. |
176 See the function `charset-info' for more detail." | 181 See the function `charset-info' for more detail." |
177 (if (quoted-symbol-p charset) | 182 (if (charset-quoted-standard-p charset) |
178 (aref (charset-info (nth 1 charset)) 9) | 183 (aref (charset-info (nth 1 charset)) 9) |
179 `(aref (charset-info ,charset) 9))) | 184 `(aref (charset-info ,charset) 9))) |
180 | 185 |
181 (defmacro charset-reverse-charset (charset) | 186 (defmacro charset-reverse-charset (charset) |
182 "Return reverse charset of CHARSET. | 187 "Return reverse charset of CHARSET. |
183 See the function `charset-info' for more detail." | 188 See the function `charset-info' for more detail." |
184 (if (quoted-symbol-p charset) | 189 (if (charset-quoted-standard-p charset) |
185 (aref (charset-info (nth 1 charset)) 10) | 190 (aref (charset-info (nth 1 charset)) 10) |
186 `(aref (charset-info ,charset) 10))) | 191 `(aref (charset-info ,charset) 10))) |
187 | 192 |
188 (defmacro charset-short-name (charset) | 193 (defmacro charset-short-name (charset) |
189 "Return short name of CHARSET. | 194 "Return short name of CHARSET. |
190 See the function `charset-info' for more detail." | 195 See the function `charset-info' for more detail." |
191 (if (quoted-symbol-p charset) | 196 (if (charset-quoted-standard-p charset) |
192 (aref (charset-info (nth 1 charset)) 11) | 197 (aref (charset-info (nth 1 charset)) 11) |
193 `(aref (charset-info ,charset) 11))) | 198 `(aref (charset-info ,charset) 11))) |
194 | 199 |
195 (defmacro charset-long-name (charset) | 200 (defmacro charset-long-name (charset) |
196 "Return long name of CHARSET. | 201 "Return long name of CHARSET. |
197 See the function `charset-info' for more detail." | 202 See the function `charset-info' for more detail." |
198 (if (quoted-symbol-p charset) | 203 (if (charset-quoted-standard-p charset) |
199 (aref (charset-info (nth 1 charset)) 12) | 204 (aref (charset-info (nth 1 charset)) 12) |
200 `(aref (charset-info ,charset) 12))) | 205 `(aref (charset-info ,charset) 12))) |
201 | 206 |
202 (defmacro charset-description (charset) | 207 (defmacro charset-description (charset) |
203 "Return descriptoin of CHARSET. | 208 "Return descriptoin of CHARSET. |
204 See the function `charset-info' for more detail." | 209 See the function `charset-info' for more detail." |
205 (if (quoted-symbol-p charset) | 210 (if (charset-quoted-standard-p charset) |
206 (aref (charset-info (nth 1 charset)) 13) | 211 (aref (charset-info (nth 1 charset)) 13) |
207 `(aref (charset-info ,charset) 13))) | 212 `(aref (charset-info ,charset) 13))) |
208 | 213 |
209 (defmacro charset-plist (charset) | 214 (defmacro charset-plist (charset) |
210 "Return list charset property of CHARSET. | 215 "Return list charset property of CHARSET. |
211 See the function `charset-info' for more detail." | 216 See the function `charset-info' for more detail." |
212 (if (quoted-symbol-p charset) | 217 (if (charset-quoted-standard-p charset) |
213 `(aref ,(charset-info (nth 1 charset)) 14) | 218 `(aref ,(charset-info (nth 1 charset)) 14) |
214 `(aref (charset-info ,charset) 14))) | 219 `(aref (charset-info ,charset) 14))) |
215 | 220 |
216 (defun set-charset-plist (charset plist) | 221 (defun set-charset-plist (charset plist) |
217 "Set CHARSET's property list to PLIST, and retrun PLIST." | 222 "Set CHARSET's property list to PLIST, and retrun PLIST." |
221 "Return a character of CHARSET and position-codes CODE1 and CODE2. | 226 "Return a character of CHARSET and position-codes CODE1 and CODE2. |
222 CODE1 and CODE2 are optional, but if you don't supply | 227 CODE1 and CODE2 are optional, but if you don't supply |
223 sufficient position-codes, return a generic character which stands for | 228 sufficient position-codes, return a generic character which stands for |
224 all characters or group of characters in the character sets. | 229 all characters or group of characters in the character sets. |
225 A generic character can be used to index a char table (e.g. syntax-table)." | 230 A generic character can be used to index a char table (e.g. syntax-table)." |
226 (if (quoted-symbol-p charset) | 231 (if (charset-quoted-standard-p charset) |
227 `(make-char-internal ,(charset-id (nth 1 charset)) ,c1 ,c2) | 232 `(make-char-internal ,(charset-id (nth 1 charset)) ,c1 ,c2) |
228 `(make-char-internal (charset-id ,charset) ,c1 ,c2))) | 233 `(make-char-internal (charset-id ,charset) ,c1 ,c2))) |
229 | 234 |
230 (defmacro charset-list () | 235 (defmacro charset-list () |
231 "Return list of charsets ever defined. | 236 "Return list of charsets ever defined. |
534 with the specified coding system. | 539 with the specified coding system. |
535 For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. | 540 For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. |
536 The default is determined by the selected language environment | 541 The default is determined by the selected language environment |
537 or by the previous use of this command." | 542 or by the previous use of this command." |
538 (interactive | 543 (interactive |
539 (list (read-coding-system | 544 (list (let ((default (if (and (not (terminal-coding-system)) |
540 (format "Coding system for terminal display (default, %s): " | 545 default-terminal-coding-system) |
541 (if (and (not (terminal-coding-system)) | 546 default-terminal-coding-system))) |
542 default-terminal-coding-system) | 547 (read-coding-system |
543 default-terminal-coding-system))))) | 548 (format "Coding system for terminal display (default, %s): " |
549 default) | |
550 default)))) | |
544 (if (and (not coding-system) | 551 (if (and (not coding-system) |
545 (not (terminal-coding-system))) | 552 (not (terminal-coding-system))) |
546 (setq coding-system default-terminal-coding-system)) | 553 (setq coding-system default-terminal-coding-system)) |
547 (if coding-system | 554 (if coding-system |
548 (setq default-terminal-coding-system coding-system)) | 555 (setq default-terminal-coding-system coding-system)) |
560 \(If CODING-SYSTEM is nil, Encoded-bkd mode is turned off.) | 567 \(If CODING-SYSTEM is nil, Encoded-bkd mode is turned off.) |
561 For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. | 568 For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]. |
562 The default is determined by the selected language environment | 569 The default is determined by the selected language environment |
563 or by the previous use of this command." | 570 or by the previous use of this command." |
564 (interactive | 571 (interactive |
565 (list (read-coding-system | 572 (list (let ((default (if (and (not (keyboard-coding-system)) |
566 (format "Coding system for keyboard input (default, %s): " | 573 default-keyboard-coding-system) |
567 (if (and (not (keyboard-coding-system)) | 574 default-keyboard-coding-system))) |
568 default-keyboard-coding-system) | 575 (read-coding-system |
569 default-keyboard-coding-system))))) | 576 (format "Coding system for keyboard input (default, %s): " |
577 default) | |
578 default)))) | |
570 (if (and (not coding-system) | 579 (if (and (not coding-system) |
571 (not (keyboard-coding-system))) | 580 (not (keyboard-coding-system))) |
572 (setq coding-system default-keyboard-coding-system)) | 581 (setq coding-system default-keyboard-coding-system)) |
573 (if coding-system | 582 (if coding-system |
574 (setq default-keyboard-coding-system coding-system)) | 583 (setq default-keyboard-coding-system coding-system)) |