* mime-view.el (mime-display-entity): Clean up code.
[elisp/semi.git] / emy.texi
1 \input texinfo.tex              @c -*- texinfo -*-
2
3 @setfilename emy.info
4
5 @set VERSION 1.13
6
7 @dircategory Emacs/MIME
8 @direntry
9 * EMY: (emy).   User guide for EMY.
10 @end direntry
11
12 @settitle EMY @value{VERSION}
13
14 @ifinfo
15 This file describes how to use EMY, MIME user interface which
16 implements SEMI API.
17
18 Copyright (C) 1993, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
19
20 Permission is granted to make and distribute verbatim copies of
21 this manual provided the copyright notice and this permission notice
22 are preserved on all copies.
23
24 @ignore
25 Permission is granted to process this file through TeX and print the
26 results, provided the printed document carries copying permission
27 notice identical to this one except for the removal of this paragraph
28 (this paragraph not being relevant to the printed manual).
29
30 @end ignore
31 Permission is granted to copy and distribute modified versions of this
32 manual under the conditions for verbatim copying, provided that the entire
33 resulting derived work is distributed under the terms of a permission
34 notice identical to this one.
35
36 Permission is granted to copy and distribute translations of this manual
37 into another language, under the above conditions for modified versions,
38 except that this permission notice may be stated in a translation approved
39 by the Free Software Foundation.
40 @end ifinfo
41
42 @titlepage
43 @title EMY
44 @subtitle MIME User Interface implements SEMI API
45 @author Yoshiki Hayashi
46 @page
47 @vskip 0pt plus 1filll
48 Copyright @copyright{} 1993, 94, 95, 96, 97, 98, 99 Free Software
49 Foundation, Inc.
50
51 Permission is granted to make and distribute verbatim copies of
52 this manual provided the copyright notice and this permission notice
53 are preserved on all copies.
54
55 Permission is granted to copy and distribute modified versions of this
56 manual under the conditions for verbatim copying, provided that the entire
57 resulting derived work is distributed under the terms of a permission
58 notice identical to this one.
59
60 Permission is granted to copy and distribute translations of this manual
61 into another language, under the above conditions for modified versions,
62 except that this permission notice may be stated in a translation approved
63 by the Free Software Foundation.
64 @end titlepage
65
66 @ifnottex
67 @node Top
68 @top EMY: An Introduction
69
70 EMY is a MIME interface for Emacs. EMY provides SEMI API, which
71 is specified in a separate document.
72 @c @xref{(semi-api)Top}.
73
74 This manual correspond to EMY version @value{VERSION}.
75 @end ifnottex
76
77 @menu
78 * MIME::                Overview of MIME.
79 * Overview::            What EMY does and doesn't.
80 * MIME-View::           How to View MIME messages.
81 * MIME-Edit::           How to compose MIME messages.
82 @end menu
83
84 @node MIME
85 @chapter Overview of MIME
86
87 MIME stands for Multipurpose Internet Mail Extensions. 
88
89 MIME is built on top of STD11.  MIME enhances semantics of STD11 so that
90 you can send messages other than text/plain and US-ASCII.  MIME does not
91 prohibit use of local conventions.  However, its use is discouraged.
92 It would be nice if all MUA uses MIME to specify character set etc.
93 Then you don't have to be aware of all local conventions in the world.
94
95 Don't assume every MUA can handle MIME correctly.  They might even don't
96 understand MIME.  EMY takes interoperability the first priority.  You
97 must be carefull to choose format that is easy to understand for
98 everyone.  But you don't have to be afraid.  MIME is written in such a
99 way that it can be viewed with non-MIME MUA if its well written.
100
101 EMY is here to make your life easier.  It provides some way to ignore
102 standards to cooperate with broken world.  However, it doesn't allow
103 you to send broken MIME messages.  If you want to same brokenness like
104 them, EMY is not a candidate.  If you really thinks it's needed, you can
105 try persuading me.  Warning: `It's de facto standard' is not enough.
106
107 @menu
108 * Text::                What you normally do.
109 * Content-Types::       You can create messages other than text/plain.
110 @end menu
111
112 @node Text
113 @section Writing text
114
115 (I'll write this sections later).
116
117 @node Content-Types
118 @section Types of message you can use
119
120 @menu
121 * Content-Type::        Details of interpreting Content-Type.
122 @end menu
123
124 @node Content-Type
125 @subsection How things are interpretes with each types
126
127 @node Overview
128 @chapter Some basic things about EMY
129
130 (Not yet written).
131
132 @menu
133 * Customize::           How to customize EMY.
134 @end menu
135
136 @node Customize
137 @section What you should care
138
139 @node MIME-View
140 @chapter Viewing MIME messages
141
142 Right now only differences between SEMI and EMY are documented.
143
144 @menu
145 * Manipulating an Entity::      Changing representation of the part
146 * Changing Entity Button::      Where to add button indicating that entity.
147 * Adding Buttons::              Where you want to see buttons.
148 * How to deal with broken MUA:: Some MUA sends totally broken messages.
149 @end menu
150
151 @node Manipulating an Entity
152 @section Playing with an entity
153
154 You can change the representation of given part in the preview buffer.
155 Following commands are available in preview buffer.
156
157 @table @code
158
159 @item c
160 @kindex c (MIME-View)
161 @findex mime-preview-text
162 Display the part as text/plain with automatic MIME charset
163 detection.  You can specify coding-system if you give a numerical
164 prefix (@code{mime-preview-text}).
165
166 @item i
167 @kindex i (MIME-View)
168 @findex mime-preview-inline
169 Show the contents of the part without code-conversion.  @code{C-u c
170 binary RET} does the same thing (@code{mime-preview-inline}).
171
172 @item t
173 @kindex t (MIME-View)
174 @findex mime-preview-type
175 Represent the part using the method specified by
176 @code{mime-preview-condition}.  When there's no presentation method for
177 given part, nothing is performed (@code{mime-preview-type}).
178
179 @item e
180 @kindex e (MIME-View)
181 @findex mime-preview-extract-current-entity
182 Save content of the part to a file.  It will prompt for you to enter
183 file name (@code{mime-preview-extract-current-entity}).
184
185 @item v
186 @kindex v (MIME-View)
187 @findex mime-preview-play-current-entity
188 Pass the entity to an external program specified by mailcap file
189 (@code{mime-preview-play-current-entity}).
190 @c Need more documentation about mailcap.
191
192 @item b
193 @kindex b (MIME-View)
194 @findex mime-preview-buttonize
195 Buttonize article (@code{mime-preview-buttonize}).
196
197 @item B
198 @kindex B (MIME-View)
199 @findex mime-preview-unbuttonize
200 Unbuttonize article (@code{mime-preview-unbuttonize}).
201
202 @end table
203
204 @node Changing Entity Button
205 @section How buttons look like
206
207 Not yet written.
208
209 @node Adding Buttons
210 @section Add button before, after or around an entity
211
212 @vindex mime-view-button-place-alist
213 You can customize where to add buttons and where to not with
214 @code{mime-view-button-place-alist}.  Unfortunately, there's no variable
215 to change content of the button. It must be an alist of type or
216 type/subtype vs. keywords.
217
218 Three legal keywords are:
219
220 @table @code
221 @item before
222 Add button before given types.
223
224 @item after
225 Add button when another part follows that type.
226
227 @item around
228 Do both @code{before} and @code{after}.
229
230 @end table
231
232 Notice when deciding whether inserting button or not, an entity of same
233 level is consulted as a previous entity.  Let's say a message has
234 following structure and nothing is specified for text/xml.
235
236 @example
237 message/rfc822
238   multipart/mixed
239     text/plain
240     image/jpeg
241   text/xml
242 @end example
243
244 When MIME-View decides text/xml part should have button or not, it
245 checks multipart/mixed has @code{after} or @code{around}, not
246 image/jpeg. This behaviour may be confusing.  In the future version, the
247 very last part's value will be used as well.
248
249 Default value is:
250
251 @lisp
252 ((message . around)
253  (application . before)
254  (multipart/alternative . around))
255 @end lisp
256
257 This means you will have buttons around message/* and
258 multipart/alternative, and before application/*.
259
260 @node How to deal with broken MUA
261 @section Illegal MIME messages
262
263 Some MUAs send totally broken MIME messages.  According to the standard,
264 it's perfectly fine for EMY not to grok those message.  However, EMY
265 tries to extract as much information as possible.  Here's some functions
266 that might help you.
267
268 Some MUAs localized to Japanese sends these strings as a filename
269 parameter of Content-Disposition.
270
271 @example
272 =?ISO-2022-JP?B?GyRCRnxLXDhsGyhC?=
273 @end example
274
275 It looks like encoded-words. This usage is strictly prohibited by RFC
276 2047.  Instead, you should use mechanism described in RFC 2231.
277 If you really want to ``decode'' it when saving it to file, you can use
278 something like this.
279
280 @lisp
281 (mime-add-condition
282  'action
283  '((mode . "extract")
284    (method . mime-save-content-for-broken-message)))
285 @end lisp
286
287 Unfortunately, there's no easy way to customize looking of buttons.
288 It's on EMY's TODO list.
289
290 If you are desperate, you can redefine
291 @code{mime-view-insert-entity-button}.
292
293 @lisp
294 (defun mime-view-insert-entity-button (entity &optional body-is-invisible)
295   "Insert entity-button of ENTITY."
296   (let ((entity-node-id (mime-entity-node-id entity))
297         (params (mime-entity-parameters entity))
298         (subject (eword-decode-string (mime-view-entity-title entity))))
299     (mime-insert-button
300      (concat
301       (let ((access-type (assoc "access-type" params))
302             (num (or (cdr (assoc "x-part-number" params))
303                      (if (consp entity-node-id)
304                          (mapconcat (function
305                                      (lambda (num)
306                                        (format "%s" (1+ num))))
307                                     (reverse entity-node-id) ".")
308                        "0"))))
309         (cond (access-type
310                (let ((server (assoc "server" params)))
311                  (setq access-type (cdr access-type))
312                  (if server
313                      (format "%s %s ([%s] %s)"
314                              num subject access-type (cdr server))
315                    (let ((site (cdr (assoc "site" params)))
316                          (dir (cdr (assoc "directory" params)))
317                          (url (cdr (assoc "url" params))))
318                      (if url
319                          (format "%s %s ([%s] %s)"
320                                  num subject access-type url)
321                        (format "%s %s ([%s] %s:%s)"
322                                num subject access-type site dir))))))
323               (t
324                (let ((media-type (mime-entity-media-type entity))
325                      (media-subtype (mime-entity-media-subtype entity))
326                      (charset (cdr (assoc "charset" params)))
327                      (encoding (mime-entity-encoding entity)))
328                  (concat
329                   num " " subject
330                   (let ((rest
331                          (format " <%s/%s%s%s>"
332                                  media-type media-subtype
333                                  (if charset
334                                      (concat "; " charset)
335                                    "")
336                                  (if encoding
337                                      (concat " (" encoding ")")
338                                    ""))))
339                     (if (>= (+ (current-column)(length rest))(window-width))
340                         "\n\t")
341                     rest))))))
342       (if body-is-invisible
343           " ..."
344         ""))
345      (function mime-preview-play-current-entity))))
346 @end lisp
347
348 @strong{Note:} These settings are unsupported until better way is
349 implemented.
350
351 @node MIME-Edit
352 @chapter Composing MIME messages
353
354 @vindex mime-edit-attach-at-end-type (MIME-Edit)
355 When you are editing MIME message, you might want to insert some part at
356 the end of your message.  Some MUA are known to have some problems when
357 last part is not an attachment. 
358
359 If you want to do this, @code{mime-edit-attach-at-end-type} is your
360 friend. This variable is list of MIME types or type/subtypes inserted
361 at the last part. When only type is specified, it will affect all
362 subtypes of that type.
363
364 If you want insert application/* and message/rfc822 at the end,
365 you can do like this:
366
367 @lisp
368 (setq mime-edit-attach-at-end-types
369       '(application message/rfc822))
370 @end lisp
371
372 @bye