This file documents tm-view, a MIME Viewer for GNU Emacs.
The tm-view is a general MIME viewer running on GNU Emacs.
tm-view provides the major-mode called mime/viewer-mode
to read
MIME message for MUA. MUA implementer
can use it to add MIME function.
tm-view is a user interface kernel to view and navigate MIME message.
tm-view drives some programs to navigate each
In mime/viewer-mode, following are displayed for each parts:
You can change design or stop to display if you specify for each conditions, such as content-types.
Example:
content-subject displays abstract for the part. It is placed in top of the part.
In default, it is displayed following design:
First number field represents position of a content in the part. It
is called
Second string part represents title. It is created by following:
If they are not exists, space is displayed.
Third parenthesis part represents content-type/subtype of the part.
If it is non-MIME part, nil
is displayed.
Content-button is used like icon when
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 v key.
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.
List of content-types.
If content-type of a part is a member of this list, its content-button
is not displayed.
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.
When the function
This judge function returns
If you want to change this condition, please redefine it. Notice that
it refers variable
When content-header is displayed, content-header are formated by the
program called by
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
This variable is referred by the function
Returns
If you know content-type, you can specify by ctype.
Association-list whose key is major-mode of a raw-article-buffer,
value is content-header-filter.
It is called when content-header-filter is not found in variable
It refers
List of regular expression to represent invisible fields even if
content-header is displayed.
Variable
Please use function
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.
Function
When content-body of a content is displayed, content-body is formated
by
List of content-type. If content-type of a part is a member of this
variable, its body is displayed.
Return non-
Association-list whose key is major-mode of a raw-article-buffer,
value is content-filter.
It is called when content-body of a part should be displayed and
content-filter is not found in
In default, it does nothing.
Content-separator is displayed by function
If you want to change this condition, please redefine this function.
Display content-separator. cnum is content-number of a
content. cinfo is content-info of the message.
ctype is content-type of a content. params is
Content-Type field parameters of a content. subj is
subject.
In default, it displays line-break when content-header and
content-body are not displayed.
For content-button, it playbacks a part (*2)
For URL-button, it drives WWW browser
(*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.
(*2) Actual playback/extract/print will be performed by a method.
In
When decoding operation is driven, tm-view calls a procedure matched
for the condition, such as
There are two kinds of methods. One is Emacs Lisp function, called
Internal method operates in Emacs, so it can do carefully.
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.
When decoding operation is driven, tm-view calls a method matched for
the condition searched from the variable
Variable
Each condition are association-list with the following syntax:
For example, if you want to call the external method named tm-plain to
decode every
This condition definition will match all parts whose
This will match the part whose type is text/plain and the mode is
play.
Here is an another example:
This will match all parts which have a mode of play.
The conditions defined in a variable
You can specify the method field of the decoding-condition definition
in two different ways,
When a symbol is specified in the method field, a function whose name
is SYMBOL will be called as an internal method.
When a list is specified in the method field, it will be called as an
external method.
The list below shows the meaning of the parameters when the external
method is specified in the method field.
If
An argument passed to an external method can be in one of the
following formats:
Following is an example of decoding-condition:
For example, if you want to use metamail to decode any contents,
Variable
Following function may be useful to set decoding-condition. It is a
function of
Add condition alist to symbol.
Standard methods of tm-view reference some environment variables. You
can specify them to customize.
tm-view managements two buffers, one is for raw message called
When called
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
When preview-buffer is made, buffer local variable of preview-buffer
structure to represent MIME content in raw-article-buffer. It is
called by
Please use reference function
Following is a list of slots of the structure:
If a part includes other parts in its contents, such as multipart or
message/rfc822, content-infos of other parts are included in
children, so content-info become a tree.
result of MIME parsing of raw-article-buffer (content-info)
preview-buffer corresponded by this buffer
In a region managed by content-info cinfo, it returns
content-number corresponded by point.
If cinfo is omitted,
In a region managed by content-info cinfo, it returns
content-info corresponded by reversed-content-number rcnum.
If cinfo is omitted,
In a region managed by content-info cinfo, it returns
content-info corresponded by content-number rcnum.
If cinfo is omitted,
It returns flatten list of content-info from content-info
cinfo tree.
If cinfo is omitted,
Mother buffer of this preview-buffer.
structure to represent MIME content in preview-buffer. It is called
by
Please use reference function
Following is a list of slots of the structure:
List of preview-content-info to represent structure of this
preview-buffer.
raw-article-buffer corresponded by this preview-buffer.
major-mode of original buffer.
window-configuration just before made this preview-buffer.
In a region of preview-buffer managed by preview-content-info
pcl, it returns preview-content-info corresponded by
point.
If cinfo is omitted,
tm-view provides some available functions to decode and navigate MIME
message to each MUAs.
There are 2 kinds of functions, one is for MIME preview, another one
is to decode RFC 1522
Parse ibuf as a MIME message, and create preview-buffer
into obuf to display to user, then enter
If ibuf is omitted, current buffer is used.
mother is used to specify original raw-article-buffer. It
may be useful when a raw-article-buffer is assembled from
message/partial messages.
ctl is used to specify
encoding 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.
If mother-keymap is specified, keymap of
tm-view has functions to decode RFC 1522
It decodes encoded-words in message header of current buffer.
If an encoded-word is broken or invalid, or it has non supported MIME charset, it is not decoded.
It decodes encoded-words in region start to end.
If an encoded-word is broken or invalid, or it has non supported MIME charset, it is not decoded.
If unfolding is non-nil, it unfolds folded fields.
If must-fold 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.
It decodes encoded-words in string and returns decoded
string.
If an encoded-word is broken or invalid, or it has non supported MIME charset, it is not decoded.
If string is folded, it unfolds string before
decoding.
If must-fold 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.
content-header
mime-viewer/header-visible-p
returns
t
for reversed-content-number of a part, content-header
is displayed.
t
when a part is root or
content-type of its parent is a member of the variable
mime-viewer/childrens-header-showing-Content-Type-list
.
mime-viewer/childrens-header-showing-Content-Type-list
,
however if you redefine function
mime-viewer/header-visible-p
, it may not work. So if you
want to redefine it, it should be refer variable
mime-viewer/childrens-header-showing-Content-Type-list
.
mime-viewer/content-header-filter-alist
. Its key is
major-mode of the raw-article-buffer.
If not found, function
mime-viewer/default-content-header-filter
is called.
'("message/rfc822" "message/news")
.
mime-viewer/header-visible-p
.
t
if a part which reversed-content-number is
rcnum in content-info cinfo is displayed.
mime-viewer/content-header-filter-alist
.
mime-viewer/ignored-field-regexp
.
mime-viewer/ignored-field-regexp
is created from
it.
tm:add-fields
or
tm:delete-fields
to set it.
content-body
mime-viewer/body-visible-p
is a judge function
whether content-body of a content is displayed. If it returns
nil
, content-body is hidden. In default, it returns
non-nil
when content-type of a part is a member of
variable mime-viewer/default-showing-Content-Type-list
.
mime-viewer/content-filter-alist
. At this time,
major-mode of the mime-viewer/default-content-filter
is called.
nil
, if content-type of a part is displayed.
rcnum is reversed-content-number of a part.
cinfo is content-info of the message. If you know
content-type of a part, you can specify it as argument
ctype.
mime-viewer/content-filter-alist
.
content-separator
mime-viewer/default-content-separator
. In default, it
displays line-break when content-header and content-body are not
displayed.
Navigation in mime/viewer-mode
mime/viewer-mode
has following functions:
Mechanism of decoding
mime/viewer-mode
, you can do play (v),
extract (e), or print (C-c C-p) for each parts.
These operations are called Setting decoding condition for parts
mime/content-decoding-condition
.
mime/content-decoding-condition
is defined as a
list with the following syntax:
mime/content-decoding-condition
are examined from top to
bottom. The first matching condition becomes valid and the method
specified in that condition definition will be executed.
Format of method value
t
, both the content-header and the content-body
are passed to an external method.
nil
, only the content-body is passed to an external
method.
'SYMBOL
can be one of the following:
'STRING
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.
Example of decoding-condition
mime/content-decoding-condition
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.
Environment variables
raw-article-buffer and preview-buffer
mime/viewer-mode
.
mime/viewer-mode
, tm-view analyzes
raw-article-buffer, and sets its result to the variable
mime::article/content-info
.
mime::preview/content-list
is made to register structure
of preview-buffer. tm-view manages message by
mime::article/content-info
in raw-article-buffer and
mime::preview/content-list
in preview-buffer.
buffer local variables of raw-article-buffer
mime::content-info/SLOT-NAME
to reference slot of
content-info. Their argument is only content-info.
mime::article/content-info
is used as default value.
mime::article/content-info
is used as default value.
mime::article/content-info
is used as default value.
mime::article/content-info
is used as default value.
Buffer local variables of preview-buffer
mime::preview-content-info/SLOT-NAME
to reference slot of
preview-content-info. Their argument is only preview-content-info.
mime::preview/content-list
is used.
Functions to decode MIME message
Function to preview MIME message
mime/viewer-mode
.
mime/Content-Type
. When ctl is specified,
tm-view uses it instead of Content-Type field of the
raw-article-buffer.
mime/viewer-mode
includes it.
encoded-word decoder
Concept Index
Function Index
Variable Index