1 |
;;; ucs-tables.el --- translation to, from and via Unicode -*- coding: iso-2022-7bit -*- |
;;; ucs-tables.el --- translation to, from and via Unicode -*- coding: iso-2022-7bit -*- |
2 |
|
|
3 |
;; Copyright (C) 2001 Free Software Foundation, Inc. |
;; Copyright (C) 2001, 2002 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Dave Love <fx@gnu.org> |
;; Author: Dave Love <fx@gnu.org> |
6 |
;; Keywords: i18n |
;; Keywords: i18n |
25 |
;;; Commentary: |
;;; Commentary: |
26 |
|
|
27 |
;; This file provides tables mapping between Unicode numbers and |
;; This file provides tables mapping between Unicode numbers and |
28 |
;; emacs-mule characters from the iso-8859 charsets (and others). It |
;; emacs-mule characters from the iso8859 charsets (and others). It |
29 |
;; also provides some auxiliary functions. |
;; also provides some auxiliary functions. |
30 |
|
|
31 |
;; These tables are used to construct other mappings between the Mule |
;; These tables are used to construct other mappings between the Mule |
1159 |
(interactive "P") |
(interactive "P") |
1160 |
(unless encode-only |
(unless encode-only |
1161 |
;; Unify 8859 on decoding. (Non-CCL coding systems only.) |
;; Unify 8859 on decoding. (Non-CCL coding systems only.) |
1162 |
(set-char-table-parent standard-translation-table-for-decode |
(unify-8859-on-decoding-mode 1)) |
|
ucs-mule-8859-to-mule-unicode)) |
|
1163 |
;; Adjust the 8859 coding systems to fragment the unified characters |
;; Adjust the 8859 coding systems to fragment the unified characters |
1164 |
;; on encoding. |
;; on encoding. |
1165 |
(dolist (n '(1 2 3 4 5 7 8 9 14 15)) |
(dolist (n '(1 2 3 4 5 7 8 9 14 15)) |
1235 |
;; Maybe fix decoding. |
;; Maybe fix decoding. |
1236 |
(unless encode-only |
(unless encode-only |
1237 |
;; Unify 8859 on decoding. (Non-CCL coding systems only.) |
;; Unify 8859 on decoding. (Non-CCL coding systems only.) |
1238 |
(set-char-table-parent standard-translation-table-for-decode nil)) |
(unify-8859-on-decoding-mode -1)) |
1239 |
;; Fix encoding. For each charset, remove the entries in |
;; Fix encoding. For each charset, remove the entries in |
1240 |
;; `char-coding-system-table' added to its safe-chars table (as its |
;; `char-coding-system-table' added to its safe-chars table (as its |
1241 |
;; parent). |
;; parent). |
1294 |
`iso-latin-1' and `mule-unicode-0100-24ff' charsets. |
`iso-latin-1' and `mule-unicode-0100-24ff' charsets. |
1295 |
|
|
1296 |
This sets the parent of `standard-translation-table-for-decode'. |
This sets the parent of `standard-translation-table-for-decode'. |
1297 |
|
Also sets `translation-table-for-input' globally, so that Quail input |
1298 |
|
methods produce unified characters. |
1299 |
|
|
1300 |
See also command `unify-8859-on-encoding-mode'." |
See also command `unify-8859-on-encoding-mode'." |
1301 |
:group 'mule |
:group 'mule |
1302 |
:global t |
:global t |
1303 |
:version 21.3 ; who knows...? |
:version 21.3 ; who knows...? |
1304 |
:init-value nil |
:init-value nil |
1305 |
(if unify-8859-on-decoding-mode |
(let ((table (if unify-8859-on-decoding-mode ucs-mule-8859-to-mule-unicode))) |
1306 |
(set-char-table-parent standard-translation-table-for-decode |
(set-char-table-parent standard-translation-table-for-decode table) |
1307 |
ucs-mule-8859-to-mule-unicode) |
(setq-default translation-table-for-input table))) |
|
(set-char-table-parent standard-translation-table-for-decode nil))) |
|
1308 |
|
|
1309 |
(defun ucs-insert (arg) |
(defun ucs-insert (arg) |
1310 |
"Insert the Emacs character representation of the given Unicode. |
"Insert the Emacs character representation of the given Unicode. |
1311 |
Interactively, prompts for a hex string giving the code." |
Interactively, prompts for a hex string giving the code." |
1312 |
(interactive "sUnicode (hex): ") |
(interactive "sUnicode (hex): ") |
1313 |
(insert (decode-char 'ucs (if (integerp arg) |
(insert (or (decode-char 'ucs (if (integerp arg) |
1314 |
arg |
arg |
1315 |
(string-to-number arg 16))))) |
(string-to-number arg 16))) |
1316 |
|
(error "Unknown Unicode character")))) |
1317 |
|
|
1318 |
;;; Dealing with non-8859 character sets. |
;;; Dealing with non-8859 character sets. |
1319 |
|
|