tm 7.17.
[elisp/tm.git] / doc / tm-view_en.texi
1 \input texinfo.tex
2 @c{-*-tm manual-*-}
3 @setfilename tm-view_en.info
4 @settitle{tm-view manual}
5
6 @titlepage
7 @title tm-view Manual (English Version)
8 @author by MORIOKA Tomohiko
9 @code{$Id: tm-view_en.texi,v 7.2 1995/10/18 18:11:46 morioka Exp $}
10 @end titlepage
11
12
13 @node Top, Abstract, (tm_en.info), (tm_en.info)
14 @comment  node-name,  next,  previous,  up
15 @ifinfo
16 @top tm-view 7.16 Reference manual
17
18 The tm-view is a general MIME viewer running on GNU Emacs.
19
20 tm-view provides the major-mode called @code{mime/viewer-mode} to read
21 MIME message for MUA. MUA implementer can use it to add MIME function.
22 @end ifinfo
23
24 @menu
25 * Abstract::              What is tm-view?
26 * How to run::            How to run mime/viewer-mode.
27 * Commands::              Commands of mime/viewer-mode.
28 * Preview Buffer::        Screen design of preview buffer.
29 * Decoding::              Mechanism of decoding operations for
30                           contents.
31 * environment variables:: environment variables for standard methods
32                           of tm-view.
33 * encoded-word::          encoded-word decoding
34
35 Preview buffer
36 * Preview Buffer:: Screen design of preview buffer.
37 * content-subject::
38 * content-header::
39 * content-body::
40 * content-separator::
41
42 Decoding
43 * Decoding:: Mechanism of decoding operations for contents.
44 * decoding-condition:: Setting of content decoding condition.
45 * Format of method value:: Format of method value part.
46 * Example of decoding-condition:: Examples of decoding-condition.
47
48 Indexes
49 * Concept Index::
50 * Command Index::
51 * Variable Index::
52 @end menu
53
54
55 @node Abstract, How to run, Top, Top
56 @comment  node-name,  next,  previous,  up
57 @chapter What is tm-view?
58 @cindex tm-view
59
60 tm-view is a general MIME viewer for GNU Emacs.
61
62 It provides a major-mode to navigate MIME message to each MUAs.
63
64 tm-view managements two buffers, one is for raw message called
65 @strong{article buffer}, another one is to preview for user called
66 @strong{preview buffer}.
67
68 When called @code{mime/viewer-mode}, tm-view analyzes article buffer,
69 and sets its result to the variable @code{mime::article/content-info}.
70
71 After that, tm-view create a preview buffer corresponded to the
72 article buffer. As this time, tm-view modifies header and body of each
73 contents of the message. It is done by definition for Content-Types.
74
75 On the preview buffer created by tm-view, user can manipulate a
76 message to decode, such as run external vewer, extract files, or
77 print.
78
79 Notice: In this document, I call @strong{content-type} as
80 content-type/subtype of Content-Type field.
81
82
83 @node How to run, Commands, Abstract, Top
84 @comment  node-name,  next,  previous,  up
85 @chapter How to run mime/viewer-mode
86 @cindex How to run mime/viewer-mode
87
88 @deffn{Command} mime/viewer-mode &optional mother ctl encoding
89
90 Parse current-buffer as a MIME message, and create preview buffer to
91 display to user, then enter @code{mime/viewer-mode}.
92
93 @var{mother} is used to specify original article buffer. It may be
94 useful when an article buffer is assembled from message/partial.
95
96 @var{ctl} is used to specify Content-Type field information. Its
97 format is output format of @code{mime/Content-Type}. When @var{ctl} is 
98 specified, tm-view uses it instead of Content-Type field of the
99 article buffer.
100
101 @var{encoding} is used to specify field-body of
102 Content-Transfer-Encoding field. When is is specified, tm-view uses it
103 instead of Content-Type field of the article buffer.
104 @end deffn
105
106
107 @node Commands, Preview Buffer, How to run, Top
108 @comment  node-name,  next,  previous,  up
109 @chapter Commands of mime/viewer-mode
110 @cindex Commands of mime/viewer-mode
111
112 @code{mime/viewer-mode} has following functions:
113
114 @table @kbd 
115 @item u
116         goes to the upper content (returns to the Summary mode if the
117         cursor is sitting on the top content (*1))
118 @item p
119         goes to the previous content
120 @item n
121         goes to the next content
122 @item @key{SPC}
123         scrolls up
124 @item @key{M-SPC}
125         scrolls down
126 @item @key{DEL}
127         scrolls down
128 @item @key{RET}
129         goes to the next line
130 @item @key{M-RET}
131         goes to the previous line
132 @item v
133         playbacks a content            (*2)
134 @item e
135         extracts a file from a content (*2)
136 @item C-c C-p
137         prints a content               (*2)
138 @end table
139
140 @b{[Notice]}
141 @enumerate
142 @item
143 Not return to the Summary mode unless tm-view has been setup using
144 tm-mh-e, tm-gnus, tm-rmail etc.
145
146 @item
147 Actual playback/extract/print will be performed by a method.
148 @end enumerate
149
150
151 @node Preview Buffer, Decoding, Commands, Top
152 @comment  node-name,  next,  previous,  up
153 @chapter Screen design of preview buffer
154 @cindex Screen design of preview buffer
155
156 In preview buffer, following are displayed for each content:
157
158 @example
159         [content-subject]
160         (content-header)
161         
162         (content-body)
163         (content-separator)
164 @end example
165
166 You can change design or stop to display if you specify for each
167 content-types.
168
169 Example:
170
171 @example
172 From: MORIOKA Tomohiko <morioka@@jaist.ac.jp>
173 Newsgroups: zxr.comp.emacs.tm-english
174 Subject: tm6.63.tar.gz
175 Date: Mon, 26 Jun 1995 17:39:50 JST
176 Organization: Chamonix, JAIST, Tatsunokuchi, Ishikawa, Japan
177 Reply-To: tm-eng@@chamonix.jaist.ac.jp
178 To: tm-eng@@chamonix.jaist.ac.jp
179 In-Reply-To: Your message of "Sun, 25 Jun 1995 23:20:49 MST"
180 X-Mua: mh-e 4.1 + tm 6.63 / Mule 2.2 (WAKAMURASAKI) PL02
181 X-Mime-Composer: mime.el + tiny-mime 5.12
182 X-Ml-Count: 32
183
184 [1  (text/plain)]
185   I put tm6.63.tar.gz in ftp.jaist.ac.jp.
186
187   In this version, tm-view uses new MIME encoding/decoding engine
188 ``mel (MIME encoding library''. This library has internal/external
189 encoding/decoding engine. If data is smaller than a limit, tm-view
190 uses internal decoder, otherwise external decoder.
191
192 [2 tm6.63.tar.gz ([anon-ftp] ftp.jaist.ac.jp:/pub/GNU/elisp/mime/alpha)]
193
194 [3  (text/plain)]
195 ----
196 MORIOKA, Tomohiko <morioka@@jaist.ac.jp>
197 @end example
198
199
200 @menu
201 * content-subject::
202 * content-header::
203 * content-body::
204 * content-separator::
205 @end menu
206
207
208 @node content-subject, content-header, Preview Buffer, Preview Buffer
209 @comment  node-name,  next,  previous,  up
210 @section content-subject
211 @cindex content-subject
212
213 content-subject is a part to display abstract for the content. It is
214 placed in top of content.
215
216 In default, it is displayed following design:
217
218 @example
219         [1.3 test (text/plain)]
220 @end example
221
222 First number field represents position of a content in the message. It
223 is called `content-number'. It can be considered as the chapter number
224 in the message.
225
226 Second string part represents title. It is created by following:
227
228 @itemize @bullet
229 @item name paramater or x-name parameter in Content-Type field
230 @item Content-Description field or Subject field
231 @item filename of uuencode
232 @end itemize
233
234 If they are not exists, space is displayed.
235
236 Third parenthesis part represents content-type/subtype of the
237 content. If it is non-MIME part, @code{nil} is displayed.
238
239 Content-subject is used like icon when content-header and content-body
240 are hidden. For example,
241
242 @example
243         [2  (image/gif)]
244 @end example
245
246 if you press `v' key, GIF image is displayed.
247
248
249 @defvr{Variable} mime-viewer/content-subject-omitting-Content-Type-list
250
251 List of content-type. If content-type of a content is a member of this 
252 list, its content-subject is not displayed.
253
254 This variable is referenced by function
255 @code{mime-viewer/default-content-subject-function}.
256 @end defvr
257
258
259 @deffn{Function} mime-viewer/default-content-subject-function cnum cinfo ctype params subj
260
261 Default value of the variable
262 @code{mime-viewer/content-subject-function}.
263 It refers variable
264 @code{mime-viewer/content-subject-omitting-Content-Type-list}.
265 @end deffn
266
267
268 @defvar mime-viewer/content-subject-function cnum cinfo ctype params subj
269
270 Variable to specify content-subject display function. Default value is
271 the function @code{mime-viewer/default-content-subject-function}.
272 @end defvar
273
274
275 @node content-header, content-body, content-subject, Preview Buffer
276 @comment  node-name,  next,  previous,  up
277 @section content-header
278 @cindex content-header
279
280 A content header shows the header portion of a content in the preview
281 buffer.
282
283 When the function @code{mime-viewer/header-visible-p} returns @code{t}
284 for content-number of a content, content-header is displayed. This
285 judge function returns @code{t} when a content is root or content-type
286 of its parent is a member of the variable
287 @code{mime-viewer/childrens-header-showing-Content-Type-list}.
288
289 If you want to change this condition, please redefine it.
290
291 When content-header is displayed, content-header are formated by
292 content-header-filter. Content-header-filter is searched from variable 
293 @code{mime-viewer/content-header-filter-alist}. Its key is major-mode
294 of the article buffer. If not found, function
295 @code{mime-viewer/default-content-header-filter} is called.
296
297
298 @defvar mime-viewer/childrens-header-showing-Content-Type-list
299
300 List of content-type. If content-type of parent of a content is a
301 member of this variable, its content-header is displayed.
302 Default value is "message/rfc822".
303
304 This variable is referred by the function
305 @code{mime-viewer/header-visible-p}.
306 @end defvar
307
308
309 @deffn{Function} mime-viewer/header-visible-p cnum cinfo &optional ctype
310
311 Returns @code{t} if a content is displayed.
312
313 @var{cnum} is content-number. @var{cinfo} is content-info. If you know 
314 content-type, you can specify by @var{ctype}.
315 @end deffn
316
317
318 @defvar mime-viewer/content-header-filter-alist
319
320 Association-list whose key is major-mode of a article buffer, value is
321 content-header-filter.
322 @end defvar
323
324
325 @deffn{Function} mime-viewer/default-content-header-filter
326
327 It is called when content-header-filter is not found in variable
328 @code{mime-viewer/content-header-filter-alist}.
329 @end deffn
330
331
332 @node content-body, content-separator, content-header, Preview Buffer
333 @comment  node-name,  next,  previous,  up
334 @section content-body
335 @cindex content-body
336
337 Content-body represents content of the message. tm-view does not
338 display raw content body. For example, if a content has binary, it is
339 hidden. If a content has richtext, it is formated. Namely content body
340 is hidden or formated.
341
342 Function @code{mime-viewer/body-visible-p} is a judge function whether
343 content-body of a content is displayed. If it returns @code{nil},
344 content-body is hidden. In default, it returns non-@code{nil} when
345 content-type of a content is a member of variable
346 @code{mime-viewer/default-showing-Content-Type-list}.
347
348 When content-body of a content is displayed, content-body is formated
349 by content-filter. Content-filter is searched from variable
350 @code{mime-viewer/content-filter-alist}. At this time, major-mode of
351 the article buffer is used as the key.
352
353 If it is not found, function @code{mime-viewer/default-content-filter}
354 is called.
355
356
357 @defvar mime-viewer/default-showing-Content-Type-list
358
359 List of content-type. If content-type of a content is a member of this 
360 variable, its body is displayed.
361 @end defvar
362
363
364 @deffn{Function} mime-viewer/body-visible-p cnum cinfo &optional ctype
365
366 Return non-@code{nil}, if content-type of a content is displayed.
367 @var{cnum} is content-number of a content. @var{cinfo} is content-info
368 of the message. If you know content-type of a content, you can specify
369 it as argument @var{ctype}.
370 @end deffn
371
372
373 @defvar mime-viewer/content-filter-alist
374
375 Association-list whose key is major-mode of a article buffer, value is
376 content-filter.
377 @end defvar
378
379
380 @deffn{Function} mime-viewer/default-content-filter cnum cinfo ctype params subj
381
382 It is called when content-body of a content should be displayed and
383 content-filter is not found in
384 @code{mime-viewer/content-filter-alist}.
385
386 In default, it does nothing.
387 @end deffn
388
389
390 @node content-separator, , content-body, Preview Buffer
391 @comment  node-name,  next,  previous,  up
392 @section content-separator
393 @cindex content-separator
394
395 Content-separator is displayed to represent boundary of contents.
396
397 Content-separator is displayed by function
398 @code{mime-viewer/default-content-separator}. In default, it displays
399 line-break when content-header and content-body are not displayed.
400
401 If you want to change this condition, please redefine this function.
402
403
404 @deffn{Function} mime-viewer/default-content-separator cnum cinfo ctype params subj
405
406 Display content-separator. @var{cnum} is content-number of a
407 content. @var{cinfo} is content-info of the message. @var{ctype} is
408 content-type of a content. @var{params} is Content-Type field
409 parameters of a content. @var{subj} is subject.
410
411 In default, it displays line-break when content-header and
412 content-body are not displayed.
413 @end deffn
414
415
416 @node Decoding, environment variables, Preview Buffer, Top
417 @comment  node-name,  next,  previous,  up
418 @chapter Decoding
419 @cindex Decoding
420
421 In @code{mime/viewer-mode}, you can do play (@key{v}), extract
422 (@key{e}), or print (@key{C-c C-p}) for each content. These operations
423 are called ``decoding operation(s) (for a content)''. And kind of
424 decoding operations are called @strong{decoding-mode}.
425
426 When decoding operation is driven, tm-view calls a procedure matched
427 for the condition, such as content-type. This procedure is called
428 @strong{method}.
429
430 There are two kinds of method. One is Emacs Lisp function, called
431 @strong{internal method}. Another one is external program, called
432 @strong{external method}.
433
434 Internal method operates in Emacs, so it can do carefully.
435
436 External method is called as asynchronous process, so Emacs does not
437 wait while method is running. So it is good for big data, such as
438 audio, image or video.
439
440 @menu
441 * decoding-condition:: Setting of content decoding condition.
442 * Format of method value:: Format of method value part.
443 * Example of decoding-condition:: Examples of decoding-condition.
444 @end menu
445
446
447 @node decoding-condition, Format of method value, Decoding, Decoding
448 @comment  node-name,  next,  previous,  up
449 @section Setting of content decoding condition
450 @cindex Setting of content decoding condition
451
452 When decoding operation is driven, tm-view calls a method matched for
453 the condition searched from the variable
454 @code{mime/content-decoding-condition}.
455
456 Variable @code{mime/content-decoding-condition} is defined as a list
457 with the following syntax:
458
459 @lisp
460         (condition1 condition2 ...)
461 @end lisp
462
463 Each condition are association-list with the following syntax:
464
465 @lisp
466         ((field-type_1 . value_1)
467          (field-type_2 . value_2)
468          ...)
469 @end lisp
470
471 For example, if you want to call the external method named tm-plain to
472 decode every text/plain type content, you can define the condition
473 like
474
475 @lisp
476         ((type . "text/plain")
477          (method "tm-plain" nil 'file 'type 'encoding 'mode 'name))
478 @end lisp
479
480 As you notice, now you can define the arguments to pass to a external
481 method.  Refer to @xref{Format of method value} section for more
482 explanation.
483
484 This condition definition will match all contents whose types are
485 text/plain. Here is an another example:
486
487 @lisp
488         ((type . "text/plain")
489          (method "tm-plain" nil 'file 'type 'encoding 'mode 'name)
490          (mode . "play"))
491 @end lisp
492
493 This will match the content whose type is text/plain and the mode is
494 play.
495
496 @lisp
497         ((method "metamail" t "-m" "tm" "-x" "-d" "-z" "-e" 'file)
498          (mode . "play"))
499 @end lisp
500
501 This will match all contents which have a mode of play.
502
503 The conditions defined in a mime/content-decoding-condition variable
504 are examined from top to bottom.  The first matching condition becomes
505 valid and the method specified in that condition definition will be
506 executed.
507
508
509 @node Format of method value, Example of decoding-condition, decoding-condition, Decoding
510 @comment  node-name,  next,  previous,  up
511 @section Format of method value part
512 @cindex Format of method value part
513
514 You can specify the method field of the decoding-condition definition
515 in two different ways,
516
517 @lisp
518         (method . SYMBOL)
519 @end lisp
520
521 or
522
523 @lisp
524         (method  STRING  FLAG  ARGUMENT1  ARGUMENT2  ...)
525 @end lisp
526
527 can be accepted.
528
529 When a symbol is specified in the method field, a function whose name
530 is SYMBOL will be called as an internal method.
531
532 When a list is specified in the method field, it will be called as an
533 external method.
534
535 The list below shows the meaning of the parameters when the external
536 method is specified in the method field.
537
538 @table @samp
539 @item STRING
540         name of an external method
541 @item FLAG
542         If @code{t}, both the content header and the content body are
543         passed to an external method. if nil, only the content body is
544         passed to an external method.
545 @item ARGUMENTs
546         list of arguments passed to an external method
547 @end table
548
549 An argument passed to an external method can be in one of the
550 following formats:
551
552 @table @samp
553 @item STRING
554         string itself
555 @item 'SYMBOL
556         value gotten using SYMBOL as a key (see below)
557 @item 'STRING
558         value gotten using STRING as a key (see below)
559 @end table
560
561 'SYMBOL can be one of the following:
562
563 @table @samp
564 @item 'file
565         name of a file holding the original content
566 @item 'type
567         content-type/sub-type of Content-Type field
568 @item 'encoding
569         field body of Content-Transfer-Encoding field
570 @item 'mode
571         decoding-mode
572 @item 'name
573         name of a file created by decode operation
574 @end table
575
576 'STRING is used to search a parameter of the Content-Type field whose
577 name matches with it, and pass the value of that parameter to the
578 external method.
579
580
581 @node Example of decoding-condition,  , Format of method value, Decoding
582 @comment  node-name,  next,  previous,  up
583 @section Examples of decoding-condition
584 @cindex Examples of decoding-condition
585
586 The default definition of a mime/content-decoding-condition variable
587 is shown below.
588
589 @lisp
590 (defvar mime/content-decoding-condition
591   '(((type . "text/plain")
592      (method "tm-plain" nil 'file 'type 'encoding 'mode 'name))
593     ((type . "text/x-latex")
594      (method "tm-latex" nil 'file 'type 'encoding 'mode 'name))
595     ((type . "audio/basic")
596      (method "tm-au"    nil 'file 'type 'encoding 'mode 'name))
597     ((type . "image/gif")
598      (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
599     ((type . "image/jpeg")
600      (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
601     ((type . "image/tiff")
602      (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
603     ((type . "image/x-tiff")
604      (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
605     ((type . "image/x-xbm")
606      (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
607     ((type . "image/x-pic")
608      (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
609     ((type . "video/mpeg")`
610      (method "tm-mpeg"  nil 'file 'type 'encoding 'mode 'name))
611     ((type . "application/octet-stream")
612      (method "tm-file"  nil 'file 'type 'encoding 'mode 'name))
613     ((type . "message/partial")
614      (method . mime/decode-message/partial-region))
615     ((method "metamail" t
616              "-m" "tm" "-x" "-d" "-z" "-e" 'file)(mode . "play"))
617     ))
618 @end lisp
619
620 For example, if you want to use metamail to decode any contents,
621
622 @lisp
623 (setq mime/content-decoding-condition
624       '(
625         ((method "metamail" t "-m" "tm" "-x" "-d" "-z" "-e" 'file))
626        ))
627 @end lisp
628
629 will work.
630
631 A mime/content-decoding-condition variable provides you of very flexible
632 way to define the conditions of decoding.  It can be simple if you only
633 need the a few decoding methods, while it can be very complicated if you
634 want to use the separate decoding method for each type/mode combination.
635
636
637 Following function may be useful to set decoding-condition. It is a
638 function of tl-atype.el.
639
640
641 @deffn{Function} set-atype symbol alist
642
643 Add condition @var{alist} to symbol @var{symbol}.
644
645 Example:
646
647 @lisp
648 (set-atype 'mime/content-decoding-condition
649            '((type . "message/external-body")
650              ("access-type" . "anon-ftp")
651              (method . mime/decode-message/external-ftp)
652              ))
653 @end lisp
654 @end deffn
655
656
657 @node environment variables, encoded-word, Decoding, Top
658 @comment  node-name,  next,  previous,  up
659 @chapter environment variables
660 @cindex environment variables
661
662 Standard methods of tm-view reference some environment variables. You
663 can specify them to customize.
664
665
666 @table @var
667 @item TM_TMP_DIR
668 Directory for temporary files or extracted files. Default value is
669 `/tmp/'.
670
671 @item VIDEO_DITHER
672 Dither for mpeg_play. Default value is `gray'.
673
674 @item TM_WWW_BROWSER
675 WWW browser name. Default value is `netscape'.
676 @end table
677
678
679 @node encoded-word, Concept Index, environment variables, Top
680 @comment  node-name,  next,  previous,  up
681 @chapter encoded-word
682 @cindex encoded-word
683 @cindex non-ASCII field
684 @cindex message header
685
686 tm-view can decode encoded-word defined in RFC 1522.
687
688 @deffn{Command} mime/decode-message-header
689
690 It decodes encoded-words in message header of current buffer.
691 @end deffn
692
693
694 @deffn{Command} mime-eword/decode-region beg end &optional unfolding
695
696 It decodes encoded-words in region @var{beg} to @var{end}.
697
698 If @var{unfolding} is non-nil, folded fields are unfolded.
699 @end deffn
700
701
702 @deffn{Function} mime-eword/decode-string str
703
704 It decodes encoded-words in @var{str}.
705
706 Folded string is unfolded.
707 @end deffn
708
709
710 @node Concept Index, Command Index, encoded-word, Top
711 @unnumbered Concept Index
712
713 @printindex cp
714
715
716 @node Command Index, Variable Index, Concept Index, Top
717 @unnumbered Command and Function Index
718
719 @printindex fn
720
721
722 @node Variable Index,  , Command Index, Top
723 @unnumbered Variable Index
724
725 @printindex vr
726
727 @bye