mel of MEL 3.3.
[elisp/flim.git] / mel.el
1 ;;;
2 ;;; mel.el : a MIME encoding/decoding library
3 ;;;
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995,1996 MORIOKA Tomohiko
6 ;;;
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; Created: 1995/6/25
10 ;;; Version:
11 ;;;     $Id: mel.el,v 3.3 1996/01/09 18:31:08 morioka Exp $
12 ;;; Keywords: MIME, Quoted-Printable
13 ;;;
14 ;;; This file is part of MEL (MIME Encoding Library).
15 ;;;
16 ;;; This program is free software; you can redistribute it and/or
17 ;;; modify it under the terms of the GNU General Public License as
18 ;;; published by the Free Software Foundation; either version 2, or
19 ;;; (at your option) any later version.
20 ;;;
21 ;;; This program is distributed in the hope that it will be useful,
22 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24 ;;; General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with This program.  If not, write to the Free Software
28 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
29 ;;;
30 ;;; Code:
31
32 (autoload 'base64-encode-region "mel-b" nil t)
33 (autoload 'base64-decode-region "mel-b" nil t)
34 (autoload 'base64-encode-string "mel-b")
35 (autoload 'base64-decode-string "mel-b")
36 (autoload 'base64-encoded-length "mel-b")
37
38 (autoload 'quoted-printable-encode-region "mel-q" nil t)
39 (autoload 'quoted-printable-decode-region "mel-q" nil t)
40
41 (autoload 'q-encoding-encode-string-for-text "mel-q")
42 (autoload 'q-encoding-encode-string-for-comment "mel-q")
43 (autoload 'q-encoding-encode-string-for-phrase "mel-q")
44 (autoload 'q-encoding-encode-string "mel-q")
45 (autoload 'q-encoding-decode-string "mel-q")
46 (autoload 'q-encoding-encoded-length "mel-q")
47
48 (autoload 'uuencode-encode-region "mel-u" nil t)
49 (autoload 'uuencode-decode-region "mel-u" nil t)
50
51 (defvar mime-encoding-method-alist
52   '(("base64"           . base64-encode-region)
53     ("quoted-printable" . quoted-printable-encode-region)
54     ("x-uue"            . uuencode-encode-region)
55     ("7bit")
56     ("8bit")
57     ("binary")
58     ))
59
60 (defvar mime-decoding-method-alist
61   '(("base64"           . base64-decode-region)
62     ("quoted-printable" . quoted-printable-decode-region)
63     ("x-uue"            . uuencode-decode-region)
64     ))
65
66
67 ;;; @ region
68 ;;;
69
70 (defun mime/encode-region (encoding beg end)
71   "Encode region BEG to END of current buffer using ENCODING. [mel.el]"
72   (interactive
73    (list (completing-read "encoding: "
74                           mime-encoding-method-alist
75                           nil t "base64")
76          (region-beginning) (region-end))
77    )
78   (let ((f (cdr (assoc encoding mime-encoding-method-alist))))
79     (if f
80         (funcall f beg end)
81       )))
82
83 (defun mime/decode-region (encoding beg end)
84   "Decode region BEG to END of current buffer using ENCODING. [mel.el]"
85   (interactive
86    (list (completing-read "encoding: "
87                           mime-decoding-method-alist
88                           nil t "base64")
89          (region-beginning) (region-end))
90    )
91   (let ((f (cdr (assoc encoding mime-decoding-method-alist))))
92     (if f
93         (funcall f beg end)
94       )))
95
96 (defalias 'mime-encode-region 'mime/encode-region)
97 (defalias 'mime-decode-region 'mime/decode-region)
98
99
100 ;;; @ end
101 ;;;
102
103 (provide 'mel)