changeset 68331:a7c2303e1399

(make-subsidiary-coding-system): Reset `coding-system-define-form' property of subsidiaries to nil. Avoid duplicated entry in coding-system-alist. (make-coding-system): Avoid duplicated entry in coding-system-alist. (define-coding-system-alias): Likewise.
author Kenichi Handa <handa@m17n.org>
date Sun, 22 Jan 2006 12:24:02 +0000
parents 837772085003
children a6ef676caa6d
files lisp/international/mule.el
diffstat 1 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule.el	Sun Jan 22 12:19:11 2006 +0000
+++ b/lisp/international/mule.el	Sun Jan 22 12:24:02 2006 +0000
@@ -620,16 +620,16 @@
 	(subsidiaries (vector (intern (format "%s-unix" coding-system))
 			      (intern (format "%s-dos" coding-system))
 			      (intern (format "%s-mac" coding-system))))
-	(i 0)
-	temp)
-    (while (< i 3)
-      (put (aref subsidiaries i) 'coding-system coding-spec)
-      (put (aref subsidiaries i) 'eol-type i)
-      (add-to-coding-system-list (aref subsidiaries i))
-      (setq coding-system-alist
-	    (cons (list (symbol-name (aref subsidiaries i)))
-		  coding-system-alist))
-      (setq i (1+ i)))
+	elt)
+    (dotimes (i 3)
+      (setq elt (aref subsidiaries i))
+      (put elt 'coding-system coding-spec)
+      (put elt 'eol-type i)
+      (put elt 'coding-system-define-form nil)
+      (add-to-coding-system-list elt)
+      (or (assoc (symbol-name elt) coding-system-alist)
+	  (setq coding-system-alist
+		(cons (list (symbol-name elt)) coding-system-alist))))
     subsidiaries))
 
 (defun transform-make-coding-system-args (name type &optional doc-string props)
@@ -1082,8 +1082,9 @@
   ;; At last, register CODING-SYSTEM in `coding-system-list' and
   ;; `coding-system-alist'.
   (add-to-coding-system-list coding-system)
-  (setq coding-system-alist (cons (list (symbol-name coding-system))
-				  coding-system-alist))
+  (or (assoc (symbol-name coding-system) coding-system-alist)
+      (setq coding-system-alist (cons (list (symbol-name coding-system))
+				      coding-system-alist)))
 
   ;; For a coding system of cateogory iso-8-1 and iso-8-2, create
   ;; XXX-with-esc variants.
@@ -1114,8 +1115,9 @@
   (put alias 'coding-system (coding-system-spec coding-system))
   (put alias 'coding-system-define-form nil)
   (add-to-coding-system-list alias)
-  (setq coding-system-alist (cons (list (symbol-name alias))
-				  coding-system-alist))
+  (or (assoc (symbol-name alias) coding-system-alist)
+      (setq coding-system-alist (cons (list (symbol-name alias))
+				      coding-system-alist)))
   (let ((eol-type (coding-system-eol-type coding-system)))
     (if (vectorp eol-type)
 	(progn