Source

tm / texi / tm-view-en.sgml

Full commit
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
<!doctype sinfo system>
<!-- $Id$ -->
<head>
<title>tm-view 7.80 Reference Manual (English Version)
<author>MORIOKA Tomohiko <mail>morioka@jaist.ac.jp</mail>
<date>1997/1/31

<toc>
</head>

<body>

<abstract>
<p>
This file documents tm-view, a MIME Viewer for GNU Emacs.
</abstract>


<h1> What is tm-view?
<node> Introduction
<p>
The tm-view is a general MIME viewer running on GNU Emacs.
<p>
tm-view provides the major-mode called <a
node="mime/viewer-mode"><code>mime/viewer-mode</code> </a> to read
MIME message for MUA.  <a file="tm-en" node="MUA">MUA</a> implementer
can use it to add MIME function.
<p>
tm-view is a user interface kernel to view and navigate MIME message.
tm-view drives some programs to navigate each <dref
file="tm-en">content-type</dref>s, they are called <a
node="method"><concept>method</concept></a>.  tm-view calls some
programs to display each contents and headers in preview buffer, they
are called <a node="Two buffers for an
article"><concept>filter</concept></a>.  Method and filters are
tm-view application program.  They expand tm-view to treat various
kinds of MIME types.


<h1> Structure of display in mime/viewer-mode
<node> MIME display
<p>
In <a node="mime/viewer-mode">mime/viewer-mode</a>, following are
displayed for each parts:
<p>
<verb>
	[content-button]
	(content-header)
	
	(content-body)
	(content-separator)
</verb>
<p>
You can change design or stop to display if you specify for each
conditions, such as content-types.
<p>
Example:

<verb>
From: morioka@jaist.ac.jp (MORIOKA Tomohiko)
Subject: Re: Question
Newsgroups: zxr.message.mime
Date: 22 Oct 93 11:02:44
Mime-Version: 1.0
Organization: Japan Advanced Institute of Science and Technology,
        Ishikawa, Japan

[1  (text/plain)]
  How to compose MIME message in MIME-Edit mode.

  Press `C-c C-x ?' then help message will be displayed:

C-c C-x C-t	insert a text message.
C-c C-x TAB	insert a (binary) file.
C-c C-x C-e	insert a reference to external body.
C-c C-x C-v	insert a voice message.
C-c C-x C-y	insert a mail or news message.
C-c C-x RET	insert a mail message.
C-c C-x C-s	insert a signature file at end.
C-c C-x t	insert a new MIME tag.
C-c C-x a	enclose as multipart/alternative.
C-c C-x p	enclose as multipart/parallel.
C-c C-x m	enclose as multipart/mixed.
C-c C-x d	enclose as multipart/digest.
C-c C-x s	enclose as PGP signed.
C-c C-x e	enclose as PGP encrypted.
C-c C-x C-k	insert PGP public key.
C-c C-x C-p	preview editing MIME message.
...

So press `C-c C-x C-i' and specify file name you want to include.

  MIME encoding for binary file is normally Base64.

[2  (image/gif)]

[3  (text/plain)]

  In this way, it is finish a message attaching a picture.

======================== A cup of Russian tea ========================
============  * not by jam, not by marmalade, by honey *  ============
============               MORIOKA Tomohiko               ============
=============== Internet E-mail: <morioka@jaist.ac.jp> ===============
</verb>


<h2> content-button
<node> content-button
<p>
content-subject displays abstract for the part.  It is placed in top
of the part.
<p>
In default, it is displayed following design:

<verb>
        [1.3 test (text/plain)]
</verb>

<p>
First number field represents position of a content in the part.  It
is called <concept>content-number</concept>.  It can be considered as
the chapter number in the message.
<p>
Second string part represents title.  It is created by following:

<ol>
<li>name paramater or x-name parameter in <dref
file="tm-en">Content-Type field</dref>
</li>
<li><dref file="tm-en">Content-Description field</dref> or Subject
field
</li>
<li> filename of uuencode
</ol>

<p>
If they are not exists, space is displayed.
<p>
Third parenthesis part represents content-type/subtype of the part.
If it is non-MIME part, <code>nil</code> is displayed.
<p>
Content-button is used like icon when <dref>content-header</dref> and
<dref>content-body</dref> are hidden.  For example:

