From: morioka Date: Tue, 6 Oct 1998 15:47:39 +0000 (+0000) Subject: (coding-system-to-mime-charset): New function. X-Git-Tag: apel-9_1~4 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=028caf63058d5a78f65c79a41bfe938589f3f9cf;p=elisp%2Fapel.git (coding-system-to-mime-charset): New function. (mime-charset-list): New implementation. --- diff --git a/mcs-e20.el b/mcs-e20.el index a2dc36d..f46d491 100644 --- a/mcs-e20.el +++ b/mcs-e20.el @@ -102,6 +102,29 @@ )) +(defun coding-system-to-mime-charset (coding-system) + "Convert CODING-SYSTEM to a MIME-charset. +Return nil if corresponding MIME-charset is not found." + (or (car (rassq coding-system mime-charset-coding-system-alist)) + (coding-system-get coding-system 'mime-charset))) + +(defun mime-charset-list () + "Return a list of all existing MIME-charset." + (let ((dest (mapcar (function car) mime-charset-coding-system-alist)) + (rest coding-system-list) + cs) + (while rest + (setq cs (car rest)) + (unless (rassq cs mime-charset-coding-system-alist) + (if (setq cs (coding-system-get cs 'mime-charset)) + (or (rassq cs mime-charset-coding-system-alist) + (memq cs dest) + (setq dest (cons cs dest)) + ))) + (setq rest (cdr rest))) + dest)) + + ;;; @ end ;;; diff --git a/mcs-xm.el b/mcs-xm.el index 09789a9..fdc565d 100644 --- a/mcs-xm.el +++ b/mcs-xm.el @@ -57,7 +57,8 @@ ))) (defcustom mime-iso646-character-unification-alist - `,(let (dest + (eval-when-compile + (let (dest (i 33)) (while (< i 92) (setq dest @@ -72,7 +73,7 @@ (format "%c" i)) dest)) (setq i (1+ i))) - (nreverse dest)) + (nreverse dest))) "Alist unified string vs. canonical string." :group 'i18n :type '(repeat (cons string string))) @@ -176,6 +177,28 @@ )) +(defun coding-system-to-mime-charset (coding-system) + "Convert CODING-SYSTEM to a MIME-charset. +Return nil if corresponding MIME-charset is not found." + (setq coding-system + (coding-system-name (coding-system-base coding-system))) + (or (car (rassq coding-system mime-charset-coding-system-alist)) + coding-system)) + +(defun mime-charset-list () + "Return a list of all existing MIME-charset." + (let ((dest (mapcar (function car) mime-charset-coding-system-alist)) + (rest (coding-system-list)) + cs) + (while rest + (setq cs (coding-system-name (coding-system-base (car rest)))) + (or (rassq cs mime-charset-coding-system-alist) + (memq cs dest) + (setq dest (cons cs dest))) + (setq rest (cdr rest))) + dest)) + + ;;; @ end ;;;