diff options
| author | Kenichi Handa | 1998-05-18 01:01:00 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-05-18 01:01:00 +0000 |
| commit | b25eef20fdf530ff8cfca023d53bbeaf07b5b51f (patch) | |
| tree | ff2d3ce40ca0d5cd58091d352722bcec0d839c9a | |
| parent | 0548a7fdc2913ca0627e6566f356d0b115ced0be (diff) | |
| download | emacs-b25eef20fdf530ff8cfca023d53bbeaf07b5b51f.tar.gz emacs-b25eef20fdf530ff8cfca023d53bbeaf07b5b51f.zip | |
Change term unification to translation
throughtout the file.
(set-clipboard-coding-system): New function.
| -rw-r--r-- | lisp/international/mule.el | 94 |
1 files changed, 54 insertions, 40 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 281bc86d7f1..9929ddbcac9 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -328,15 +328,16 @@ See also the documentation of make-char." | |||
| 328 | ;; in `write-region-annotate-functions', i.e. FROM and TO specifying | 328 | ;; in `write-region-annotate-functions', i.e. FROM and TO specifying |
| 329 | ;; region of a text. | 329 | ;; region of a text. |
| 330 | ;; | 330 | ;; |
| 331 | ;; o character-unification-table-for-decode | 331 | ;; o character-translation-table-for-decode |
| 332 | ;; | 332 | ;; |
| 333 | ;; The value is a unification table to be applied on decoding. See | 333 | ;; The value is a character translation table to be applied on |
| 334 | ;; the function `make-unification-table' for the format of unification | 334 | ;; decoding. See the function `make-translation-table' for the format |
| 335 | ;; table. | 335 | ;; of translation table. |
| 336 | ;; | 336 | ;; |
| 337 | ;; o character-unification-table-for-encode | 337 | ;; o character-translation-table-for-encode |
| 338 | ;; | 338 | ;; |
| 339 | ;; The value is a unification table to be applied on encoding. | 339 | ;; The value is a character translation table to be applied on |
| 340 | ;; encoding. | ||
| 340 | ;; | 341 | ;; |
| 341 | ;; o safe-charsets | 342 | ;; o safe-charsets |
| 342 | ;; | 343 | ;; |
| @@ -346,7 +347,11 @@ See also the documentation of make-char." | |||
| 346 | ;; mean that the charset can't be encoded in the coding system, | 347 | ;; mean that the charset can't be encoded in the coding system, |
| 347 | ;; instead, it just means that some other receiver of a text encoded | 348 | ;; instead, it just means that some other receiver of a text encoded |
| 348 | ;; in the coding system won't be able to handle that charset. | 349 | ;; in the coding system won't be able to handle that charset. |
| 349 | 350 | ;; | |
| 351 | ;; o mime-charset | ||
| 352 | ;; | ||
| 353 | ;; The value is a symbol of which name is `MIME-charset' parameter of | ||
| 354 | ;; the coding system. | ||
| 350 | 355 | ||
| 351 | ;; Return coding-spec of CODING-SYSTEM | 356 | ;; Return coding-spec of CODING-SYSTEM |
| 352 | (defsubst coding-system-spec (coding-system) | 357 | (defsubst coding-system-spec (coding-system) |
| @@ -742,6 +747,13 @@ For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]." | |||
| 742 | (set-process-coding-system proc decoding encoding))) | 747 | (set-process-coding-system proc decoding encoding))) |
| 743 | (force-mode-line-update)) | 748 | (force-mode-line-update)) |
| 744 | 749 | ||
| 750 | (defun set-clipboard-coding-system (coding-system) | ||
| 751 | "Make CODING-SYSTEM used for communicating with other X clients . | ||
| 752 | When sending or receiving text via cut_buffer, selection, and clipboard, | ||
| 753 | the text is encoded or decoded by CODING-SYSTEM." | ||
| 754 | (check-coding-system coding-system) | ||
| 755 | (setq clipboard-coding-system coding-system)) | ||
| 756 | |||
| 745 | (defun set-coding-priority (arg) | 757 | (defun set-coding-priority (arg) |
| 746 | "Set priority of coding categories according to LIST. | 758 | "Set priority of coding categories according to LIST. |
| 747 | LIST is a list of coding categories ordered by priority." | 759 | LIST is a list of coding categories ordered by priority." |
| @@ -973,17 +985,17 @@ or a function symbol which, when called, returns such a cons cell." | |||
| 973 | (cons (cons regexp coding-system) | 985 | (cons (cons regexp coding-system) |
| 974 | network-coding-system-alist))))))) | 986 | network-coding-system-alist))))))) |
| 975 | 987 | ||
| 976 | (defun make-unification-table (&rest args) | 988 | (defun make-translation-table (&rest args) |
| 977 | "Make a unification table (char table) from arguments. | 989 | "Make a character translation table (char table) from arguments. |
| 978 | Each argument is a list of the form (FROM . TO), | 990 | Each argument is a list of the form (FROM . TO), |
| 979 | where FROM is a character to be unified to TO. | 991 | where FROM is a character to be translated to TO. |
| 980 | 992 | ||
| 981 | FROM can be a generic character (see make-char). In this case, TO is | 993 | FROM can be a generic character (see make-char). In this case, TO is |
| 982 | a generic character containing the same number of charcters or a | 994 | a generic character containing the same number of charcters or a |
| 983 | oridinal character. If FROM and TO are both generic characters, all | 995 | oridinal character. If FROM and TO are both generic characters, all |
| 984 | characters belonging to FROM are unified to characters belonging to TO | 996 | characters belonging to FROM are translated to characters belonging to TO |
| 985 | without changing their position code(s)." | 997 | without changing their position code(s)." |
| 986 | (let ((table (make-char-table 'character-unification-table)) | 998 | (let ((table (make-char-table 'character-translation-table)) |
| 987 | revlist) | 999 | revlist) |
| 988 | (while args | 1000 | (while args |
| 989 | (let ((elts (car args))) | 1001 | (let ((elts (car args))) |
| @@ -1001,9 +1013,9 @@ without changing their position code(s)." | |||
| 1001 | (setq to-i (1+ to-i) to-rev (cdr to-rev))) | 1013 | (setq to-i (1+ to-i) to-rev (cdr to-rev))) |
| 1002 | (if (and (/= from-i to-i) (/= to-i 0)) | 1014 | (if (and (/= from-i to-i) (/= to-i 0)) |
| 1003 | (error "Invalid character pair (%d . %d)" from to)) | 1015 | (error "Invalid character pair (%d . %d)" from to)) |
| 1004 | ;; If we have already unified TO to TO-ALT, FROM should | 1016 | ;; If we have already translated TO to TO-ALT, FROM should |
| 1005 | ;; also be unified to TO-ALT. But, this is only if TO is | 1017 | ;; also be translated to TO-ALT. But, this is only if TO |
| 1006 | ;; a generic character or TO-ALT is not a generic | 1018 | ;; is a generic character or TO-ALT is not a generic |
| 1007 | ;; character. | 1019 | ;; character. |
| 1008 | (let ((to-alt (aref table to))) | 1020 | (let ((to-alt (aref table to))) |
| 1009 | (if (and to-alt | 1021 | (if (and to-alt |
| @@ -1012,8 +1024,8 @@ without changing their position code(s)." | |||
| 1012 | (if (> from-i 0) | 1024 | (if (> from-i 0) |
| 1013 | (set-char-table-default table from to) | 1025 | (set-char-table-default table from to) |
| 1014 | (aset table from to)) | 1026 | (aset table from to)) |
| 1015 | ;; If we have already unified some chars to FROM, they | 1027 | ;; If we have already translated some chars to FROM, they |
| 1016 | ;; should also be unified to TO. | 1028 | ;; should also be translated to TO. |
| 1017 | (let ((l (assq from revlist))) | 1029 | (let ((l (assq from revlist))) |
| 1018 | (if l | 1030 | (if l |
| 1019 | (let ((ch (car l))) | 1031 | (let ((ch (car l))) |
| @@ -1032,33 +1044,35 @@ without changing their position code(s)." | |||
| 1032 | ;; Return TABLE just created. | 1044 | ;; Return TABLE just created. |
| 1033 | table)) | 1045 | table)) |
| 1034 | 1046 | ||
| 1035 | (defun define-character-unification-table (symbol &rest args) | 1047 | (defun define-character-translation-table (symbol &rest args) |
| 1036 | "define character unification table. This function call make-unification-table, | 1048 | "Define SYMBOL as a name of character translation table makde by ARGS. |
| 1037 | store a returned table to character-unification-table-vector. | 1049 | |
| 1038 | And then set the table as SYMBOL's unification-table property, | 1050 | See the documentation of the function `make-translation-table' for the |
| 1039 | the index of the vector as SYMBOL's unification-table-id." | 1051 | meaning of ARGS. |
| 1040 | (let ((table (apply 'make-unification-table args)) | 1052 | |
| 1041 | (len (length character-unification-table-vector)) | 1053 | This function sets properties character-translation-table and |
| 1054 | character-translation-table-id of SYMBOL to the created table itself | ||
| 1055 | and identification number of the table respectively." | ||
| 1056 | (let ((table (apply 'make-translation-table args)) | ||
| 1057 | (len (length character-translation-table-vector)) | ||
| 1042 | (id 0) | 1058 | (id 0) |
| 1043 | slot) | 1059 | (done nil)) |
| 1044 | (or (symbolp symbol) | 1060 | (put symbol 'character-translation-table table) |
| 1045 | (signal 'wrong-type-argument symbol)) | 1061 | (while (not done) |
| 1046 | (put symbol 'unification-table table) | 1062 | (if (>= id len) |
| 1047 | (while (and (< id len) | 1063 | (setq character-translation-table-vector |
| 1048 | (if (consp (setq slot (aref character-unification-table-vector id))) | 1064 | (vconcat character-translation-table-vector |
| 1049 | (if (eq (car slot) symbol) nil t) | 1065 | (make-vector len nil)))) |
| 1050 | (aset character-unification-table-vector id (cons symbol table)) | 1066 | (let ((slot (aref character-translation-table-vector id))) |
| 1051 | nil)) | 1067 | (if (or (not slot) |
| 1068 | (eq (car slot) symbol)) | ||
| 1069 | (progn | ||
| 1070 | (aset character-translation-table-vector id (cons symbol table)) | ||
| 1071 | (setq done t)))) | ||
| 1052 | (setq id (1+ id))) | 1072 | (setq id (1+ id))) |
| 1053 | (if (= id len) | 1073 | (put symbol 'character-translation-table-id id) |
| 1054 | (progn | ||
| 1055 | (setq character-unification-table-vector | ||
| 1056 | (vconcat character-unification-table-vector (make-vector len nil))) | ||
| 1057 | (aset character-unification-table-vector id (cons symbol table)))) | ||
| 1058 | (put symbol 'unification-table-id id) | ||
| 1059 | id)) | 1074 | id)) |
| 1060 | 1075 | ||
| 1061 | |||
| 1062 | ;;; Initialize some variables. | 1076 | ;;; Initialize some variables. |
| 1063 | 1077 | ||
| 1064 | (put 'use-default-ascent 'char-table-extra-slots 0) | 1078 | (put 'use-default-ascent 'char-table-extra-slots 0) |