<verb>
        [2  (image/gif)]
</verb>

<noindent>
if you press <kbd>v</kbd> key, GIF image is displayed.
<p>
If mouse operations are available, you can press content-button by
mouse button-2 (center button of 3 button-mouse) to play, similarly to
press <kbd>v</kbd> key. <cf node="mime/viewer-mode">
<p>
By the way, it is annoying to display content-button if content-header
is displayed.  So tm-view provides a mechanism to specify conditions
to display content-button.


<defvar name="mime-viewer/content-button-ignored-ctype-list">
<p>
List of content-types.
<p>
If content-type of a part is a member of this list, its content-button
is not displayed.
</defvar>


<h2> content-header
<node> content-header
<p>
A content header displays the header portion of a part in the
preview-buffer.  However it is annoying to display header for every
parts, so tm-view provides a mechanism to specify its condition.
<p>
When the function <code>mime-viewer/header-visible-p</code> returns
<code>t</code> for reversed-content-number of a part, content-header
is displayed.
<p>
This judge function returns <code>t</code> when a part is root or
content-type of its parent is a member of the variable
<code>mime-viewer/childrens-header-showing-Content-Type-list</code>.
<p>
If you want to change this condition, please redefine it.  Notice that
it refers variable
<code>mime-viewer/childrens-header-showing-Content-Type-list</code>,
however if you redefine function
<code>mime-viewer/header-visible-p</code>, it may not work.  So if you
want to redefine it, it should be refer variable
<code>mime-viewer/childrens-header-showing-Content-Type-list</code>.
<p>
When content-header is displayed, content-header are formated by the
program called by <concept>content-header-filter</concept>.
Content-header-filter is searched from variable
<code>mime-viewer/content-header-filter-alist</code>.  Its key is
major-mode of the <a node="raw-article-buffer">raw-article-buffer</a>.
If not found, function
<code>mime-viewer/default-content-header-filter</code> is called.
<p>

<defvar name="mime-viewer/childrens-header-showing-Content-Type-list">
<p>
List of content-types.  If content-type of parent of a part is a
member of this variable, its content-header is displayed.  Default
value is <code>'("message/rfc822" "message/news")</code>.
<p>
This variable is referred by the function
<code>mime-viewer/header-visible-p</code>.
</defvar>


<defun name="mime-viewer/header-visible-p">
<args> rcnum cinfo <opts> ctype
<p>
Returns <code>t</code> if a part which reversed-content-number is
<var>rcnum</var> in content-info <var>cinfo</var> is displayed.
<p>
If you know content-type, you can specify by <var>ctype</var>.
</defun>


<defvar name="mime-viewer/content-header-filter-alist">
<p>
Association-list whose key is major-mode of a raw-article-buffer,
value is content-header-filter.
</defvar>


<defun name="mime-viewer/default-content-header-filter">
<p>
It is called when content-header-filter is not found in variable
<code>mime-viewer/content-header-filter-alist</code>.
<p>
It refers <code>mime-viewer/ignored-field-regexp</code>.
</defun>


<defvar name="mime-viewer/ignored-field-list">
<p>
List of regular expression to represent invisible fields even if
content-header is displayed.
<p>
Variable <code>mime-viewer/ignored-field-regexp</code> is created from
it.
<p>
Please use function <code>tm:add-fields</code> or
<code>tm:delete-fields</code> to set it.
</defvar>


<h2> content-body
<node> content-body
<p>
<concept>content-body</concept> represents content of the part.
<p>
tm-view does not display raw content body.  For example, if a content
has binary, it is hidden.  If a content has text/enriched, it is
formated.  Namely content body is hidden or formated.
<p>
Function <code>mime-viewer/body-visible-p</code> is a judge function
whether content-body of a content is displayed.  If it returns
<code>nil</code>, content-body is hidden.  In default, it returns
non-<code>nil</code> when content-type of a part is a member of
variable <code>mime-viewer/default-showing-Content-Type-list</code>.
<p>
When content-body of a content is displayed, content-body is formated
by <concept>content-filter</concept>.  Content-filter is searched from
variable <code>mime-viewer/content-filter-alist</code>.  At this time,
major-mode of the <dref>raw-article-buffer</dref> is used as the key.

