changeset 41983:8acbb96a91c3

(make-translation-table-from-vector): Allow null elements in VEC.
author Dave Love <fx@gnu.org>
date Wed, 12 Dec 2001 19:55:31 +0000
parents 21b646d266aa
children 647bc167565a
files lisp/international/mule.el
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule.el	Wed Dec 12 19:17:44 2001 +0000
+++ b/lisp/international/mule.el	Wed Dec 12 19:55:31 2001 +0000
@@ -1,8 +1,8 @@
 ;;; mule.el --- basic commands for mulitilingual environment
 
 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
+;; Licensed to the Free Software Foundation.
 ;; Copyright (C) 2001 Free Software Foundation, Inc.
-;; Licensed to the Free Software Foundation.
 
 ;; Keywords: mule, multilingual, character set, coding system
 
@@ -1653,18 +1653,18 @@
 
 (defun make-translation-table-from-vector (vec)
   "Make translation table from decoding vector VEC.
-VEC is an array of 256 elements to map unibyte codes to multibyte characters.
+VEC is an array of 256 elements to map unibyte codes to multibyte
+characters.  Elements may be nil for undefined code points.
 See also the variable `nonascii-translation-table'."
   (let ((table (make-char-table 'translation-table))
 	(rev-table (make-char-table 'translation-table))
-	(i 0)
 	ch)
-    (while (< i 256)
+    (dotimes (i 256)
       (setq ch (aref vec i))
-      (aset table i ch)
-      (if (>= ch 256)
-	  (aset rev-table ch i))
-      (setq i (1+ i)))
+      (when ch
+	(aset table i ch)
+	(if (>= ch 256)
+	    (aset rev-table ch i))))
     (set-char-table-extra-slot table 0 rev-table)
     table))