1 @c $Id: tm-view-m=en.texi,v 3.0 1995/12/17 23:02:56 morioka Exp $
3 @node method, Mechanism of tm-view, mime/viewer-mode, tm-view
4 @comment node-name, next, previous, up
8 In @code{mime/viewer-mode}, you can do play (@key{v}), extract
9 (@key{e}), or print (@key{C-c C-p}) for each content. These operations
10 are called ``decoding operation(s) (for a content)''. And kind of
11 decoding operations are called @strong{decoding-mode}.
13 When decoding operation is driven, tm-view calls a procedure matched
14 for the condition, such as content-type. This procedure is called
17 There are two kinds of method. One is Emacs Lisp function, called
18 @strong{internal method}. Another one is external program, called
19 @strong{external method}.
21 Internal method operates in Emacs, so it can do carefully.
23 External method is called as asynchronous process, so Emacs does not
24 wait while method is running. So it is good for big data, such as
25 audio, image or video.
28 * decoding-condition:: Setting of content decoding condition
29 * Format of method value::
30 * Example of decoding-condition::
31 * environment variables::
35 @node decoding-condition, Format of method value, method, method
36 @comment node-name, next, previous, up
37 @subsection Setting of content decoding condition
38 @cindex content decoding condition
40 When decoding operation is driven, tm-view calls a method matched for
41 the condition searched from the variable
42 @code{mime/content-decoding-condition}.
44 Variable @code{mime/content-decoding-condition} is defined as a list
45 with the following syntax:
48 (condition1 condition2 ...)
51 Each condition are association-list with the following syntax:
54 ((field-type_1 . value_1)
55 (field-type_2 . value_2)
59 For example, if you want to call the external method named tm-plain to
60 decode every text/plain type content, you can define the condition
64 ((type . "text/plain")
65 (method "tm-plain" nil 'file 'type 'encoding 'mode 'name))
68 As you notice, now you can define the arguments to pass to a external
69 method. Refer to @xref{Format of method value} section for more
72 This condition definition will match all contents whose types are
73 text/plain. Here is an another example:
76 ((type . "text/plain")
77 (method "tm-plain" nil 'file 'type 'encoding 'mode 'name)
81 This will match the content whose type is text/plain and the mode is
85 ((method "metamail" t "-m" "tm" "-x" "-d" "-z" "-e" 'file)
89 This will match all contents which have a mode of play.
91 The conditions defined in a mime/content-decoding-condition variable
92 are examined from top to bottom. The first matching condition becomes
93 valid and the method specified in that condition definition will be
97 @node Format of method value, Example of decoding-condition, decoding-condition, method
98 @comment node-name, next, previous, up
99 @subsection Format of method value part
100 @cindex Format of method value part
102 You can specify the method field of the decoding-condition definition
103 in two different ways,
112 (method STRING FLAG ARGUMENT1 ARGUMENT2 ...)
117 When a symbol is specified in the method field, a function whose name
118 is SYMBOL will be called as an internal method.
120 When a list is specified in the method field, it will be called as an
123 The list below shows the meaning of the parameters when the external
124 method is specified in the method field.
128 name of an external method
130 If @code{t}, both the content header and the content body are
131 passed to an external method. if nil, only the content body is
132 passed to an external method.
134 list of arguments passed to an external method
137 An argument passed to an external method can be in one of the
144 value gotten using SYMBOL as a key (see below)
146 value gotten using STRING as a key (see below)
149 'SYMBOL can be one of the following:
153 name of a file holding the original content
155 content-type/sub-type of Content-Type field
157 field body of Content-Transfer-Encoding field
161 name of a file created by decode operation
164 'STRING is used to search a parameter of the Content-Type field whose
165 name matches with it, and pass the value of that parameter to the
169 @node Example of decoding-condition, environment variables, Format of method value, method
170 @comment node-name, next, previous, up
171 @subsection Examples of decoding-condition
172 @cindex Examples of decoding-condition
174 The default definition of a mime/content-decoding-condition variable
178 (defvar mime/content-decoding-condition
179 '(((type . "text/plain")
180 (method "tm-plain" nil 'file 'type 'encoding 'mode 'name))
181 ((type . "text/x-latex")
182 (method "tm-latex" nil 'file 'type 'encoding 'mode 'name))
183 ((type . "audio/basic")
184 (method "tm-au" nil 'file 'type 'encoding 'mode 'name))
185 ((type . "image/gif")
186 (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
187 ((type . "image/jpeg")
188 (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
189 ((type . "image/tiff")
190 (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
191 ((type . "image/x-tiff")
192 (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
193 ((type . "image/x-xbm")
194 (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
195 ((type . "image/x-pic")
196 (method "tm-image" nil 'file 'type 'encoding 'mode 'name))
197 ((type . "video/mpeg")`
198 (method "tm-mpeg" nil 'file 'type 'encoding 'mode 'name))
199 ((type . "application/octet-stream")
200 (method "tm-file" nil 'file 'type 'encoding 'mode 'name))
201 ((type . "message/partial")
202 (method . mime/decode-message/partial-region))
203 ((method "metamail" t
204 "-m" "tm" "-x" "-d" "-z" "-e" 'file)(mode . "play"))
208 For example, if you want to use metamail to decode any contents,
211 (setq mime/content-decoding-condition
213 ((method "metamail" t "-m" "tm" "-x" "-d" "-z" "-e" 'file))
219 A mime/content-decoding-condition variable provides you of very flexible
220 way to define the conditions of decoding. It can be simple if you only
221 need the a few decoding methods, while it can be very complicated if you
222 want to use the separate decoding method for each type/mode combination.
224 Following function may be useful to set decoding-condition. It is a
225 function of tl-atype.el.
228 @deffn{Function} set-atype symbol alist
230 Add condition @var{alist} to symbol @var{symbol}.
235 (set-atype 'mime/content-decoding-condition
236 '((type . "message/external-body")
237 ("access-type" . "anon-ftp")
238 (method . mime/decode-message/external-ftp)
244 @node environment variables, , Example of decoding-condition, method
245 @comment node-name, next, previous, up
246 @subsection environment variables
247 @cindex environment variables
249 Standard methods of tm-view reference some environment variables. You
250 can specify them to customize.
254 Directory for temporary files or extracted files. Default value is
258 Dither for mpeg_play. Default value is `gray'.
261 WWW browser name. Default value is `netscape'.