If it is not found, function
<code>mime-viewer/default-content-filter</code> is called.


<defvar name="mime-viewer/default-showing-Content-Type-list">
<p>
List of content-type.  If content-type of a part is a member of this
variable, its body is displayed.
</defvar>


<defun name="mime-viewer/body-visible-p">
<args> rcnum cinfo <opts> ctype
<p>
Return non-<code>nil</code>, if content-type of a part is displayed.
<var>rcnum</var> is reversed-content-number of a part.
<var>cinfo</var> is content-info of the message.  If you know
content-type of a part, you can specify it as argument
<var>ctype</var>.
</defun>


<defvar name="mime-viewer/content-filter-alist">
<p>
Association-list whose key is major-mode of a raw-article-buffer,
value is content-filter.
</defvar>


<defun name="mime-viewer/default-content-filter">
<args> rcnum cinfo ctype params subj
<p>
It is called when content-body of a part should be displayed and
content-filter is not found in
<code>mime-viewer/content-filter-alist</code>.
<p>
In default, it does nothing.
</defun>


<h2> content-separator
<node> content-separator
<p>
<concept>content-separator</concept> is displayed to represent
boundary of contents.
<p>
Content-separator is displayed by function
<code>mime-viewer/default-content-separator</code>.  In default, it
displays line-break when content-header and content-body are not
displayed.
<p>
If you want to change this condition, please redefine this function.


<defun name="mime-viewer/default-content-separator">
<args> rcnum cinfo ctype params subj
<p>
Display content-separator.  <var>cnum</var> is content-number of a
content.  <var>cinfo</var> is content-info of the message.
<var>ctype</var> is content-type of a content.  <var>params</var> is
Content-Type field parameters of a content.  <var>subj</var> is
subject.
<p>
In default, it displays line-break when content-header and
content-body are not displayed.
</defun>


<h1> Navigation in mime/viewer-mode
<node> mime/viewer-mode
<p>
<code>mime/viewer-mode</code> has following functions:
<p>
<kl>
<kt>u
<kd>
goes to the upper content (returns to the Summary mode if the cursor
is sitting on the top content (*1))
</kd>
<kt>p
<kd>
goes to the previous content
</kd>
<kt>M-TAB
<kd>
goes to the previous content
</kd>
<kt>n
<kd>
goes to the next content
</kd>
<kt>TAB
<kd>
goes to the next content
</kd>
<kt>SPC
<kd>
scrolls up
</kd>
<kt>M-SPC
<kd>
scrolls down
</kd>
<kt>DEL
<kd>
scrolls down
</kd>
<kt>RET
<kd>
goes to the next line
</kd>
<kt>M-RET
<kd>
goes to the previous line
</kd>
<kt>&lt;
<kd>
goes to the beginning of message
</kd>
<kt>&gt;
<kd>
goes to the end of message
</kd>
<kt>v
<kd>
playbacks a part (*2)
</kd>
<kt>e
<kd>
extracts a file from a part (*2)
</kd>
<kt>C-c C-p
<kd>
prints a part (*2)
</kd>
<kt>f
<kd>
displays X-Face in the message
</kd>
<kt>mouse-button-2
<kd>
drives mouse button in preview-buffer.
<p>
For content-button, it playbacks a part (*2)
<p>
For URL-button, it drives WWW browser
</kd>
</kl>
<p>
<memo title="Notice">
<p>
(*1) Not return to the Summary mode unless tm-view has been setup
using tm-mh-e, tm-vm, gnus-mime, tm-gnus, tm-rmail etc.
<p>
(*2) Actual playback/extract/print will be performed by a method.
</memo>


