From 3701925fd0ba4d7e9543f64d34fb426a3ab1f7e5 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 1 Aug 2002 06:55:47 +0000 Subject: [PATCH] * mcs-om.el (mime-charset-coding-system-alist): Move forward. (mime-charset-to-coding-system): Move forward. --- ChangeLog | 3 +++ mcs-om.el | 75 +++++++++++++++++++++++++++---------------------------------- 2 files changed, 36 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 325a7d5..da73356 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2002-08-01 Katsumi Yamaoka + * mcs-om.el (mime-charset-coding-system-alist): Move forward. + (mime-charset-to-coding-system): Move forward. + * pym.el (def*-maybe-enable-compile-time-hack): Bind it when compiling. Suggested by Shuhei KOBAYASHI. (defun-when-void): Modify the arglist to follow the XEmacs style. diff --git a/mcs-om.el b/mcs-om.el index 17f6ec1..4ddb1b5 100644 --- a/mcs-om.el +++ b/mcs-om.el @@ -26,13 +26,44 @@ (require 'poem) +(condition-case nil + (require 'cyrillic) + (error nil)) + +(defvar mime-charset-coding-system-alist + '((iso-8859-1 . *ctext*) + (x-ctext . *ctext*) + (gb2312 . *euc-china*) + (koi8-r . *koi8*) + (iso-2022-jp-2 . *iso-2022-ss2-7*) + (x-iso-2022-jp-2 . *iso-2022-ss2-7*) + (shift_jis . *sjis*) + (x-shiftjis . *sjis*))) + +(defsubst mime-charset-to-coding-system (charset &optional lbt) + "Return coding-system corresponding with CHARSET. +CHARSET is a symbol whose name is MIME charset. +If optional argument LBT (`CRLF', `LF', `CR', `unix', `dos' or `mac') +is specified, it is used as line break code type of coding-system." + (if (stringp charset) + (setq charset (intern (downcase charset)))) + (setq charset (or (cdr (assq charset mime-charset-coding-system-alist)) + (intern (concat "*" (symbol-name charset) "*")))) + (if lbt + (setq charset (intern (format "%s%s" charset + (cond ((eq lbt 'CRLF) 'dos) + ((eq lbt 'LF) 'unix) + ((eq lbt 'CR) 'mac) + (t lbt)))))) + (if (coding-system-p charset) + charset)) + (defsubst lbt-to-string (lbt) (cdr (assq lbt '((nil . nil) (CRLF . "\r\n") (CR . "\r") (dos . "\r\n") - (mac . "\r")))) - ) + (mac . "\r"))))) (defun encode-mime-charset-region (start end charset &optional lbt) "Encode the text between START and END as MIME CHARSET." @@ -126,46 +157,6 @@ )) -;;; @ to coding-system -;;; - -(condition-case nil - (require 'cyrillic) - (error nil)) - -(defvar mime-charset-coding-system-alist - '((iso-8859-1 . *ctext*) - (x-ctext . *ctext*) - (gb2312 . *euc-china*) - (koi8-r . *koi8*) - (iso-2022-jp-2 . *iso-2022-ss2-7*) - (x-iso-2022-jp-2 . *iso-2022-ss2-7*) - (shift_jis . *sjis*) - (x-shiftjis . *sjis*) - )) - -(defsubst mime-charset-to-coding-system (charset &optional lbt) - "Return coding-system corresponding with CHARSET. -CHARSET is a symbol whose name is MIME charset. -If optional argument LBT (`CRLF', `LF', `CR', `unix', `dos' or `mac') -is specified, it is used as line break code type of coding-system." - (if (stringp charset) - (setq charset (intern (downcase charset))) - ) - (setq charset (or (cdr (assq charset mime-charset-coding-system-alist)) - (intern (concat "*" (symbol-name charset) "*")))) - (if lbt - (setq charset (intern (format "%s%s" charset - (cond ((eq lbt 'CRLF) 'dos) - ((eq lbt 'LF) 'unix) - ((eq lbt 'CR) 'mac) - (t lbt))))) - ) - (if (coding-system-p charset) - charset - )) - - ;;; @ detection ;;; -- 1.7.10.4