Mercurial > emacs
annotate man/emacs-mime.texi @ 33670:bdd68c1ec433
Uncomment @dircategory.
author | Dave Love <fx@gnu.org> |
---|---|
date | Tue, 21 Nov 2000 11:39:43 +0000 |
parents | 4ef19e88da9a |
children | 90acc0606378 |
rev | line source |
---|---|
32085
56bb657c0878
Add coding tag. Fix 7-bit mangling.
Dave Love <fx@gnu.org>
parents:
32008
diff
changeset
|
1 \input texinfo @c -*-mode: texinfo; coding: latin-1 -*- |
31853 | 2 |
32008
a0a62e1e3675
Fix the @setfilename directive.
Eli Zaretskii <eliz@gnu.org>
parents:
31855
diff
changeset
|
3 @setfilename ../info/emacs-mime |
31853 | 4 @settitle Emacs MIME Manual |
5 @synindex fn cp | |
6 @synindex vr cp | |
7 @synindex pg cp | |
8 @dircategory Editors | |
9 @direntry | |
10 * Emacs MIME: (emacs-mime). The MIME de/composition library. | |
11 @end direntry | |
12 @iftex | |
13 @finalout | |
14 @end iftex | |
15 @setchapternewpage odd | |
16 | |
17 @ifnottex | |
18 | |
19 This file documents the Emacs MIME interface functionality. | |
20 | |
21 Copyright (C) 1998,99,2000 Free Software Foundation, Inc. | |
22 | |
23 Permission is granted to copy, distribute and/or modify this document | |
24 under the terms of the GNU Free Documentation License, Version 1.1 or | |
32258 | 25 any later version published by the Free Software Foundation; with no |
26 Invariant Sections, with the Front-Cover texts being ``A GNU | |
31853 | 27 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the |
28 license is included in the section entitled ``GNU Free Documentation | |
32248
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
29 License'' in the Emacs manual. |
31853 | 30 |
31 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify | |
32 this GNU Manual, like GNU software. Copies published by the Free | |
33 Software Foundation raise funds for GNU development.'' | |
32248
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
34 |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
35 This document is part of a collection distributed under the GNU Free |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
36 Documentation License. If you want to distribute this document |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
37 separately from the collection, you can do so by adding a copy of the |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
38 license to the document, as described in section 6 of the license. |
31853 | 39 @end ifnottex |
40 | |
41 @tex | |
42 | |
43 @titlepage | |
44 @title Emacs MIME Manual | |
45 | |
46 @author by Lars Magne Ingebrigtsen | |
47 @page | |
48 | |
49 @vskip 0pt plus 1filll | |
50 Copyright @copyright{} 1998,99,2000 Free Software Foundation, Inc. | |
51 | |
52 Permission is granted to copy, distribute and/or modify this document | |
53 under the terms of the GNU Free Documentation License, Version 1.1 or | |
54 any later version published by the Free Software Foundation; with the | |
55 Invariant Sections being none, with the Front-Cover texts being ``A GNU | |
56 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the | |
57 license is included in the section entitled ``GNU Free Documentation | |
32250 | 58 License'' in the Emacs manual. |
31853 | 59 |
60 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify | |
61 this GNU Manual, like GNU software. Copies published by the Free | |
62 Software Foundation raise funds for GNU development.'' | |
32250 | 63 |
64 This document is part of a collection distributed under the GNU Free | |
65 Documentation License. If you want to distribute this document | |
66 separately from the collection, you can do so by adding a copy of the | |
67 license to the document, as described in section 6 of the license. | |
31853 | 68 @end titlepage |
69 @page | |
70 | |
71 @end tex | |
72 | |
73 @node Top | |
74 @top Emacs MIME | |
75 | |
76 This manual documents the libraries used to compose and display | |
77 @sc{mime} messages. | |
78 | |
79 This is not a manual meant for users; it's a manual directed at people | |
80 who want to write functions and commands that manipulate @sc{mime} | |
81 elements. | |
82 | |
83 @sc{mime} is short for @dfn{Multipurpose Internet Mail Extensions}. | |
84 This standard is documented in a number of RFCs; mainly RFC2045 (Format | |
85 of Internet Message Bodies), RFC2046 (Media Types), RFC2047 (Message | |
86 Header Extensions for Non-ASCII Text), RFC2048 (Registration | |
87 Procedures), RFC2049 (Conformance Criteria and Examples). It is highly | |
88 recommended that anyone who intends writing @sc{mime}-compliant software | |
89 read at least RFC2045 and RFC2047. | |
90 | |
91 @menu | |
92 * Interface Functions:: An abstraction over the basic functions. | |
93 * Basic Functions:: Utility and basic parsing functions. | |
94 * Decoding and Viewing:: A framework for decoding and viewing. | |
95 * Composing:: MML; a language for describing MIME parts. | |
96 * Standards:: A summary of RFCs and working documents used. | |
97 * Index:: Function and variable index. | |
98 @end menu | |
99 | |
100 | |
101 @node Interface Functions | |
102 @chapter Interface Functions | |
103 @cindex interface functions | |
104 @cindex mail-parse | |
105 | |
106 The @code{mail-parse} library is an abstraction over the actual | |
107 low-level libraries that are described in the next chapter. | |
108 | |
109 Standards change, and so programs have to change to fit in the new | |
110 mold. For instance, RFC2045 describes a syntax for the | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
111 @code{Content-Type} header that only allows @sc{ascii} characters in the |
31853 | 112 parameter list. RFC2231 expands on RFC2045 syntax to provide a scheme |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
113 for continuation headers and non-@sc{ascii} characters. |
31853 | 114 |
115 The traditional way to deal with this is just to update the library | |
116 functions to parse the new syntax. However, this is sometimes the wrong | |
117 thing to do. In some instances it may be vital to be able to understand | |
118 both the old syntax as well as the new syntax, and if there is only one | |
119 library, one must choose between the old version of the library and the | |
120 new version of the library. | |
121 | |
122 The Emacs MIME library takes a different tack. It defines a series of | |
123 low-level libraries (@file{rfc2047.el}, @file{rfc2231.el} and so on) | |
124 that parses strictly according to the corresponding standard. However, | |
125 normal programs would not use the functions provided by these libraries | |
126 directly, but instead use the functions provided by the | |
127 @code{mail-parse} library. The functions in this library are just | |
128 aliases to the corresponding functions in the latest low-level | |
129 libraries. Using this scheme, programs get a consistent interface they | |
130 can use, and library developers are free to create write code that | |
131 handles new standards. | |
132 | |
133 The following functions are defined by this library: | |
134 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
135 @defun mail-header-parse-content-type string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
136 Parse @var{string}, a @code{Content-Type} header, and return a |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
137 content-type list in the following format: |
31853 | 138 |
139 @lisp | |
140 ("type/subtype" | |
141 (attribute1 . value1) | |
142 (attribute2 . value2) | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
143 @dots{}) |
31853 | 144 @end lisp |
145 | |
146 Here's an example: | |
147 | |
148 @example | |
149 (mail-header-parse-content-type | |
150 "image/gif; name=\"b980912.gif\"") | |
151 @result{} ("image/gif" (name . "b980912.gif")) | |
152 @end example | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
153 @end defun |
31853 | 154 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
155 @defun mail-header-parse-content-disposition string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
156 Parse @var{string}, a @code{Content-Disposition} header, and return a |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
157 content-type list in the format above. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
158 @end defun |
31853 | 159 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
160 @defun mail-content-type-get ct attribute |
31853 | 161 @findex mail-content-type-get |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
162 Returns the value of the given @var{attribute} from the content-type |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
163 list @var{ct}. |
31853 | 164 |
165 @example | |
166 (mail-content-type-get | |
167 '("image/gif" (name . "b980912.gif")) 'name) | |
168 @result{} "b980912.gif" | |
169 @end example | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
170 @end defun |
31853 | 171 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
172 @defun mail-header-encode-parameter param value |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
173 Takes a parameter string @samp{@var{param}=@var{value}} and returns an |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
174 encoded version of it. This is used for parameters in headers like |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
175 @samp{Content-Type} and @samp{Content-Disposition}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
176 @end defun |
31853 | 177 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
178 @defun mail-header-remove-comments string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
179 Return a comment-free version of @var{string}. |
31853 | 180 |
181 @example | |
182 (mail-header-remove-comments | |
183 "Gnus/5.070027 (Pterodactyl Gnus v0.27) (Finnish Landrace)") | |
184 @result{} "Gnus/5.070027 " | |
185 @end example | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
186 @end defun |
31853 | 187 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
188 @defun mail-header-remove-whitespace string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
189 Remove linear white space from @var{string}. Space inside quoted |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
190 strings and comments is preserved. |
31853 | 191 |
192 @example | |
193 (mail-header-remove-whitespace | |
194 "image/gif; name=\"Name with spaces\"") | |
195 @result{} "image/gif;name=\"Name with spaces\"" | |
196 @end example | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
197 @end defun |
31853 | 198 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
199 @defun mail-header-get-comment string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
200 Return the last comment in @var{string}. |
31853 | 201 |
202 @example | |
203 (mail-header-get-comment | |
204 "Gnus/5.070027 (Pterodactyl Gnus v0.27) (Finnish Landrace)") | |
205 @result{} "Finnish Landrace" | |
206 @end example | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
207 @end defun |
31853 | 208 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
209 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
210 @defun mail-header-parse-address string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
211 Parse an address string @var{string} and return a list containing the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
212 mailbox and the plaintext name. |
31853 | 213 |
214 @example | |
215 (mail-header-parse-address | |
216 "Hrvoje Niksic <hniksic@@srce.hr>") | |
217 @result{} ("hniksic@@srce.hr" . "Hrvoje Niksic") | |
218 @end example | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
219 @end defun |
31853 | 220 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
221 @defun mail-header-parse-addresses string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
222 Parse @var{string} as a list of addresses and return a list of elements |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
223 like the one described above. |
31853 | 224 |
225 @example | |
226 (mail-header-parse-addresses | |
227 "Hrvoje Niksic <hniksic@@srce.hr>, Steinar Bang <sb@@metis.no>") | |
228 @result{} (("hniksic@@srce.hr" . "Hrvoje Niksic") | |
229 ("sb@@metis.no" . "Steinar Bang")) | |
230 @end example | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
231 @end defun |
31853 | 232 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
233 @defun mail-header-parse-date string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
234 Parse a date @var{string} and return an Emacs time structure. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
235 @end defun |
31853 | 236 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
237 @defun mail-narrow-to-head |
31853 | 238 Narrow the buffer to the header section of the buffer. Point is placed |
239 at the beginning of the narrowed buffer. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
240 @end defun |
31853 | 241 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
242 @defun mail-header-narrow-to-field |
31853 | 243 Narrow the buffer to the header under point. |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
244 @end defun |
31853 | 245 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
246 @defun mail-encode-encoded-word-region start end |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
247 Encode the non-@sc{ascii} words in the region @var{start}to @var{end}. For |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
248 instance, @samp{Naïve} is encoded as @samp{=?iso-8859-1?q?Na=EFve?=}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
249 @end defun |
31853 | 250 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
251 @defun mail-encode-encoded-word-buffer |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
252 Encode the non-@sc{ascii} words in the current buffer. This function is |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
253 meant to be called with the buffer narrowed to the headers of a message. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
254 @end defun |
31853 | 255 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
256 @defun mail-encode-encoded-word-string string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
257 Encode the words that need encoding in @var{string}, and return the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
258 result. |
31853 | 259 |
260 @example | |
261 (mail-encode-encoded-word-string | |
32085
56bb657c0878
Add coding tag. Fix 7-bit mangling.
Dave Love <fx@gnu.org>
parents:
32008
diff
changeset
|
262 "This is naïve, baby") |
31853 | 263 @result{} "This is =?iso-8859-1?q?na=EFve,?= baby" |
264 @end example | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
265 @end defun |
31853 | 266 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
267 @defun mail-decode-encoded-word-region start end |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
268 Decode the encoded words in the region @var{start}to @var{end}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
269 @end defun |
31853 | 270 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
271 @defun mail-decode-encoded-word-string string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
272 Decode the encoded words in @var{string} and return the result. |
31853 | 273 |
274 @example | |
275 (mail-decode-encoded-word-string | |
276 "This is =?iso-8859-1?q?na=EFve,?= baby") | |
32085
56bb657c0878
Add coding tag. Fix 7-bit mangling.
Dave Love <fx@gnu.org>
parents:
32008
diff
changeset
|
277 @result{} "This is naïve, baby" |
31853 | 278 @end example |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
279 @end defun |
31853 | 280 |
281 Currently, @code{mail-parse} is an abstraction over @code{ietf-drums}, | |
282 @code{rfc2047}, @code{rfc2045} and @code{rfc2231}. These are documented | |
283 in the subsequent sections. | |
284 | |
285 | |
286 | |
287 @node Basic Functions | |
288 @chapter Basic Functions | |
289 | |
290 This chapter describes the basic, ground-level functions for parsing and | |
291 handling. Covered here is parsing @code{From} lines, removing comments | |
292 from header lines, decoding encoded words, parsing date headers and so | |
293 on. High-level functionality is dealt with in the next chapter | |
294 (@pxref{Decoding and Viewing}). | |
295 | |
296 @menu | |
297 * rfc2045:: Encoding @code{Content-Type} headers. | |
298 * rfc2231:: Parsing @code{Content-Type} headers. | |
299 * ietf-drums:: Handling mail headers defined by RFC822bis. | |
300 * rfc2047:: En/decoding encoded words in headers. | |
301 * time-date:: Functions for parsing dates and manipulating time. | |
302 * qp:: Quoted-Printable en/decoding. | |
303 * base64:: Base64 en/decoding. | |
304 * binhex:: Binhex decoding. | |
305 * uudecode:: Uuencode decoding. | |
306 * rfc1843:: Decoding HZ-encoded text. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
307 * mailcap:: How parts are displayed is specified by mailcap files |
31853 | 308 @end menu |
309 | |
310 | |
311 @node rfc2045 | |
312 @section rfc2045 | |
313 | |
314 RFC2045 is the ``main'' @sc{mime} document, and as such, one would | |
315 imagine that there would be a lot to implement. But there isn't, since | |
316 most of the implementation details are delegated to the subsequent | |
317 RFCs. | |
318 | |
319 So @file{rfc2045.el} has only a single function: | |
320 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
321 @defun rfc2045-encode-string parameter value |
31853 | 322 @findex rfc2045-encode-string |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
323 Takes a @var{parameter} and a @var{value} and returns a |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
324 @samp{@var{param}=@var{value}} string. @var{value} will be quoted if |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
325 there are non-safe characters in it. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
326 @end defun |
31853 | 327 |
328 | |
329 @node rfc2231 | |
330 @section rfc2231 | |
331 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
332 RFC2231 defines a syntax for the @samp{Content-Type} and |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
333 @samp{Content-Disposition} headers. Its snappy name is @dfn{MIME |
31853 | 334 Parameter Value and Encoded Word Extensions: Character Sets, Languages, |
335 and Continuations}. | |
336 | |
337 In short, these headers look something like this: | |
338 | |
339 @example | |
340 Content-Type: application/x-stuff; | |
341 title*0*=us-ascii'en'This%20is%20even%20more%20; | |
342 title*1*=%2A%2A%2Afun%2A%2A%2A%20; | |
343 title*2="isn't it!" | |
344 @end example | |
345 | |
346 They usually aren't this bad, though. | |
347 | |
348 The following functions are defined by this library: | |
349 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
350 @defun rfc2231-parse-string string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
351 Parse a @samp{Content-Type} header @var{string} and return a list |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
352 describing its elements. |
31853 | 353 |
354 @example | |
355 (rfc2231-parse-string | |
356 "application/x-stuff; | |
357 title*0*=us-ascii'en'This%20is%20even%20more%20; | |
358 title*1*=%2A%2A%2Afun%2A%2A%2A%20; | |
359 title*2=\"isn't it!\"") | |
360 @result{} ("application/x-stuff" | |
361 (title . "This is even more ***fun*** isn't it!")) | |
362 @end example | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
363 @end defun |
31853 | 364 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
365 @defun rfc2231-get-value ct attribute |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
366 Takes a list @var{ct} of the format above and returns the value of the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
367 specified @var{attribute}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
368 @end defun |
31853 | 369 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
370 @defun rfc2231-encode-string parameter value |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
371 Encode the string @samp{@var{parameter}=@var{value}} for inclusion in |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
372 headers likes @samp{Content-Type} and @samp{Content-Disposition}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
373 @end defun |
31853 | 374 |
375 @node ietf-drums | |
376 @section ietf-drums | |
377 | |
378 @dfn{drums} is an IETF working group that is working on the replacement | |
379 for RFC822. | |
380 | |
381 The functions provided by this library include: | |
382 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
383 @defun ietf-drums-remove-comments string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
384 Remove the comments from @var{string} and return the result. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
385 @end defun |
31853 | 386 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
387 @defun ietf-drums-remove-whitespace string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
388 Remove linear white space from @var{string} and return the result. |
31853 | 389 Spaces inside quoted strings and comments are left untouched. |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
390 @end defun |
31853 | 391 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
392 @defun ietf-drums-get-comment string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
393 Return the last most comment from @var{string}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
394 @end defun |
31853 | 395 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
396 @defun ietf-drums-parse-address string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
397 Parse an address @var{string} and return a list of the mailbox and the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
398 plain text name. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
399 @end defun |
31853 | 400 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
401 @defun ietf-drums-parse-addresses string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
402 Parse @var{string}, containing any number of comma-separated addresses, |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
403 and return a list of mailbox/plain text pairs. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
404 @end defun |
31853 | 405 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
406 @defun ietf-drums-parse-date string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
407 Parse the date @var{string} and return an Emacs time structure. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
408 @end defun |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
409 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
410 @defun ietf-drums-narrow-to-header |
31853 | 411 Narrow the buffer to the header section of the current buffer. |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
412 @end defun |
31853 | 413 |
414 | |
415 @node rfc2047 | |
416 @section rfc2047 | |
417 | |
418 RFC2047 (Message Header Extensions for Non-ASCII Text) specifies how | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
419 non-@sc{ascii} text in headers are to be encoded. This is actually rather |
31853 | 420 complicated, so a number of variables are necessary to tweak what this |
421 library does. | |
422 | |
423 The following variables are tweakable: | |
424 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
425 @defvar rfc2047-default-charset |
31853 | 426 Characters in this charset should not be decoded by this library. |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
427 This defaults to @samp{iso-8859-1}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
428 @end defvar |
31853 | 429 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
430 @defvar rfc2047-header-encoding-list |
31853 | 431 This is an alist of header / encoding-type pairs. Its main purpose is |
432 to prevent encoding of certain headers. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
433 @end defvar |
31853 | 434 |
435 The keys can either be header regexps, or @code{t}. | |
436 | |
437 The values can be either @code{nil}, in which case the header(s) in | |
438 question won't be encoded, or @code{mime}, which means that they will be | |
439 encoded. | |
440 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
441 @defvar rfc2047-charset-encoding-alist |
31853 | 442 RFC2047 specifies two forms of encoding---@code{Q} (a |
443 Quoted-Printable-like encoding) and @code{B} (base64). This alist | |
444 specifies which charset should use which encoding. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
445 @end defvar |
31853 | 446 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
447 @defvar rfc2047-encoding-function-alist |
31853 | 448 This is an alist of encoding / function pairs. The encodings are |
449 @code{Q}, @code{B} and @code{nil}. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
450 @end defvar |
31853 | 451 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
452 @defvar rfc2047-q-encoding-alist |
31853 | 453 The @code{Q} encoding isn't quite the same for all headers. Some |
454 headers allow a narrower range of characters, and that is what this | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
455 variable is for. It's an alist of header regexps and allowable character |
31853 | 456 ranges. |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
457 @end defvar |
31853 | 458 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
459 @defvar rfc2047-encoded-word-regexp |
31853 | 460 When decoding words, this library looks for matches to this regexp. |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
461 @end defvar |
31853 | 462 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
463 Those were the variables, and these are the functions: |
31853 | 464 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
465 @defun rfc2047-narrow-to-field |
31853 | 466 Narrow the buffer to the header on the current line. |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
467 @end defun |
31853 | 468 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
469 @defun rfc2047-encode-message-header |
31853 | 470 Should be called narrowed to the header of a message. Encodes according |
471 to @code{rfc2047-header-encoding-alist}. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
472 @end defun |
31853 | 473 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
474 @defun rfc2047-encode-region start end |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
475 Encodes all encodable words in the region @var{start} to @var{end}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
476 @end defun |
31853 | 477 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
478 @defun rfc2047-encode-string string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
479 Encode @var{string} and return the result. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
480 @end defun |
31853 | 481 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
482 @defun rfc2047-decode-region start end |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
483 Decode the encoded words in the region @var{start} to @var{end}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
484 @end defun |
31853 | 485 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
486 @defun rfc2047-decode-string string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
487 Decode @var{string} and return the result. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
488 @end defun |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
489 |
31853 | 490 |
491 | |
492 @node time-date | |
493 @section time-date | |
494 | |
495 While not really a part of the @sc{mime} library, it is convenient to | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
496 document this library here. It deals with parsing @samp{Date} headers |
31853 | 497 and manipulating time. (Not by using tesseracts, though, I'm sorry to |
498 say.) | |
499 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
500 These functions convert between five formats: a date string, an Emacs |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
501 time structure, a decoded time list, a number of seconds, and a day number. |
31853 | 502 |
503 The functions have quite self-explanatory names, so the following just | |
504 gives an overview of which functions are available. | |
505 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
506 @findex parse-time-string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
507 @findex date-to-time |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
508 @findex time-to-seconds |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
509 @findex seconds-to-time |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
510 @findex time-to-day |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
511 @findex days-to-time |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
512 @findex time-since |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
513 @findex time-less-p |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
514 @findex subtract-time |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
515 @findex days-between |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
516 @findex date-leap-year-p |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
517 @findex time-to-day-in-year |
31853 | 518 @example |
519 (parse-time-string "Sat Sep 12 12:21:54 1998 +0200") | |
520 @result{} (54 21 12 12 9 1998 6 nil 7200) | |
521 | |
522 (date-to-time "Sat Sep 12 12:21:54 1998 +0200") | |
523 @result{} (13818 19266) | |
524 | |
525 (time-to-seconds '(13818 19266)) | |
526 @result{} 905595714.0 | |
527 | |
528 (seconds-to-time 905595714.0) | |
529 @result{} (13818 19266 0) | |
530 | |
531 (time-to-day '(13818 19266)) | |
532 @result{} 729644 | |
533 | |
534 (days-to-time 729644) | |
535 @result{} (961933 65536) | |
536 | |
537 (time-since '(13818 19266)) | |
538 @result{} (0 430) | |
539 | |
540 (time-less-p '(13818 19266) '(13818 19145)) | |
541 @result{} nil | |
542 | |
543 (subtract-time '(13818 19266) '(13818 19145)) | |
544 @result{} (0 121) | |
545 | |
546 (days-between "Sat Sep 12 12:21:54 1998 +0200" | |
547 "Sat Sep 07 12:21:54 1998 +0200") | |
548 @result{} 5 | |
549 | |
550 (date-leap-year-p 2000) | |
551 @result{} t | |
552 | |
553 (time-to-day-in-year '(13818 19266)) | |
554 @result{} 255 | |
555 @end example | |
556 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
557 @findex safe-date-to-time |
31853 | 558 And finally, we have @code{safe-date-to-time}, which does the same as |
559 @code{date-to-time}, but returns a zero time if the date is | |
560 syntactically malformed. | |
561 | |
562 | |
563 | |
564 @node qp | |
565 @section qp | |
566 | |
567 This library deals with decoding and encoding Quoted-Printable text. | |
568 | |
32248
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
569 Very briefly explained, QP encoding means translating all 8-bit |
31853 | 570 characters (and lots of control characters) into things that look like |
571 @samp{=EF}; that is, an equal sign followed by the byte encoded as a hex | |
32248
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
572 string. It is defined in RFC 2045. |
31853 | 573 |
574 The following functions are defined by the library: | |
575 | |
32248
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
576 @deffn Command quoted-printable-decode-region @var{from} @var{to} &optional @var{coding-system} |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
577 QP-decode all the encoded text in the region. If @var{coding-system} is |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
578 non-nil, decode bytes into characters with that coding-system. |
32258 | 579 @end deffn |
31853 | 580 |
32248
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
581 @defun quoted-printable-decode-string @var{string} &optional @var{coding-system} |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
582 Return a QP-encoded copy of @var{string}. If @var{coding-system} is |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
583 non-nil, decode bytes into characters with that coding-system. |
32258 | 584 @end defun |
31853 | 585 |
32248
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
586 @deffn Command quoted-printable-encode-region @var{from} @var{to} &optional @var{fold} @var{class} |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
587 QP-encode all the region. If @var{fold} is non-@var{nil}, fold lines at |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
588 76 characters, as required by the RFC. If @var{class} is |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
589 non-@code{nil}, translate the characters matched by that class in the |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
590 form expected by @var{skip-chars-forward}. If variable |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
591 @var{mm-use-ultra-safe-encoding} is defined and non-@code{nil}, fold |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
592 lines unconditionally and encode lines starting with @samp{From }. |
32258 | 593 @end deffn |
31853 | 594 |
32248
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
595 @defun quoted-printable-encode-string string |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
596 Return a QP-encoded copy of @var{string}. |
32258 | 597 @end defun |
31853 | 598 |
599 @node base64 | |
600 @section base64 | |
601 @cindex base64 | |
602 | |
603 Base64 is an encoding that encodes three bytes into four characters, | |
604 thereby increasing the size by about 33%. The alphabet used for | |
32248
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
605 encoding is very resistant to mangling during transit. @xref{Base |
086aff3bf8ca
Modify licence notice. QP, base64 changes.
Dave Love <fx@gnu.org>
parents:
32085
diff
changeset
|
606 64,,Base 64 Encoding, elisp, The Emacs Lisp Reference Manual}. |
31853 | 607 |
608 @node binhex | |
609 @section binhex | |
610 @cindex binhex | |
611 @cindex Apple | |
612 @cindex Macintosh | |
613 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
614 Binhex is an encoding that originated in Macintosh environments. |
31853 | 615 The following function is supplied to deal with these: |
616 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
617 @defun binhex-decode-region start end &optional header-only |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
618 Decode the encoded text in the region @var{start} to @var{end}. If |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
619 @var{header-only} is non-@code{nil}, only decode the @samp{binhex} |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
620 header and return the filename. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
621 @end defun |
31853 | 622 |
623 | |
624 @node uudecode | |
625 @section uudecode | |
626 @cindex uuencode | |
627 @cindex uudecode | |
628 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
629 Uuencoding is probably still the most popular encoding of binaries |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
630 used on Usenet, although Base64 rules the mail world. |
31853 | 631 |
632 The following function is supplied by this package: | |
633 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
634 @defun uudecode-decode-region start end &optional file-name |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
635 Decode the text in the region @var{start} to @var{end}. If |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
636 @var{file-name} is non-@code{nil}, save the result to @var{file-name}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
637 @end defun |
31853 | 638 |
639 | |
640 @node rfc1843 | |
641 @section rfc1843 | |
642 @cindex rfc1843 | |
643 @cindex HZ | |
644 @cindex Chinese | |
645 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
646 RFC1843 deals with mixing Chinese and @sc{ascii} characters in messages. In |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
647 essence, RFC1843 switches between @sc{ascii} and Chinese by doing this: |
31853 | 648 |
649 @example | |
650 This sentence is in ASCII. | |
651 The next sentence is in GB.~@{<:Ky2;S@{#,NpJ)l6HK!#~@}Bye. | |
652 @end example | |
653 | |
654 Simple enough, and widely used in China. | |
655 | |
656 The following functions are available to handle this encoding: | |
657 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
658 @defun rfc1843-decode-region start end |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
659 Decode HZ-encoded text in the region @var{start} to @var{end}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
660 @end defun |
31853 | 661 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
662 @defun rfc1843-decode-string string |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
663 Decode the HZ-encoded @var{string} and return the result. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
664 @end defun |
31853 | 665 |
666 | |
667 @node mailcap | |
668 @section mailcap | |
669 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
670 As specified by RFC 1524, @sc{mime}-aware message handlers parse |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
671 @dfn{mailcap} files from a default list, which can be overridden by the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
672 @code{MAILCAP} environment variable. These describe how elements are |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
673 supposed to be displayed. Here's an example file: |
31853 | 674 |
675 @example | |
676 image/*; gimp -8 %s | |
677 audio/wav; wavplayer %s | |
678 @end example | |
679 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
680 This says that all image files should be displayed with @command{gimp}, |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
681 and that realaudio files should be played by @command{rvplayer}. |
31853 | 682 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
683 The @code{mailcap} library parses such files, and provides functions for |
31853 | 684 matching types. |
685 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
686 @defvar mailcap-mime-data |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
687 This variable is an alist of alists containing backup viewing rules for |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
688 @sc{mime} types. These are overridden by rules for a type found in |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
689 mailcap files. The outer alist is keyed on the major content-type and |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
690 the inner alists are keyed on the minor content-type (which can be a |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
691 regular expression). |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
692 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
693 @c Fixme: document this properly! |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
694 For example: |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
695 @example |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
696 (("application" |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
697 ("octet-stream" |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
698 (viewer . mailcap-save-binary-file) |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
699 (non-viewer . t) |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
700 (type . "application/octet-stream")) |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
701 ("plain" |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
702 (viewer . view-mode) |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
703 (test fboundp 'view-mode) |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
704 (type . "text/plain"))) |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
705 @end example |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
706 @end defvar |
31853 | 707 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
708 @defopt mailcap-default-mime-data |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
709 This variable is the default value of @code{mailcap-mime-data}. It |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
710 exists to allow setting the value using Custom. It is merged with |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
711 values from mailcap files by @code{mailcap-parse-mailcaps}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
712 @end defopt |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
713 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
714 Although it is not specified by the RFC, @sc{mime} tools normally use a |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
715 common means of associating file extensions with defualt @sc{mime} types |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
716 in the absence of other information about the type of a file. The |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
717 information is found in per-user files @file{~/.mime.types} and system |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
718 @file{mime.types} files found in quasi-standard places. Here is an |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
719 example: |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
720 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
721 @example |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
722 application/x-dvi dvi |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
723 audio/mpeg mpga mpega mp2 mp3 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
724 image/jpeg jpeg jpg jpe |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
725 @end example |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
726 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
727 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
728 @defvar mailcap-mime-extensions |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
729 This variable is an alist @sc{mime} types keyed by file extensions. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
730 This is overridden by entries found in @file{mime.types} files. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
731 @end defvar |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
732 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
733 @defopt mailcap-default-mime-extensions |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
734 This variable is the default value of @code{mailcap-mime-extensions}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
735 It exists to allow setting the value using Custom. It is merged with |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
736 values from mailcap files by @code{mailcap-parse-mimetypes}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
737 @end defopt |
31853 | 738 |
739 Interface functions: | |
740 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
741 @defun mailcap-parse-mailcaps &optional path force |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
742 Parse all the mailcap files specified in a path string @var{path} and |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
743 merge them with the values from @code{mailcap-mime-data}. Components of |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
744 @var{path} are separated by the @code{path-separator} character |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
745 appropriate for the system. If @var{force} is non-@code{nil}, the files |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
746 are re-parsed even if they have been parsed already. If @var{path} is |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
747 omitted, use the value of environment variable @code{MAILCAPS} if it is |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
748 set; otherwise (on Unix) use the path defined in RFC 1524, plus |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
749 @file{/usr/local/etc/mailcap}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
750 @end defun |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
751 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
752 @defun mailcap-parse-mimetypes &optional path force |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
753 Parse all the mimetypes specified in a Unix-style path string @var{path} |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
754 and merge them with the values from @code{mailcap-mime-extensions}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
755 Components of @var{path} are separated by the @code{path-separator} |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
756 character appropriate for the system. If @var{path} is omitted, use the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
757 value of environment variable @code{MIMETYPES} if set; otherwise use a |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
758 default path consistent with that used by @code{mailcap-parse-mailcaps}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
759 If @var{force} is non-@code{nil}, the files are re-parsed even if they |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
760 have been parsed already. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
761 @end defun |
31853 | 762 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
763 @defun mailcap-mime-info string &optional request |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
764 Gets the viewer command for content-type @var{string}. @code{nil} is |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
765 returned if none is found. Expects @var{string} to be a complete |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
766 content-type header line. |
31853 | 767 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
768 If @var{request} is non-@code{nil} it specifies what information to |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
769 return. If it is nil or the empty string, the viewer (second field of |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
770 the mailcap entry) will be returned. If it is a string, then the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
771 mailcap field corresponding to that string will be returned |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
772 (@samp{print}, @samp{description}, whatever). If it is a number, all |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
773 the information for this viewer is returned. If it is @code{all}, then |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
774 all possible viewers for this type is returned. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
775 @end defun |
31853 | 776 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
777 @defun mailcap-mime-types |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
778 This function returns a list of all the defined media types. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
779 @end defun |
31853 | 780 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
781 @defun mailcap-extension-to-mime extension |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
782 This function returns the content type defined for a file with the given |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
783 @var{extension}. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
784 @end defun |
31853 | 785 |
786 | |
787 @node Decoding and Viewing | |
788 @chapter Decoding and Viewing | |
789 | |
790 This chapter deals with decoding and viewing @sc{mime} messages on a | |
791 higher level. | |
792 | |
793 The main idea is to first analyze a @sc{mime} article, and then allow | |
794 other programs to do things based on the list of @dfn{handles} that are | |
795 returned as a result of this analysis. | |
796 | |
797 @menu | |
798 * Dissection:: Analyzing a @sc{mime} message. | |
799 * Handles:: Handle manipulations. | |
800 * Display:: Displaying handles. | |
801 * Customization:: Variables that affect display. | |
802 * New Viewers:: How to write your own viewers. | |
803 @end menu | |
804 | |
805 | |
806 @node Dissection | |
807 @section Dissection | |
808 | |
809 The @code{mm-dissect-buffer} is the function responsible for dissecting | |
810 a @sc{mime} article. If given a multipart message, it will recursively | |
811 descend the message, following the structure, and return a tree of | |
812 @sc{mime} handles that describes the structure of the message. | |
813 | |
814 | |
815 @node Handles | |
816 @section Handles | |
817 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
818 A @sc{mime} handle is a list that fully describes a @sc{mime} component. |
31853 | 819 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
820 The following macros can be used to access elements from the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
821 @var{handle} argument: |
31853 | 822 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
823 @defmac mm-handle-buffer handle |
31853 | 824 Return the buffer that holds the contents of the undecoded @sc{mime} |
825 part. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
826 @end defmac |
31853 | 827 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
828 @defmac mm-handle-type handle |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
829 Return the parsed @samp{Content-Type} of the part. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
830 @end defmac |
31853 | 831 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
832 @defmac mm-handle-encoding handle |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
833 Return the @samp{Content-Transfer-Encoding} of the part. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
834 @end defmac |
31853 | 835 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
836 @defmac mm-handle-undisplayer handle |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
837 Return the function that can be used to remove the displayed part (if it |
31853 | 838 has been displayed). |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
839 @end defmac |
31853 | 840 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
841 @defmac mm-handle-set-undisplayer handle function |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
842 Set the undisplayer function for the part to function. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
843 @end defmac |
31853 | 844 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
845 @defmac mm-handle-disposition |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
846 Return the parsed @samp{Content-Disposition} of the part. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
847 @end defmac |
31853 | 848 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
849 @defmac mm-handle-disposition |
31853 | 850 Return the description of the part. |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
851 @end defmac |
31853 | 852 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
853 @defmac mm-get-content-id id |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
854 Returns the handle(s) referred to by @var{id}, the @samp{Content-ID} of |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
855 the part. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
856 @end defmac |
31853 | 857 |
858 | |
859 @node Display | |
860 @section Display | |
861 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
862 Functions for displaying, removing and saving. In the descriptions |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
863 below, `the part' means the @sc{mime} part represented by the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
864 @var{handle} argument. |
31853 | 865 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
866 @defun mm-display-part handle &optional no-default |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
867 Display the part. Return @code{nil} if the part is removed, |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
868 @code{inline} if it is displayed inline or @code{external} if it is |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
869 displayed externally. If @var{no-default} is non-@code{nil}, the part |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
870 is not displayed unless the @sc{mime} type of @var{handle} is defined to |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
871 be displayed inline or there is an display method defined for it; i.e.@: |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
872 no default external method will be used. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
873 @end defun |
31853 | 874 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
875 @defun mm-remove-part handle |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
876 Remove the part if it has been displayed. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
877 @end defun |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
878 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
879 @defun mm-inlinable-p handle |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
880 Return non-@code{nil} if the part can be displayed inline. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
881 @end defun |
31853 | 882 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
883 @defun mm-automatic-display-p handle |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
884 Return non-@code{nil} if the user has requested automatic display of the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
885 @sc{mime} type of the part. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
886 @end defun |
31853 | 887 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
888 @defun mm-destroy-part handle |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
889 Free all the resources used by the part. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
890 @end defun |
31853 | 891 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
892 @defun mm-save-part handle |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
893 Save the part to a file. The user is prompted for a file name to use. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
894 @end defun |
31853 | 895 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
896 @defun mm-pipe-part handle |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
897 Pipe the part through a shell command. The user is prompted for the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
898 command to use. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
899 @end defun |
31853 | 900 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
901 @defun mm-interactively-view-part handle |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
902 Prompt for a mailcap method to use to view the part and display it |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
903 externally using that method. |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
904 @end defun |
31853 | 905 |
906 | |
907 @node Customization | |
908 @section Customization | |
909 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
910 The display of @sc{mime} types may be customized with the following |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
911 options. |
31853 | 912 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
913 @defopt mm-inline-media-tests |
31853 | 914 This is an alist where the key is a @sc{mime} type, the second element |
915 is a function to display the part @dfn{inline} (i.e., inside Emacs), and | |
916 the third element is a form to be @code{eval}ed to say whether the part | |
917 can be displayed inline. | |
918 | |
919 This variable specifies whether a part @emph{can} be displayed inline, | |
920 and, if so, how to do it. It does not say whether parts are | |
921 @emph{actually} displayed inline. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
922 @end defopt |
31853 | 923 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
924 @defopt mm-inlined-types |
31853 | 925 This, on the other hand, says what types are to be displayed inline, if |
926 they satisfy the conditions set by the variable above. It's a list of | |
927 @sc{mime} media types. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
928 @end defopt |
31853 | 929 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
930 @defopt mm-automatic-display |
31853 | 931 This is a list of types that are to be displayed ``automatically'', but |
932 only if the above variable allows it. That is, only inlinable parts can | |
933 be displayed automatically. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
934 @end defopt |
31853 | 935 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
936 @defopt mm-attachment-override-types |
31853 | 937 Some @sc{mime} agents create parts that have a content-disposition of |
938 @samp{attachment}. This variable allows overriding that disposition and | |
939 displaying the part inline. (Note that the disposition is only | |
940 overridden if we are able to, and want to, display the part inline.) | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
941 @end defopt |
31853 | 942 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
943 @defopt mm-discouraged-alternatives |
31853 | 944 List of @sc{mime} types that are discouraged when viewing |
945 @samp{multipart/alternative}. Viewing agents are supposed to view the | |
946 last possible part of a message, as that is supposed to be the richest. | |
947 However, users may prefer other types instead, and this list says what | |
948 types are most unwanted. If, for instance, @samp{text/html} parts are | |
949 very unwanted, and @samp{text/richtech} parts are somewhat unwanted, | |
950 then the value of this variable should be set to: | |
951 | |
952 @lisp | |
953 ("text/html" "text/richtext") | |
954 @end lisp | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
955 @end defopt |
31853 | 956 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
957 @defopt mm-inline-large-images-p |
31853 | 958 When displaying inline images that are larger than the window, XEmacs |
959 does not enable scrolling, which means that you cannot see the whole | |
960 image. To prevent this, the library tries to determine the image size | |
961 before displaying it inline, and if it doesn't fit the window, the | |
962 library will display it externally (e.g. with @samp{ImageMagick} or | |
963 @samp{xv}). Setting this variable to @code{t} disables this check and | |
964 makes the library display all inline images as inline, regardless of | |
965 their size. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
966 @end defopt |
31853 | 967 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
968 @defopt mm-inline-override-p |
31853 | 969 @code{mm-inlined-types} may include regular expressions, for example to |
970 specify that all @samp{text/.*} parts be displayed inline. If a user | |
971 prefers to have a type that matches such a regular expression be treated | |
972 as an attachment, that can be accomplished by setting this variable to a | |
973 list containing that type. For example assuming @code{mm-inlined-types} | |
974 includes @samp{text/.*}, then including @samp{text/html} in this | |
975 variable will cause @samp{text/html} parts to be treated as attachments. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
976 @end defopt |
31853 | 977 |
978 | |
979 @node New Viewers | |
980 @section New Viewers | |
981 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
982 Here's an example viewer for displaying @samp{text/enriched} inline: |
31853 | 983 |
984 @lisp | |
985 (defun mm-display-enriched-inline (handle) | |
986 (let (text) | |
987 (with-temp-buffer | |
988 (mm-insert-part handle) | |
989 (save-window-excursion | |
990 (enriched-decode (point-min) (point-max)) | |
991 (setq text (buffer-string)))) | |
992 (mm-insert-inline handle text))) | |
993 @end lisp | |
994 | |
995 We see that the function takes a @sc{mime} handle as its parameter. It | |
996 then goes to a temporary buffer, inserts the text of the part, does some | |
997 work on the text, stores the result, goes back to the buffer it was | |
998 called from and inserts the result. | |
999 | |
1000 The two important helper functions here are @code{mm-insert-part} and | |
1001 @code{mm-insert-inline}. The first function inserts the text of the | |
1002 handle in the current buffer. It handles charset and/or content | |
1003 transfer decoding. The second function just inserts whatever text you | |
1004 tell it to insert, but it also sets things up so that the text can be | |
1005 ``undisplayed' in a convenient manner. | |
1006 | |
1007 | |
1008 @node Composing | |
1009 @chapter Composing | |
1010 @cindex Composing | |
1011 @cindex MIME Composing | |
1012 @cindex MML | |
1013 @cindex MIME Meta Language | |
1014 | |
1015 Creating a @sc{mime} message is boring and non-trivial. Therefore, a | |
1016 library called @code{mml} has been defined that parses a language called | |
1017 MML (@sc{mime} Meta Language) and generates @sc{mime} messages. | |
1018 | |
1019 @findex mml-generate-mime | |
1020 The main interface function is @code{mml-generate-mime}. It will | |
1021 examine the contents of the current (narrowed-to) buffer and return a | |
1022 string containing the @sc{mime} message. | |
1023 | |
1024 @menu | |
1025 * Simple MML Example:: An example MML document. | |
1026 * MML Definition:: All valid MML elements. | |
1027 * Advanced MML Example:: Another example MML document. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1028 * Charset Translation:: How charsets are mapped from Mule to MIME. |
31853 | 1029 * Conversion:: Going from @sc{mime} to MML and vice versa. |
1030 @end menu | |
1031 | |
1032 | |
1033 @node Simple MML Example | |
1034 @section Simple MML Example | |
1035 | |
1036 Here's a simple @samp{multipart/alternative}: | |
1037 | |
1038 @example | |
1039 <#multipart type=alternative> | |
1040 This is a plain text part. | |
1041 <#part type=text/enriched> | |
1042 <center>This is a centered enriched part</center> | |
1043 <#/multipart> | |
1044 @end example | |
1045 | |
1046 After running this through @code{mml-generate-mime}, we get this: | |
1047 | |
1048 @example | |
1049 Content-Type: multipart/alternative; boundary="=-=-=" | |
1050 | |
1051 | |
1052 --=-=-= | |
1053 | |
1054 | |
1055 This is a plain text part. | |
1056 | |
1057 --=-=-= | |
1058 Content-Type: text/enriched | |
1059 | |
1060 | |
1061 <center>This is a centered enriched part</center> | |
1062 | |
1063 --=-=-=-- | |
1064 @end example | |
1065 | |
1066 | |
1067 @node MML Definition | |
1068 @section MML Definition | |
1069 | |
1070 The MML language is very simple. It looks a bit like an SGML | |
1071 application, but it's not. | |
1072 | |
1073 The main concept of MML is the @dfn{part}. Each part can be of a | |
1074 different type or use a different charset. The way to delineate a part | |
1075 is with a @samp{<#part ...>} tag. Multipart parts can be introduced | |
1076 with the @samp{<#multipart ...>} tag. Parts are ended by the | |
1077 @samp{<#/part>} or @samp{<#/multipart>} tags. Parts started with the | |
1078 @samp{<#part ...>} tags are also closed by the next open tag. | |
1079 | |
1080 There's also the @samp{<#external ...>} tag. These introduce | |
1081 @samp{external/message-body} parts. | |
1082 | |
1083 Each tag can contain zero or more parameters on the form | |
1084 @samp{parameter=value}. The values may be enclosed in quotation marks, | |
1085 but that's not necessary unless the value contains white space. So | |
1086 @samp{filename=/home/user/#hello$^yes} is perfectly valid. | |
1087 | |
1088 The following parameters have meaning in MML; parameters that have no | |
1089 meaning are ignored. The MML parameter names are the same as the | |
1090 @sc{mime} parameter names; the things in the parentheses say which | |
1091 header it will be used in. | |
1092 | |
1093 @table @samp | |
1094 @item type | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1095 The @sc{mime} type of the part (@samp{Content-Type}). |
31853 | 1096 |
1097 @item filename | |
1098 Use the contents of the file in the body of the part | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1099 (@samp{Content-Disposition}). |
31853 | 1100 |
1101 @item charset | |
1102 The contents of the body of the part are to be encoded in the character | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1103 set speficied (@samp{Content-Type}). |
31853 | 1104 |
1105 @item name | |
1106 Might be used to suggest a file name if the part is to be saved | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1107 to a file (@samp{Content-Type}). |
31853 | 1108 |
1109 @item disposition | |
1110 Valid values are @samp{inline} and @samp{attachment} | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1111 (@samp{Content-Disposition}). |
31853 | 1112 |
1113 @item encoding | |
1114 Valid values are @samp{7bit}, @samp{8bit}, @samp{quoted-printable} and | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1115 @samp{base64} (@samp{Content-Transfer-Encoding}). |
31853 | 1116 |
1117 @item description | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1118 A description of the part (@samp{Content-Description}). |
31853 | 1119 |
1120 @item creation-date | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1121 RFC822 date when the part was created (@samp{Content-Disposition}). |
31853 | 1122 |
1123 @item modification-date | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1124 RFC822 date when the part was modified (@samp{Content-Disposition}). |
31853 | 1125 |
1126 @item read-date | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1127 RFC822 date when the part was read (@samp{Content-Disposition}). |
31853 | 1128 |
1129 @item size | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1130 The size (in octets) of the part (@samp{Content-Disposition}). |
31853 | 1131 |
1132 @end table | |
1133 | |
1134 Parameters for @samp{application/octet-stream}: | |
1135 | |
1136 @table @samp | |
1137 @item type | |
1138 Type of the part; informal---meant for human readers | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1139 (@samp{Content-Type}). |
31853 | 1140 @end table |
1141 | |
1142 Parameters for @samp{message/external-body}: | |
1143 | |
1144 @table @samp | |
1145 @item access-type | |
1146 A word indicating the supported access mechanism by which the file may | |
1147 be obtained. Values include @samp{ftp}, @samp{anon-ftp}, @samp{tftp}, | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1148 @samp{localfile}, and @samp{mailserver}. (@samp{Content-Type}.) |
31853 | 1149 |
1150 @item expiration | |
1151 The RFC822 date after which the file may no longer be fetched. | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1152 (@samp{Content-Type}.) |
31853 | 1153 |
1154 @item size | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1155 The size (in octets) of the file. (@samp{Content-Type}.) |
31853 | 1156 |
1157 @item permission | |
1158 Valid values are @samp{read} and @samp{read-write} | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1159 (@samp{Content-Type}). |
31853 | 1160 |
1161 @end table | |
1162 | |
1163 | |
1164 @node Advanced MML Example | |
1165 @section Advanced MML Example | |
1166 | |
1167 Here's a complex multipart message. It's a @samp{multipart/mixed} that | |
1168 contains many parts, one of which is a @samp{multipart/alternative}. | |
1169 | |
1170 @example | |
1171 <#multipart type=mixed> | |
1172 <#part type=image/jpeg filename=~/rms.jpg disposition=inline> | |
1173 <#multipart type=alternative> | |
1174 This is a plain text part. | |
1175 <#part type=text/enriched name=enriched.txt> | |
1176 <center>This is a centered enriched part</center> | |
1177 <#/multipart> | |
1178 This is a new plain text part. | |
1179 <#part disposition=attachment> | |
1180 This plain text part is an attachment. | |
1181 <#/multipart> | |
1182 @end example | |
1183 | |
1184 And this is the resulting @sc{mime} message: | |
1185 | |
1186 @example | |
1187 Content-Type: multipart/mixed; boundary="=-=-=" | |
1188 | |
1189 | |
1190 --=-=-= | |
1191 | |
1192 | |
1193 | |
1194 --=-=-= | |
1195 Content-Type: image/jpeg; | |
1196 filename="~/rms.jpg" | |
1197 Content-Disposition: inline; | |
1198 filename="~/rms.jpg" | |
1199 Content-Transfer-Encoding: base64 | |
1200 | |
1201 /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof | |
1202 Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/wAALCAAwADABAREA/8QAHwAA | |
1203 AQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQR | |
1204 BRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RF | |
1205 RkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ip | |
1206 qrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/9oACAEB | |
1207 AAA/AO/rifFHjldNuGsrDa0qcSSHkA+gHrXKw+LtWLrMb+RgTyhbr+HSug07xNqV9fQtZrNI | |
1208 AyiaE/NuBPOOOP0rvRNE880KOC8TbXXGCv1FPqjrF4LDR7u5L7SkTFT/ALWOP1xXgTuXfc7E | |
1209 sx6nua6rwp4IvvEM8chCxWxOdzn7wz6V9AaB4S07w9p5itow0rDLSY5Pt9K43xO66P4xs71m | |
1210 2QXiGCbA4yOVJ9+1aYORkdK434lyNH4ahCnG66VT9Nj15JFbPdX0MS43M4VQf5/yr2vSpLnw | |
1211 5ZW8dlCZ8KFXjOPX0/mK6rSPEGt3Angu44fNEReHYNvIH3TzXDeKNO8RX+kSX2ouZkicTIOc | |
1212 L+g7E810ulFjpVtv3bwgB3HJyK5L4quY/C9sVxk3ij/xx6850u7t1mtp/wDlpEw3An3Jr3Dw | |
1213 34gsbWza4nBlhC5LDsaW6+IFgupQyCF3iHH7gA7c9R9ay7zx6t7aX9jHC4smhfBkGCvHGfrm | |
1214 tLQ7hbnRrV1GPkAP1x1/Hr+Ncr8Vzjwrbf8AX6v/AKA9eQRyYlQk8Yx9K6XTNbkgia2ciSIn | |
1215 7p5Ga9Atte0LTLKO6it4i7dVRFJDcZ4PvXN+JvEMF9bILVGXJLSZ4zkjivRPDaeX4b08HOTC | |
1216 pOffmua+KkbS+GLVUGT9tT/0B68eeIpIFYjB70+OOVXyoOM9+M1eaWeCLzHPyHGO/NVWvJJm | |
1217 jQ8KGH1NfQWhXSXmh2c8eArRLwO3HSv/2Q== | |
1218 | |
1219 --=-=-= | |
1220 Content-Type: multipart/alternative; boundary="==-=-=" | |
1221 | |
1222 | |
1223 --==-=-= | |
1224 | |
1225 | |
1226 This is a plain text part. | |
1227 | |
1228 --==-=-= | |
1229 Content-Type: text/enriched; | |
1230 name="enriched.txt" | |
1231 | |
1232 | |
1233 <center>This is a centered enriched part</center> | |
1234 | |
1235 --==-=-=-- | |
1236 | |
1237 --=-=-= | |
1238 | |
1239 This is a new plain text part. | |
1240 | |
1241 --=-=-= | |
1242 Content-Disposition: attachment | |
1243 | |
1244 | |
1245 This plain text part is an attachment. | |
1246 | |
1247 --=-=-=-- | |
1248 @end example | |
1249 | |
1250 @node Charset Translation | |
1251 @section Charset Translation | |
1252 @cindex charsets | |
1253 | |
1254 During translation from MML to @sc{mime}, for each @sc{mime} part which | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1255 has been composed inside Emacs, an appropriate @sc{mime} charset has to |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1256 be chosen. |
31853 | 1257 |
1258 @vindex mail-parse-charset | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1259 If you are running a non-Mule Emacs, this process is simple: if the part |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1260 contains any non-@sc{ascii} (8-bit) characters, the @sc{mime} charset |
31853 | 1261 given by @code{mail-parse-charset} (a symbol) is used. (Never set this |
1262 variable directly, though. If you want to change the default charset, | |
1263 please consult the documentation of the package which you use to process | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1264 @sc{mime} messages. @xref{Various Message Variables, , Various Message |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1265 Variables, message, Message Manual}, for example.) If there are only |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1266 @sc{ascii} characters, the @sc{mime} charset @samp{US-ASCII} is used, of |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1267 course. |
31853 | 1268 |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1269 @cindex Mule |
31853 | 1270 @cindex UTF-8 |
1271 @cindex Unicode | |
1272 @vindex mm-mime-mule-charset-alist | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1273 Things are slightly more complicated when running Emacs with Mule |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1274 support. In this case, a list of the Mule charsets used in the part is |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1275 obtained, and the corresponding @sc{mime} charsets are determined. If |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1276 this results in a single @sc{mime} charset, this is used to encode the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1277 part. But if the resulting list of @sc{mime} charsets contains more |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1278 than one element, two things can happen: if it is possible to encode the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1279 part via UTF-8, this charset is used. (For this, Emacs must support the |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1280 @code{utf-8} coding system, and the part must consist entirely of |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1281 characters which have Unicode counterparts.) If UTF-8 is not available, |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1282 the part is split into several, so that each one can be encoded with a |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1283 single @sc{mime} charset. The part can only be split at line |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1284 boundaries, though---if more than one @sc{mime} charset is required to |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1285 encode a single line, it is not possible to encode the part. |
31853 | 1286 |
1287 @node Conversion | |
1288 @section Conversion | |
1289 | |
1290 @findex mime-to-mml | |
1291 A (multipart) @sc{mime} message can be converted to MML with the | |
1292 @code{mime-to-mml} function. It works on the message in the current | |
1293 buffer, and substitutes MML markup for @sc{mime} boundaries. | |
1294 Non-textual parts do not have their contents in the buffer, but instead | |
1295 have the contents in separate buffers that are referred to from the MML | |
1296 tags. | |
1297 | |
1298 @findex mml-to-mime | |
1299 An MML message can be converted back to @sc{mime} by the | |
1300 @code{mml-to-mime} function. | |
1301 | |
1302 These functions are in certain senses ``lossy''---you will not get back | |
1303 an identical message if you run @sc{mime-to-mml} and then | |
1304 @sc{mml-to-mime}. Not only will trivial things like the order of the | |
1305 headers differ, but the contents of the headers may also be different. | |
1306 For instance, the original message may use base64 encoding on text, | |
1307 while @sc{mml-to-mime} may decide to use quoted-printable encoding, and | |
1308 so on. | |
1309 | |
1310 In essence, however, these two functions should be the inverse of each | |
1311 other. The resulting contents of the message should remain equivalent, | |
1312 if not identical. | |
1313 | |
1314 | |
1315 @node Standards | |
1316 @chapter Standards | |
1317 | |
1318 The Emacs @sc{mime} library implements handling of various elements | |
1319 according to a (somewhat) large number of RFCs, drafts and standards | |
1320 documents. This chapter lists the relevant ones. They can all be | |
1321 fetched from @samp{http://quimby.gnus.org/notes/}. | |
1322 | |
1323 @table @dfn | |
1324 @item RFC822 | |
1325 @itemx STD11 | |
1326 Standard for the Format of ARPA Internet Text Messages. | |
1327 | |
1328 @item RFC1036 | |
1329 Standard for Interchange of USENET Messages | |
1330 | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1331 @item RFC1524 |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1332 A User Agent Configuration Mechanism For Multimedia Mail Format |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1333 Information |
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1334 |
31853 | 1335 @item RFC2045 |
1336 Format of Internet Message Bodies | |
1337 | |
1338 @item RFC2046 | |
1339 Media Types | |
1340 | |
1341 @item RFC2047 | |
1342 Message Header Extensions for Non-ASCII Text | |
1343 | |
1344 @item RFC2048 | |
1345 Registration Procedures | |
1346 | |
1347 @item RFC2049 | |
1348 Conformance Criteria and Examples | |
1349 | |
1350 @item RFC2231 | |
1351 MIME Parameter Value and Encoded Word Extensions: Character Sets, | |
1352 Languages, and Continuations | |
1353 | |
1354 @item RFC1843 | |
1355 HZ - A Data Format for Exchanging Files of Arbitrarily Mixed Chinese and | |
1356 ASCII characters | |
1357 | |
1358 @item draft-ietf-drums-msg-fmt-05.txt | |
1359 Draft for the successor of RFC822 | |
1360 | |
1361 @item RFC2112 | |
1362 The MIME Multipart/Related Content-type | |
1363 | |
1364 @item RFC1892 | |
1365 The Multipart/Report Content Type for the Reporting of Mail System | |
1366 Administrative Messages | |
1367 | |
1368 @item RFC2183 | |
1369 Communicating Presentation Information in Internet Messages: The | |
1370 Content-Disposition Header Field | |
1371 | |
1372 @end table | |
1373 | |
1374 | |
1375 @node Index | |
1376 @chapter Index | |
1377 @printindex cp | |
33435
4ef19e88da9a
Various markup and content changes, particularly to use @def... for
Dave Love <fx@gnu.org>
parents:
32258
diff
changeset
|
1378 @printindex fn |
31853 | 1379 |
1380 @summarycontents | |
1381 @contents | |
1382 @bye | |
1383 | |
1384 @c End: |