comparison lisp/international/mule.el @ 88551:936dca068940

Doc fixes. (charset-list, generic-char-p, set-coding-priority): Make obsolete. (coding-system-get): Try to convert old-style symbol to keyword.
author Dave Love <fx@gnu.org>
date Fri, 17 May 2002 16:51:14 +0000
parents 5082b2d8d5eb
children 30c5971edc3c
comparison
equal deleted inserted replaced
88550:77b7f94032fa 88551:936dca068940
1 ;;; mule.el --- basic commands for mulitilingual environment 1 ;;; mule.el --- basic commands for multilingual environment
2 2
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. 3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation. 4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 2001 Free Software Foundation, Inc. 5 ;; Copyright (C) 2001 Free Software Foundation, Inc.
6 ;; Copyright (C) 2001, 2002 6 ;; Copyright (C) 2001, 2002
46 ;;; CHARSET 46 ;;; CHARSET
47 47
48 (defun define-charset (name docstring &rest props) 48 (defun define-charset (name docstring &rest props)
49 "Define NAME (symbol) as a charset with DOCSTRING. 49 "Define NAME (symbol) as a charset with DOCSTRING.
50 The remaining arguments must come in pairs ATTRIBUTE VALUE. ATTRIBUTE 50 The remaining arguments must come in pairs ATTRIBUTE VALUE. ATTRIBUTE
51 may be any symbol. The followings have special meanings, and one of 51 may be any symbol. The following have special meanings, and one of
52 `:code-offset', `:map', `:parents' must be specified. 52 `:code-offset', `:map', `:parents' must be specified.
53 53
54 `:short-name' 54 `:short-name'
55 55
56 VALUE must be a short string to identify the charset. If omitted, 56 VALUE must be a short string to identify the charset. If omitted,
57 NAME is used. 57 NAME is used.
58 58
59 `:long-name' 59 `:long-name'
60 60
61 VALUE must be a string longer than `:short-name' to identify the 61 VALUE must be a string longer than `:short-name' to identify the
62 charset. If omitted, the value of `:short-name' attribute is used. 62 charset. If omitted, the value of the `:short-name' attribute is used.
63 63
64 `:dimension' 64 `:dimension'
65 65
66 VALUE must be an integer 0, 1, 2, or 3, specifying the dimension of 66 VALUE must be an integer 0, 1, 2, or 3, specifying the dimension of
67 code-points of the charsets. If omitted, it is calculated from a 67 code-points of the charsets. If omitted, it is calculated from the
68 value of `:code-space' attribute. 68 value of the `:code-space' attribute.
69 69
70 `:code-space' 70 `:code-space'
71 71
72 VALUE must be a vector of length at most 8 specifying the byte code 72 VALUE must be a vector of length at most 8 specifying the byte code
73 range of each dimension in this format: 73 range of each dimension in this format:
74 [ MIN-1 MAX-1 MIN-2 MAX-2 ... ] 74 [ MIN-1 MAX-1 MIN-2 MAX-2 ... ]
75 where, MIN-N is the minimum byte value of Nth dimension of code-point, 75 where MIN-N is the minimum byte value of Nth dimension of code-point,
76 MAX-N is the maximum byte value of that. 76 MAX-N is the maximum byte value of that.
77 77
78 `:iso-final-char' 78 `:iso-final-char'
79 79
80 VALUE must be a character in the range 32 to 127 (inclusive) 80 VALUE must be a character in the range 32 to 127 (inclusive)
92 VALUE must be an integer of 0, 128..255. If omitted, the charset 92 VALUE must be an integer of 0, 128..255. If omitted, the charset
93 can't be encoded by coding-systems of type `emacs-mule'. 93 can't be encoded by coding-systems of type `emacs-mule'.
94 94
95 `:ascii-compatible-p' 95 `:ascii-compatible-p'
96 96
97 VALUE must be nil or t. If the VALUE is nil, the charset is a not 97 VALUE must be nil or t (default nil). If VALUE is t, the charset is
98 compatible with ASCII. The default value is nil. 98 compatible with ASCII, i.e. the first 128 code points map to ASCII.
99 99
100 `:supplementary-p' 100 `:supplementary-p'
101 101
102 VALUE must be nil or t. If the VALUE is t, the charset is 102 VALUE must be nil or t. If the VALUE is t, the charset is
103 supplementary, which means the charset is used only as a parent of 103 supplementary, which means it is used only as a parent of some other
104 some other charset. 104 charset.
105 105
106 `:invalid-code' 106 `:invalid-code'
107 107
108 VALUE must be a nonnegative integer that can be used as an invalid 108 VALUE must be a nonnegative integer that can be used as an invalid
109 code point of the charset. If the minimum code is 0 and the maximum 109 code point of the charset. If the minimum code is 0 and the maximum
110 code is greater than Emacs' maximum integer value, `:invalid-code' 110 code is greater than Emacs' maximum integer value, `:invalid-code'
111 should not be omitted. 111 should not be omitted.
112 112
113 `:code-offset' 113 `:code-offset'
114 114
115 VALUE must be an integer added to an index number of character to get 115 VALUE must be an integer added to the index number of a character to
116 the corresponding character code. 116 get the corresponding character code.
117 117
118 `:map' 118 `:map'
119 119
120 VALUE must be vector or string. 120 VALUE must be vector or string.
121 121
122 If it is a vector, the format is [ CODE-1 CHAR-1 CODE-2 CHAR-2 ... ], 122 If it is a vector, the format is [ CODE-1 CHAR-1 CODE-2 CHAR-2 ... ],
123 where CODE-n is a code-point of the charset, and CHAR-n is the 123 where CODE-n is a code-point of the charset, and CHAR-n is the
124 corresponding charcter code. 124 corresponding character code.
125 125
126 If it is a string, it is a name of file that contains the above 126 If it is a string, it is a name of file that contains the above
127 information. Each line of the file must be this format: 127 information. Each line of the file must be this format:
128 0xXXX 0xYYY 128 0xXXX 0xYYY
129 where XXX is a hexadecimal representation of CODE-n and YYY is a 129 where XXX is a hexadecimal representation of CODE-n and YYY is a
142 142
143 VALUE must be vector or string. 143 VALUE must be vector or string.
144 144
145 If it is a vector, the format is [ CODE-1 CHAR-1 CODE-2 CHAR-2 ... ], 145 If it is a vector, the format is [ CODE-1 CHAR-1 CODE-2 CHAR-2 ... ],
146 where CODE-n is a code-point of the charset, and CHAR-n is the 146 where CODE-n is a code-point of the charset, and CHAR-n is the
147 corresponding Unicode charcter code. 147 corresponding Unicode character code.
148 148
149 If it is a string, it is a name of file that contains the above 149 If it is a string, it is a name of file that contains the above
150 information. The file format is the same as what described for `:map' 150 information. The file format is the same as what described for `:map'
151 attribute." 151 attribute."
152 (let ((attrs (mapcar 'list '(:dimension 152 (let ((attrs (mapcar 'list '(:dimension
309 "Return list of charsets ever defined. 309 "Return list of charsets ever defined.
310 310
311 This function is provided for backward compatibility. 311 This function is provided for backward compatibility.
312 Now we have the variable `charset-list'." 312 Now we have the variable `charset-list'."
313 charset-list) 313 charset-list)
314 (make-obsolete 'charset-list "Use variable `charset-list'" "22.1")
314 315
315 (defun generic-char-p (char) 316 (defun generic-char-p (char)
316 "Always return nil. This exists only for backward compatibility." 317 "Always return nil. This exists only for backward compatibility."
317 nil) 318 nil)
319 (make-obsolete 'generic-char-p "Generic characters no longer exist" "22.1")
318 320
319 ;; Coding system stuff 321 ;; Coding system stuff
320 322
321 ;; Coding system is a symbol that has been defined by the function 323 ;; Coding system is a symbol that has been defined by the function
322 ;; `define-coding-system'. 324 ;; `define-coding-system'.
426 selected. 428 selected.
427 429
428 `:ascii-compatible-p' (optional) 430 `:ascii-compatible-p' (optional)
429 431
430 If VALUE is non-nil, the coding system decodes all 7-bit bytes into 432 If VALUE is non-nil, the coding system decodes all 7-bit bytes into
431 the correponding ASCII characters, and encodes all ASCII characters 433 the corresponding ASCII characters, and encodes all ASCII characters
432 back to the correponding 7-bit bytes. If omitted, the VALUE defaults 434 back to the corresponding 7-bit bytes. If omitted, the VALUE defaults
433 to nil. 435 to nil.
434 436
435 `:decode-translation-table' (optional) 437 `:decode-translation-table' (optional)
436 438
437 VALUE must be a translation table to use on decoding. 439 VALUE must be a translation table to use on decoding.
486 VALUE must be a vector [ G0-USAGE G1-USAGE G2-USAGE G3-USAGE]. 488 VALUE must be a vector [ G0-USAGE G1-USAGE G2-USAGE G3-USAGE].
487 GN-USAGE specifies the usage of graphic register GN as follows. 489 GN-USAGE specifies the usage of graphic register GN as follows.
488 490
489 If it is nil, no charset can be designated to GN. 491 If it is nil, no charset can be designated to GN.
490 492
491 If it is a charset, the charset is initially designaged to GN, and 493 If it is a charset, the charset is initially designated to GN, and
492 never used by the other charsets. 494 never used by the other charsets.
493 495
494 If it is a list, the elements must be charsets, nil, 94, or 96. GN 496 If it is a list, the elements must be charsets, nil, 94, or 96. GN
495 can be used by all listed charsets. If the list contains 94, any 497 can be used by all listed charsets. If the list contains 94, any
496 charsets whose iso-chars is 94 can be designaged to GN. If the list 498 charsets whose iso-chars is 94 can be designated to GN. If the list
497 contains 96, any charsets whose iso-chars is 96 can be designaged to 499 contains 96, any charsets whose iso-chars is 96 can be designated to
498 GN. If the first element is a charset, the charset is initially 500 GN. If the first element is a charset, the charset is initially
499 designaged to GN. 501 designated to GN.
500 502
501 This attribute has a meaning only when `:coding-type' is `iso-2022'. 503 This attribute has a meaning only when `:coding-type' is `iso-2022'.
502 504
503 `:bom' 505 `:bom'
504 506
614 A coding type is a symbol indicating the encoding method of CODING-SYSTEM. 616 A coding type is a symbol indicating the encoding method of CODING-SYSTEM.
615 See the function `define-coding-system' for more detail." 617 See the function `define-coding-system' for more detail."
616 (plist-get (coding-system-plist coding-system) :coding-type)) 618 (plist-get (coding-system-plist coding-system) :coding-type))
617 619
618 (defun coding-system-charset-list (coding-system) 620 (defun coding-system-charset-list (coding-system)
619 "Return list of charsets supported by COIDNG-SYSTEM. 621 "Return list of charsets supported by CODING-SYSTEM.
620 If CODING-SYSTEM supports all ISO-2022 charsets, return `iso-2022'. 622 If CODING-SYSTEM supports all ISO-2022 charsets, return `iso-2022'.
621 If CODING-SYSTEM supports all emacs-mule charsets, return `emacs-mule'." 623 If CODING-SYSTEM supports all emacs-mule charsets, return `emacs-mule'."
622 (plist-get (coding-system-plist coding-system) :charset-list)) 624 (plist-get (coding-system-plist coding-system) :charset-list))
623 625
624 (defun coding-system-get (coding-system prop) 626 (defun coding-system-get (coding-system prop)
625 "Extract a value from CODING-SYSTEM's property list for property PROP." 627 "Extract a value from CODING-SYSTEM's property list for property PROP.
626 (plist-get (coding-system-plist coding-system) prop)) 628 For compatibility with Emacs 20/21, this accepts old-style symbols
629 like `mime-charset' as well as the current style like `:mime-charset'."
630 (or (plist-get (coding-system-plist coding-system) prop)
631 (if (not (keywordp prop))
632 (plist-get (coding-system-plist coding-system)
633 (intern (concat ":" (symbol-name prop)))))))
627 634
628 (defun coding-system-put (coding-system prop val) 635 (defun coding-system-put (coding-system prop val)
629 "Change value in CODING-SYSTEM's property list PROP to VAL." 636 "Change value in CODING-SYSTEM's property list PROP to VAL."
630 (plist-put (coding-system-plist coding-system) prop val)) 637 (plist-put (coding-system-plist coding-system) prop val))
631 638
875 (error "Invalid or duplicated element in argument: %s" arg)) 882 (error "Invalid or duplicated element in argument: %s" arg))
876 (setq current-list (delq (car l) current-list)) 883 (setq current-list (delq (car l) current-list))
877 (setq l (cdr l))) 884 (setq l (cdr l)))
878 ;; Update `coding-category-list' and return it. 885 ;; Update `coding-category-list' and return it.
879 (setq coding-category-list (append arg current-list)) 886 (setq coding-category-list (append arg current-list))
887 ;; Fixme: not defined.
880 (set-coding-priority-internal))) 888 (set-coding-priority-internal)))
889 (make-obsolete 'set-coding-priority 'set-coding-system-priority "22.1")
881 890
882 ;;; X selections 891 ;;; X selections
883 892
884 (defvar non-standard-icccm-encodings-alist 893 (defvar non-standard-icccm-encodings-alist
885 '(("ISO8859-15" . latin-iso8859-15) 894 '(("ISO8859-15" . latin-iso8859-15)
1475 id)) 1484 id))
1476 1485
1477 (put 'with-category-table 'lisp-indent-function 1) 1486 (put 'with-category-table 'lisp-indent-function 1)
1478 1487
1479 (defmacro with-category-table (category-table &rest body) 1488 (defmacro with-category-table (category-table &rest body)
1489 "Execute BODY like `progn' with CATEGORY-TABLE the current category table."
1480 `(let ((current-category-table (category-table))) 1490 `(let ((current-category-table (category-table)))
1481 (set-category-table ,category-table) 1491 (set-category-table ,category-table)
1482 (unwind-protect 1492 (unwind-protect
1483 (progn ,@body) 1493 (progn ,@body)
1484 (set-category-table current-category-table)))) 1494 (set-category-table current-category-table))))