<h1> Mechanism of decoding
<node> method
<p>
In <code>mime/viewer-mode</code>, you can do play (<kbd>v</kbd>),
extract (<kbd>e</kbd>), or print (<kbd>C-c C-p</kbd>) for each parts.
These operations are called <concept>decoding operation(s) (for a
part)</concept>.  And kind of decoding operations are called
<concept>decoding-mode</concept>.
<p>
When decoding operation is driven, tm-view calls a procedure matched
for the condition, such as <dref file="tm-en">content-type</dref> of
the part or its environment.  This procedure is called
<concept>method</concept>.
<p>
There are two kinds of methods.  One is Emacs Lisp function, called
<concept>internal method</concept>.  Another one is external program,
called <concept>external method</concept>.
<p>
Internal method operates in Emacs, so it can do carefully.
<p>
External method is called as asynchronous process, so Emacs does not
wait while method is running.  So it is good for big data, such as
audio, image or video.


<h2> Setting decoding condition for parts
<node> decoding-condition
<p>
When decoding operation is driven, tm-view calls a method matched for
the condition searched from the variable
<code>mime/content-decoding-condition</code>.
<p>
Variable <code>mime/content-decoding-condition</code> is defined as a
list with the following syntax:
<p>
<lisp>
        (condition_1 condition_2 ...)
</lisp>
<p>
Each condition are association-list with the following syntax:
<p>
<lisp>
        ((field-type_1 . value_1)
         (field-type_2 . value_2)
         ...)
