* pccl-20.el: Do not require 'poem.
[elisp/apel.git] / mcharset.el
1 ;;; mcharset.el --- MIME charset API
2
3 ;; Copyright (C) 1997,1998 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: emulation, compatibility, Mule
7
8 ;; This file is part of APEL (A Portable Emacs Library).
9
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
14
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Code:
26
27 (require 'poe)
28
29 (cond ((featurep 'mule)
30        (cond ((featurep 'xemacs)
31               (require 'mcs-xm)
32               )
33              ((>= emacs-major-version 20)
34               (require 'mcs-e20)
35               )
36              (t
37               ;; for MULE 1.* and 2.*
38               (require 'mcs-om)
39               ))
40        )
41       ((boundp 'NEMACS)
42        ;; for Nemacs and Nepoch
43        (require 'mcs-nemacs)
44        )
45       (t
46        (require 'mcs-ltn1)
47        ))
48
49
50 (defun charsets-to-mime-charset (charsets)
51   "Return MIME charset from list of charset CHARSETS.
52 This function refers variable `charsets-mime-charset-alist'
53 and `default-mime-charset'."
54   (if charsets
55       (or (catch 'tag
56             (let ((rest charsets-mime-charset-alist)
57                   cell)
58               (while (setq cell (car rest))
59                 (if (catch 'not-subset
60                       (let ((set1 charsets)
61                             (set2 (car cell))
62                             obj)
63                         (while set1
64                           (setq obj (car set1))
65                           (or (memq obj set2)
66                               (throw 'not-subset nil))
67                           (setq set1 (cdr set1)))
68                         t))
69                     (throw 'tag (cdr cell)))
70                 (setq rest (cdr rest)))))
71           default-mime-charset)))
72
73
74 ;;; @ end
75 ;;;
76
77 (provide 'mcharset)
78
79 ;;; mcharset.el ends here