comparison lisp/mel/mel.el @ 4:b82b59fe008d r19-15b3

Import from CVS: tag r19-15b3
author cvs
date Mon, 13 Aug 2007 08:46:56 +0200
parents
children 4b173ad71786
comparison
equal deleted inserted replaced
3:30df88044ec6 4:b82b59fe008d
1 ;;; mel.el : a MIME encoding/decoding library
2
3 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; modified by Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
7 ;; Created: 1995/6/25
8 ;; Version: $Id: mel.el,v 1.1.1.1 1996/12/18 03:55:30 steve Exp $
9 ;; Keywords: MIME, Base64, Quoted-Printable, uuencode, gzip64
10
11 ;; This file is part of MEL (MIME Encoding Library).
12
13 ;; This program is free software; you can redistribute it and/or
14 ;; modify it under the terms of the GNU General Public License as
15 ;; published by the Free Software Foundation; either version 2, or (at
16 ;; your option) any later version.
17
18 ;; This program is distributed in the hope that it will be useful, but
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ;; General Public License for more details.
22
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
27
28 ;;; Code:
29
30 ;;; @ region
31 ;;;
32
33 (autoload 'base64-encode-region "mel-b" nil t)
34 (autoload 'quoted-printable-encode-region "mel-q" nil t)
35 (autoload 'uuencode-encode-region "mel-u" nil t)
36 (autoload 'gzip64-encode-region "mel-g" nil t)
37
38 (defvar mime-encoding-method-alist
39 '(("base64" . base64-encode-region)
40 ("quoted-printable" . quoted-printable-encode-region)
41 ("x-uue" . uuencode-encode-region)
42 ("x-gzip64" . gzip64-encode-region)
43 ("7bit")
44 ("8bit")
45 ("binary")
46 ))
47
48 (autoload 'base64-decode-region "mel-b" nil t)
49 (autoload 'quoted-printable-decode-region "mel-q" nil t)
50 (autoload 'uuencode-decode-region "mel-u" nil t)
51 (autoload 'gzip64-decode-region "mel-g" nil t)
52
53 (defvar mime-decoding-method-alist
54 '(("base64" . base64-decode-region)
55 ("quoted-printable" . quoted-printable-decode-region)
56 ("x-uue" . uuencode-decode-region)
57 ("x-gzip64" . gzip64-decode-region)
58 ))
59
60 (defun mime-encode-region (beg end encoding)
61 "Encode region BEG to END of current buffer using ENCODING. [mel.el]"
62 (interactive
63 (list (region-beginning) (region-end)
64 (completing-read "encoding: "
65 mime-encoding-method-alist
66 nil t "base64"))
67 )
68 (let ((f (cdr (assoc encoding mime-encoding-method-alist))))
69 (if f
70 (funcall f beg end)
71 )))
72
73 (defun mime-decode-region (beg end encoding)
74 "Decode region BEG to END of current buffer using ENCODING. [mel.el]"
75 (interactive
76 (list (region-beginning) (region-end)
77 (completing-read "encoding: "
78 mime-decoding-method-alist
79 nil t "base64"))
80 )
81 (let ((f (cdr (assoc encoding mime-decoding-method-alist))))
82 (if f
83 (funcall f beg end)
84 )))
85
86
87 ;;; @ file
88 ;;;
89
90 (autoload 'base64-insert-encoded-file "mel-b" nil t)
91 (autoload 'quoted-printable-insert-encoded-file "mel-q" nil t)
92 (autoload 'uuencode-insert-encoded-file "mel-u" nil t)
93 (autoload 'gzip64-insert-encoded-file "mel-g" nil t)
94
95 (defvar mime-file-encoding-method-alist
96 '(("base64" . base64-insert-encoded-file)
97 ("quoted-printable" . quoted-printable-insert-encoded-file)
98 ("x-uue" . uuencode-insert-encoded-file)
99 ("x-gzip64" . gzip64-insert-encoded-file)
100 ("7bit" . insert-binary-file-contents-literally)
101 ("8bit" . insert-binary-file-contents-literally)
102 ("binary" . insert-binary-file-contents-literally)
103 ))
104
105 (defun mime-insert-encoded-file (filename encoding)
106 "Encode region BEG to END of current buffer using ENCODING. [mel.el]"
107 (interactive
108 (list (read-file-name "Insert encoded file: ")
109 (completing-read "encoding: "
110 mime-encoding-method-alist
111 nil t "base64"))
112 )
113 (let ((f (cdr (assoc encoding mime-file-encoding-method-alist))))
114 (if f
115 (funcall f filename)
116 )))
117
118
119 ;;; @ string
120 ;;;
121
122 (autoload 'base64-encode-string "mel-b")
123 (autoload 'base64-decode-string "mel-b")
124
125 (autoload 'q-encoding-encode-string-for-text "mel-q")
126 (autoload 'q-encoding-encode-string-for-comment "mel-q")
127 (autoload 'q-encoding-encode-string-for-phrase "mel-q")
128 (autoload 'q-encoding-encode-string "mel-q")
129 (autoload 'q-encoding-decode-string "mel-q")
130
131 (autoload 'base64-encoded-length "mel-b")
132 (autoload 'q-encoding-encoded-length "mel-q")
133
134
135 ;;; @ end
136 ;;;
137
138 (provide 'mel)
139
140 ;;; mel.el ends here.