changeset 47385:d46bcfbfdda0

(ucs-mule-to-mule-unicode): Define unconditionally. (utf-8-fragmentation-table): New. Use it in top-level mapc. (utf-8-fragment-on-decoding): Use it to keep utf-8-translation-table-for-decode variable and translation table in sync.
author Dave Love <fx@gnu.org>
date Tue, 10 Sep 2002 17:39:35 +0000
parents e83401f8d61c
children 18dd2c15c04c
files lisp/international/utf-8.el
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/utf-8.el	Tue Sep 10 17:37:38 2002 +0000
+++ b/lisp/international/utf-8.el	Tue Sep 10 17:39:35 2002 +0000
@@ -66,10 +66,8 @@
 
 (defvar ucs-mule-to-mule-unicode (make-translation-table)
   "Translation table for encoding to `mule-utf-8'.")
-;; Could have been done by ucs-tables loaded before.
-(unless (get 'ucs-mule-to-mule-unicode 'translation-table)
-  (define-translation-table 'ucs-mule-to-mule-unicode
-    ucs-mule-to-mule-unicode))
+(define-translation-table 'ucs-mule-to-mule-unicode
+  ucs-mule-to-mule-unicode)
 
 (defvar utf-8-subst-table (make-hash-table :test 'eq))
 (defvar utf-8-subst-rev-table (make-hash-table :test 'eq))
@@ -87,9 +85,13 @@
 ;; space of mule-unicode.  For Latin scripts this isn't very
 ;; important.  Hebrew and Arabic might go here too when there's proper
 ;; support for them.
+(defvar utf-8-fragmentation-table (make-translation-table)
+  "Char table normally mapping non-Latin mule-unicode-... characters to iso8859.
+Used as the value of `utf-8-translation-table-for-decode' in
+`utf-8-fragment-on-decoding' mode.")
 (mapc
  (lambda (pair)
-   (aset utf-8-translation-table-for-decode (car pair) (cdr pair)))
+   (aset utf-8-fragmentation-table (car pair) (cdr pair)))
  '((?$,1&d(B . ?,F4(B) (?$,1&e(B . ?,F5(B) (?$,1&f(B . ?,F6(B) (?$,1&h(B . ?,F8(B) (?$,1&i(B . ?,F9(B)
    (?$,1&j(B . ?,F:(B) (?$,1&l(B . ?,F<(B) (?$,1&n(B . ?,F>(B) (?$,1&o(B . ?,F?(B) (?$,1&p(B . ?,F@(B)
    (?$,1&q(B . ?,FA(B) (?$,1&r(B . ?,FB(B) (?$,1&s(B . ?,FC(B) (?$,1&t(B . ?,FD(B) (?$,1&u(B . ?,FE(B)
@@ -138,10 +140,12 @@
 
 Setting this variable outside customize has no effect."
   :set (lambda (s v)
-	 (if v
-	     (define-translation-table 'utf-8-translation-table-for-decode
-	       utf-8-translation-table-for-decode)
-	   (define-translation-table 'utf-8-translation-table-for-decode))
+	 (setq utf-8-translation-table-for-decode
+	       (if v
+		   utf-8-fragmentation-table
+		 (make-char-table)))
+	 (define-translation-table 'utf-8-translation-table-for-decode
+	   utf-8-translation-table-for-decode)
 	 (set-default s v))
   :version "21.4"
   :type 'boolean