</lisp>
<p>
For example, if you want to call the external method named tm-plain to
decode every <dref file="tm-en">text/plain</dref> type parts, you can
define the condition like:
<p>
<lisp>
        ((type . "text/plain")
         (method "tm-plain" nil 'file 'type 'encoding 'mode 'name))
</lisp>
<p>
This condition definition will match all parts whose <dref
file="tm-en">content-type</dref> are text/plain.  Here is an another
example:
<p>
<lisp>
        ((type . "text/plain")
         (method "tm-plain" nil 'file 'type 'encoding 'mode 'name)
         (mode . "play"))
</lisp>
<p>
This will match the part whose type is text/plain and the mode is
play.
<p>
Here is an another example:
<p>
<lisp>
        ((method "metamail" t "-m" "tm" "-x" "-d" "-z" "-e" 'file)
         (mode . "play"))
</lisp>
<p>
This will match all parts which have a mode of play.
<p>
The conditions defined in a variable
<code>mime/content-decoding-condition</code> are examined from top to
bottom.  The first matching condition becomes valid and the method
specified in that condition definition will be executed.


<h3> Format of method value
<node> method value
<p>
You can specify the method field of the decoding-condition definition
in two different ways,
<p>
<lisp>
        (method . SYMBOL)
</lisp>
<p>
<noindent>
or
<p>
<lisp>
        (method  STRING  FLAG  arg1  arg2  ...)
</lisp>
<p>
<noindent>
can be accepted.
<p>
When a symbol is specified in the method field, a function whose name
is SYMBOL will be called as an internal method.
<p>
When a list is specified in the method field, it will be called as an
external method.
<p>
The list below shows the meaning of the parameters when the external
method is specified in the method field.
<p>
<dl>
<dt>STRING
<dd>name of an external method
</dd>
<dt>FLAG
<dd>If <code>t</code>, both the content-header and the content-body
are passed to an external method.
<p>
If <code>nil</code>, only the content-body is passed to an external
method.
</dd>
<dt>ARGUMENTs
<dd>list of arguments passed to an external method
</dd>
</dl>
<p>
An argument passed to an external method can be in one of the
following formats:
<p>
<dl>
<dt>STRING
<dd>string itself
</dd>
<dt>'SYMBOL
<dd>value gotten using SYMBOL as a key from decoding-condition
</dd>
<dt>'STRING
<dd>value gotten using STRING as a key from decoding-condition
</dd>
</dl>
<p>
<code>'SYMBOL</code> can be one of the following:
<p>
<dl>
<dt>'file
<dd>name of a file holding the original content
</dd>
<dt>'type
<dd>content-type/sub-type of Content-Type field
</dd>
<dt>'encoding
<dd>field body of Content-Transfer-Encoding field
</dd>
<dt>'mode
<dd>decoding-mode
</dd>
<dt>'name
<dd>name of a file created by decode operation
</dd>
</dl>

<p>
<code>'STRING</code> is used to search a parameter of the Content-Type
field whose name matches with it, and pass the value of that parameter
to the external method.


<h3> Example of decoding-condition
<node> Example of decoding-condition
<p>
Following is an example of decoding-condition:

<lisp>
(defvar mime/content-decoding-condition
  '(((type . "text/plain")
     (method "tm-plain" nil 'file 'type 'encoding 'mode 'name))
    ((type . "text/x-latex")
     (method "tm-latex" nil 'file 'type 'encoding 'mode 'name))
    ((type . "audio/basic")
     (method "tm-au"    nil 'file 'type 'encoding 'mode 'name))
    ((type . "image/gif")
     (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
    ((type . "image/jpeg")
     (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
    ((type . "image/tiff")
     (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
    ((type . "image/x-tiff")
     (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
    ((type . "image/x-xbm")
     (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
    ((type . "image/x-pic")
     (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
    ((type . "video/mpeg")`
     (method "tm-mpeg"  nil 'file 'type 'encoding 'mode 'name))
    ((type . "application/octet-stream")
     (method "tm-file"  nil 'file 'type 'encoding 'mode 'name))
    ((type . "message/partial")
     (method . mime/decode-message/partial-region))
    ((method "metamail" t
             "-m" "tm" "-x" "-d" "-z" "-e" 'file)(mode . "play"))
    ))
</lisp>

<p>
For example, if you want to use metamail to decode any contents,

<lisp>
(setq mime/content-decoding-condition
      '(
        ((method "metamail" t "-m" "tm" "-x" "-d" "-z" "-e" 'file))
       ))
</lisp>

<noindent>
will work.
<p>
Variable <code>mime/content-decoding-condition</code> provides you of
very flexible way to define the conditions of decoding.  It can be
simple if you only need the a few decoding methods, while it can be
very complicated if you want to use the separate decoding method for
each type/mode combination.
<p>
Following function may be useful to set decoding-condition.  It is a
function of <file>tl-atype.el</file>.


<defun name="set-atype">
<args> symbol alist
<p>
Add condition <var>alist</var> to <var>symbol</var>.

<memo title="Example">
<p>
<lisp>
(set-atype 'mime/content-decoding-condition
	   '((type . "message/external-body")
	     ("access-type" . "anon-ftp")
	     (method . mime/decode-message/external-ftp)
	     ))
</lisp>
</memo>
</defun>


<h2> Environment variables
<node> environment variables
<p>
Standard methods of tm-view reference some environment variables.  You
can specify them to customize.

<vl>
<dt>TM_TMP_DIR
<dd>
Directory for temporary files or extracted files.  If it is omitted,
<file>/tmp/</file> is used.
</dd>
<dt>VIDEO_DITHER
<dd>
Dither for mpeg_play.  If it is omitted, `gray' is used.
</dd>
<dt>TM_WWW_BROWSER
<dd>
WWW browser name.  If it is omitted, `netscape' is used.
</vl>


<h1> raw-article-buffer and preview-buffer
<node> Two buffers for an article
<p>
tm-view managements two buffers, one is for raw message called
<concept>raw-article-buffer</concept>, another one is to preview for
user called <concept>preview-buffer</concept>.  major-mode of
raw-article-buffer is same as major-mode for article of original MUA,
major-mode of preview-buffer is <a
node="mime/viewer-mode"><code>mime/viewer-mode</code></a>.
<p>
When called <code>mime/viewer-mode</code>, tm-view analyzes
raw-article-buffer, and sets its result to the variable
<code>mime::article/content-info</code>.
<p>
After that, tm-view create a preview-buffer corresponded to the
raw-article-buffer.  As this time, tm-view modifies header and body of
each parts of the message by specified conditions.  Filter program for
header is called <a
node="content-header"><concept>header-filter</concept></a>, filter
program for body is called <a
node="content-body"><concept>content-filter</concept></a>, and they
are called <concept>filter</concept>.
<p>
When preview-buffer is made, buffer local variable of preview-buffer
<code>mime::preview/content-list</code> is made to register structure
of preview-buffer.  tm-view manages message by
<code>mime::article/content-info</code> in raw-article-buffer and
<code>mime::preview/content-list</code> in preview-buffer.
<p>
<memo title="Notice">
In this document, I call ``content-type'' as content-type/subtype of
Content-Type field.
</memo>


<h2> buffer local variables of raw-article-buffer
<node> raw-article-buffer
<p>
<define type="Structure" name="mime::content-info">
<args> rcnum point-min point-max type parameters encoding children
<p>
structure to represent MIME content in raw-article-buffer.  It is
called by <concept>content-info</concept>.
<p>
Please use reference function
<code>mime::content-info/SLOT-NAME</code> to reference slot of
content-info.  Their argument is only content-info.
<p>
Following is a list of slots of the structure:

<vl>
<dt>rcnum<dd>``reversed content-number'' (list)
</dd>
<dt>point-min<dd>beginning point of region in raw-article-buffer
</dd>
<dt>point-max<dd>end point of region in raw-article-buffer
</dd>
<dt>type<dd>content-type/sub-type (string or nil)
</dd>
<dt>parameters<dd>parameter of Content-Type field (association list)
</dd>
<dt>encoding<dd>Content-Transfer-Encoding (string or nil)
</dd>
<dt>children<dd>parts included in this part (list of content-infos)
</dd>
</vl>
<p>
If a part includes other parts in its contents, such as multipart or
message/rfc822, content-infos of other parts are included in
<var>children</var>, so content-info become a tree.
</define>

<defvar name="mime::article/content-info">
<p>
result of MIME parsing of raw-article-buffer (content-info)
</defvar>

<defvar name="mime::article/preview-buffer">
<p>
preview-buffer corresponded by this buffer
</defvar>

<defun name="mime-article/point-content-number">
<args> point <opts> cinfo
<p>
In a region managed by content-info <var>cinfo</var>, it returns
content-number corresponded by <var>point</var>.
<p>
If <var>cinfo</var> is omitted,
<code>mime::article/content-info</code> is used as default value.
</defun>

<defun name="mime-article/rcnum-to-cinfo">
<args> rcnum <opts> cinfo
<p>
In a region managed by content-info <var>cinfo</var>, it returns
content-info corresponded by reversed-content-number <var>rcnum</var>.
<p>
If <var>cinfo</var> is omitted,
<code>mime::article/content-info</code> is used as default value.
</defun>

<defun name="mime-article/cnum-to-cinfo">
<args> rcnum <opts> cinfo
<p>
In a region managed by content-info <var>cinfo</var>, it returns
content-info corresponded by content-number <var>rcnum</var>.
<p>
If <var>cinfo</var> is omitted,
<code>mime::article/content-info</code> is used as default value.
</defun>

<defun name="mime/flatten-content-info">
<args> <opts> cinfo
<p>
It returns flatten list of content-info from content-info
<var>cinfo</var> tree.
<p>
If <var>cinfo</var> is omitted,
<code>mime::article/content-info</code> is used as default value.
</defun>


<h2> Buffer local variables of preview-buffer
<node> preview-buffer
<p>
<defvar name="mime::preview/mother-buffer">
<p>
Mother buffer of this preview-buffer.
</defvar>

<define type="Structure" name="mime::preview-content-info">
<args> point-min point-max buffer content-info
<p>
structure to represent MIME content in preview-buffer.  It is called
by <concept>preview-content-info</concept>.
<p>
Please use reference function
<code>mime::preview-content-info/SLOT-NAME</code> to reference slot of
preview-content-info.  Their argument is only preview-content-info.
<p>
Following is a list of slots of the structure:

<vl>
<dt>point-min<dd>beginning point of region in preview-buffer
</dd>
<dt> point-max<dd>end point of region in preview-buffer
</dd>
<dt>buffer<dd>raw-article-buffer corresponding a part
</dd>
<dt>content-info<dd>content-info corresponding a part
</dd>
</vl>
</define>


<defvar name="mime::preview/content-list">
<p>
List of preview-content-info to represent structure of this
preview-buffer.
</defvar>


<defvar name="mime::preview/article-buffer">
<p>
raw-article-buffer corresponded by this preview-buffer.
</defvar>


<defvar name="mime::preview/original-major-mode">
<p>
major-mode of original buffer.
</defvar>


<defvar name="mime::preview/original-window-configuration">
<p>
window-configuration just before made this preview-buffer.
</defvar>


<defun name="mime-preview/point-pcinfo">
<args> point <opts> pcl
<p>
In a region of preview-buffer managed by preview-content-info
<var>pcl</var>, it returns preview-content-info corresponded by
<var>point</var>.
<p>
If <var>cinfo</var> is omitted,
<code>mime::preview/content-list</code> is used.
</defun>


<h1> Functions to decode MIME message
<node> API
<p>
tm-view provides some available functions to decode and navigate MIME
message to each <a file="tm-en" node="MUA">MUA</a>s.
<p>
There are 2 kinds of functions, one is for MIME preview, another one
is to decode RFC 1522 <dref file="tm-en">encoded-word</dref>.


<h2> Function to preview MIME message
<node> API about MIME preview
<p>

<define type="Command" name="mime/viewer-mode">
<opts> mother ctl encoding ibuf obuf mother-keymap
<p>
Parse <var>ibuf</var> as a MIME message, and create preview-buffer
into <var>obuf</var> to display to user, then enter <a
node="mime/viewer-mode"><code>mime/viewer-mode</code></a>.
<p>
If <var>ibuf</var> is omitted, current buffer is used.
<p>
<var>mother</var> is used to specify original raw-article-buffer.  It
may be useful when a raw-article-buffer is assembled from
message/partial messages.
<p>
<var>ctl</var> is used to specify <dref file="tm-en">Content-Type
field</dref> information.  Its format is output format of
<code>mime/Content-Type</code>.  When <var>ctl</var> is specified,
tm-view uses it instead of Content-Type field of the
raw-article-buffer.
<p>
<var>encoding</var> is used to specify field-body of
Content-Transfer-Encoding field.  When is is specified, tm-view uses
it instead of Content-Type field of the raw-article-buffer.
<p>
If <var>mother-keymap</var> is specified, keymap of
<code>mime/viewer-mode</code> includes it.
</define>


<h2> encoded-word decoder
<node> encoded-word decoding
<p>
tm-view has functions to decode RFC 1522 <dref
file="tm-en">encoded-word</dref>.


<define type="Command" name="mime/decode-message-header">
<p>
It decodes encoded-words in message header of current buffer.
<p>
If an encoded-word is broken or invalid, or it has non supported <a
file="tm-en" node="MIME charset">MIME charset</a>, it is not decoded.
</define>


<define type="Command" name="mime-eword/decode-region">
<args> start end <opts> unfolding must-unfold
<p>
It decodes encoded-words in region <var>start</var> to <var>end</var>.
<p>
If an encoded-word is broken or invalid, or it has non supported <a
file="tm-en" node="MIME charset">MIME charset</a>, it is not decoded.
<p>
If <var>unfolding</var> is non-nil, it unfolds folded fields.
<p>
If <var>must-fold</var> is non-nil and decoded result of an
encoded-word has folding or raw CR or LF, it unfolds or delete raw CR
or LF.
</define>


<defun name="mime-eword/decode-string">
<args> string <opts> must-unfold
<p>
It decodes encoded-words in <var>string</var> and returns decoded
string.
<p>
If an encoded-word is broken or invalid, or it has non supported <a
file="tm-en" node="MIME charset">MIME charset</a>, it is not decoded.
<p>
If <var>string</var> is folded, it unfolds <var>string</var> before
decoding.
<p>
If <var>must-fold</var> is non-nil and decoded result of an
encoded-word has folding or raw CR or LF, it unfolds or delete raw CR
or LF.
</defun>


<h1> Acknowledgments
<node> Acknowledgments
<p>
First of all, I thank MASUTANI Yasuhiro.  He requested me a lot of
important features and gave me a lot of suggestions when tm-view was
born.  tm-view is based on his influence.
<p>
I thank ENAMI Tsugutomo for work of <file>mime.el</file>, which is an
origin of <file>tm-ew-d.el</file> and <file>mel-b.el</file>, and
permission to rewrite for tm.
<p>
I thank OKABE Yasuo for work of internal method for LaTeX and
automatic assembling method for message/partial.  I thank UENO
Hiroshi for work of internal method for tar archive.
<p>
Last of all, I thank members of two tm mailing lists, Japanese and
English version.


<h1> Concept Index
<node> Concept Index

<cindex>


<h1> Function Index
<node> Function Index

<findex>


<h1> Variable Index
<node> Variable Index

<vindex>

</body>