tm 7.56.
[elisp/tm.git] / tm-def.el
index 5de868a..d554a8b 100644 (file)
--- a/tm-def.el
+++ b/tm-def.el
@@ -6,7 +6,7 @@
 ;;;
 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;;; Version:
-;;;    $Id: tm-def.el,v 7.35 1996/04/25 14:29:51 morioka Exp $
+;;;    $Id: tm-def.el,v 7.36 1996/04/27 15:30:29 morioka Exp $
 ;;; Keywords: mail, news, MIME, multimedia, definition
 ;;;
 ;;; This file is part of tm (Tools for MIME).
 ;;;
 
 (defvar mime/charset-coding-system-alist
-  (foldr (function
-         (lambda (a cell)
-           (if (boundp (cdr cell))
-               (cons (cons (car cell) (symbol-value (cdr cell))) a)
-             a)))
-        nil
-        '(("ISO-2022-JP"     . *junet*)
-          ("ISO-2022-KR"     . *iso-2022-kr*)
-          ("EUC-KR"          . *euc-kr*)
-          ("ISO-8859-1"      . *ctext*)
-          ("ISO-8859-2"      . *iso-8859-2*)
-          ("ISO-8859-3"      . *iso-8859-3*)
-          ("ISO-8859-4"      . *iso-8859-4*)
-          ("ISO-8859-5"      . *iso-8859-5*)
-          ("KOI8-R"          . *koi8*)
-          ("ISO-8859-7"      . *iso-8859-7*)
-          ("ISO-8859-8"      . *iso-8859-8*)
-          ("ISO-8859-9"      . *iso-8859-9*)
-          ("ISO-2022-JP-2"   . *iso-2022-ss2-7*)
-          ("X-ISO-2022-JP-2" . *iso-2022-ss2-7*)
-          ("ISO-2022-INT-1"  . *iso-2022-int-1*)
-          ("SHIFT_JIS"       . *sjis*)
-          ("X-SHIFTJIS"      . *sjis*)
-          ("BIG5"            . *big5*)
-          )))
+  (let* (csl
+        (f (if (and running-xemacs-20 (featurep 'mule))
+               (progn
+                 (setq csl (coding-system-list))
+                 (function
+                  (lambda (a cell)
+                    (if (memq (cdr cell) csl)
+                        (cons cell a)
+                      a))))
+             (function
+              (lambda (a cell)
+                (let ((sym (symbol-concat "*" (cdr cell) "*")))
+                  (if (boundp sym)
+                      (cons (cons (car cell) (symbol-value sym)) a)
+                    a))))
+             )))
+    (foldr f nil
+          '(("ISO-2022-JP"     . junet)
+            ("ISO-2022-KR"     . iso-2022-kr)
+            ("EUC-KR"          . euc-kr)
+            ("ISO-8859-1"      . ctext)
+            ("ISO-8859-2"      . iso-8859-2)
+            ("ISO-8859-3"      . iso-8859-3)
+            ("ISO-8859-4"      . iso-8859-4)
+            ("ISO-8859-5"      . iso-8859-5)
+            ("KOI8-R"          . koi8)
+            ("ISO-8859-7"      . iso-8859-7)
+            ("ISO-8859-8"      . iso-8859-8)
+            ("ISO-8859-9"      . iso-8859-9)
+            ("ISO-2022-JP-2"   . iso-2022-ss2-7)
+            ("X-ISO-2022-JP-2" . iso-2022-ss2-7)
+            ("ISO-2022-INT-1"  . iso-2022-int-1)
+            ("SHIFT_JIS"       . sjis)
+            ("X-SHIFTJIS"      . sjis)
+            ("BIG5"            . big5)
+            ))))
 
 (defvar mime/default-coding-system *ctext*)
 
 (defun mime/convert-string-to-emacs (str charset)
   (let ((cs (assoc charset mime/charset-coding-system-alist)))
     (if cs
-       (code-convert-string str (cdr cs) *internal*)
+       (decode-coding-string str (cdr cs))
       )))
 
 (defun mime/convert-string-from-emacs (str charset)
   (let ((cs (assoc charset mime/charset-coding-system-alist)))
     (if cs
-       (code-convert-string str *internal* (cdr cs))
+       (encode-coding-string str (cdr cs))
       )))
 
 (defun mime/code-convert-region-to-emacs (beg end charset &optional encoding)
             (cdr (assoc (upcase charset) mime/charset-coding-system-alist))
           mime/default-coding-system)))
     (if ct
-       (code-convert-region beg end ct *internal*)
+       (decode-coding-region beg end ct)
       )))
 
 (defun mime/code-convert-region-from-emacs (beg end charset &optional encoding)
             (cdr (assoc (upcase charset) mime/charset-coding-system-alist))
           mime/default-coding-system)))
     (if ct
-       (code-convert-region beg end *internal* ct)
+       (encode-coding-region beg end ct)
       )))