X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mime-en.texi;h=e04f744b35de72673cd912f3840d18a4ba44804e;hb=6260b782ec94886678bc08ecf41d7fa91fa6c9c5;hp=a95ec3dd7bde51abed368fcbe0dc2c2ac48f1cc2;hpb=fdffb5370df2b02b3f9e9100519320dce1cb00fb;p=elisp%2Fflim.git diff --git a/mime-en.texi b/mime-en.texi index a95ec3d..e04f744 100644 --- a/mime-en.texi +++ b/mime-en.texi @@ -1,18 +1,19 @@ \input texinfo.tex +@c Generated automatically from mime-en.sgml by sinfo 3.7. @setfilename mime-en.info -@settitle{FLIM 1.9 Manual about MIME Features} +@settitle{FLIM 1.14 Reference Manual about MIME Features} @titlepage -@title FLIM 1.9 Manual about MIME Features +@title FLIM 1.14 Reference Manual about MIME Features @author MORIOKA Tomohiko -@subtitle 1998/07/01 +@subtitle 1999-01-27 @end titlepage @node Top, Introduction, (dir), (dir) -@top FLIM 1.9 Manual about MIME Features +@top FLIM 1.14 Reference Manual about MIME Features @ifinfo -This file documents MIME features of FLIM, a Internet message -parsing/encoding library for GNU Emacs. +This file documents MIME features of FLIM, a fundamental library to +process Internet Messages for GNU Emacsen. @end ifinfo @menu @@ -24,10 +25,10 @@ parsing/encoding library for GNU Emacs. * Content-Transfer-Encoding:: Encoding Method * encoded-word:: Network representation of header * custom:: Various Customization -* Appendix:: -* Concept Index:: -* Function Index:: -* Variable Index:: +* Appendix:: +* Concept Index:: +* Function Index:: +* Variable Index:: @end menu @node Introduction, How to use, Top, Top @@ -50,8 +51,6 @@ Please eval following to use MIME features provided by FLIM: @node Entity, Content-Type, How to use, Top @chapter Message and Entity -@cindex node-id -@cindex entity-number @cindex mime-entity @cindex entity @@ -61,53 +60,24 @@ message or one of the parts in the body of a multipart entity.' In this document, the term @strong{entity} indicates all of header fields and body.@refill -The definition of RFC 2045 indicates that a MIME message is a tree. An -message is a tree, each node is an entity, like following figure. -Namely MIME extends message to tree structure.@refill - -FLIM uses @strong{mime-entity} structure to represent information of -entity. In this document, it is called simply `mime-entity'.@refill - -$BA0=R$N$h$&$K!"(Bmessage $BCf$N3F(B entity $B$OLZ$N@a$KEv$?$j$^$9$,!"$3$NLZ$K$O(B -$B?<$5$HF1$8?<$5$NCf$N=gHV$K=>$C$FHV9f$,IU$1$k$3$H$,$G$-$^$9!#B($A!"(B -@example - - $B(#(!(!(!($(B - $B("(B nil $B("(B - $B(&(!(((!(%(B - $B(#(!(!(!(!(!(!(!(!(!(+(!(!(!(!(!(!(!(!(!($(B - $B(#(*($(B $B(#(*($(B $B(#(*($(B - $B("#0("(B $B("#1("(B $B("#2("(B - $B(&(((%(B $B(&(((%(B $B(&(((%(B - $B("(B $B(#(!(!(!(!(+(!(!(!(!($(B $B("(B - $B(#(!(*(!($(#(!(*(!($(#(!(*(!($(#(!(*(!($(#(!(*(!($(B - $B("(B $B#0(B.$B#0("("(B $B#1(B.$B#0("("(B $B#1(B.$B#1("("(B $B#1(B.$B#2("("(B $B#2(B.$B#0("(B - $B(&(!(!(!(%(&(!(!(!(%(&(!(!(!(%(&(!(!(!(%(&(!(!(!(%(B -@end example - -@noindent -$B$N$h$&$K?<$5(B n $B$N@a$K$OD9$5(B n $B$N@0?tNs$N@aHV9f$,?6$l$^$9!#$3$l(B -$B$r(B @strong{entity-number} $B$H8F$S$^$9!#(Bentity-number $B$O(B S $B<0$H(B -$B$7$F$O(B @code{(1 2 3)} $B$N$h$&$J@0?t$N%j%9%H$H$7$FI=8=$5$l$^$9!#(B +The definition of RFC 2045 indicates that a MIME message is a tree, and +each node of the tree is an entity. Namely MIME extends message to tree +structure.@refill -mime-entity $B$G$O!"$3$l$HF1MM$N(B @strong{node-id} $B$rMQ$$$^$9!#(Bnode-id $B$O$A$g(B -$B$&$I(B entity-number $B$r5U$K$7$?%j%9%H$G!"(Bentity-number 1.2.3 $B$KBP1~$9$k(B -node-id $B$O(B @code{(3 2 1)} $B$G$9!#(B@refill - -$BA0=R$N$h$&$K!"(BMIME message $B$O(B entity $B$rC10L$H$7$?LZ9=B$$K$J$C$F$$$k$N$G!"(B -$B$3$N:,$G$"$k(B message $BA4BN$b(B mime-entity $B$GI=8=$9$k$3$H$,$G$-!"(Bbuffer -local $BJQ?t(B @code{mime-message-structure} $B$K3JG<$9$k$3$H$K$7$^$9!#(B -$B$=$7$F!"(Bentity-number $B$d(B node-id $B$rMQ$$$k$3$H$G(B -@code{mime-message-structure} $B$K$*$1$k(B entity $B$NAjBPE*$J0LCV4X78$r(B -$B07$&$3$H$,$G$-$^$9!#(B +FLIM uses @strong{mime-entity} structure to represent +information of entity. In this document, it is called simply +`mime-entity'. @menu * Entity creation:: Functions to create mime-entity * Entity hierarchy:: Features about message tree +* Entity Search:: Find Entity * Entity Attributes:: Functions about attributes of mime-entity * Entity-header:: Information of entity header +* entity formatting:: Text presentation of entity * Entity-content:: Contents of Entity +* Entity-network-representation:: Network representation of Entity * Entity buffer:: Entity as buffer representation * mm-backend:: Entity representations and implementations @end menu @@ -140,8 +110,55 @@ mime-entity. (cf. @ref{mm-backend}) Default value is @var{buffer}. -@node Entity hierarchy, Entity Attributes, Entity creation, Entity +@node Entity hierarchy, Entity Search, Entity creation, Entity @section Features about message tree +@cindex node-id +@cindex entity-number +@cindex message +@cindex root-entity + +Structure of a MIME message is tree.@refill + +In the tree, root node is the entity indicates all of the message. In +this document, it is called @strong{root-entity} or @strong{message}. +In FLIM, it is indicated by buffer local variable +@code{mime-message-structure}.@refill + +Each entity except root-entity has a parent. An entity may have +children. We can indicate an entity by relative position from a base +entity, based on the parent-child relationship.@refill + +In addition, we can indicate an entity by absolute position of the +message.@refill + +Each entity, which is a node of the tree, can be numbered by +depth and left-to-right order of the depth. +@example + + +-------+ + | nil | + +---+---+ + +-------------------+-------------------+ + +-+-+ +-+-+ +-+-+ + | 0 | | 1 | | 2 | + +-+-+ +-+-+ +-+-+ + | +---------+---------+ | + +--+--+ +--+--+ +--+--+ +--+--+ +--+--+ + | 0.0 | | 1.0 | | 1.1 | | 1.2 | | 2.0 | + +-----+ +-----+ +-----+ +-----+ +-----+ +@end example + +Namely, if depth of a node is n, the node has a node-number, which is +consists of n integers. In this document, it is called +@strong{entity-number}. An entity-number is represented by list of +integer, like @code{(1 2 3)}.@refill + +mime-entity has also @strong{node-id}. A node-id is represented by +reversed list of entity-number. For example, node-id corresponding with +1.2.3 is @code{(3 2 1)}.@refill + +Each entity can be indicated by entity-number or node-id in +@code{mime-message-structure}. @defvar mime-message-structure @@ -182,6 +199,10 @@ Return entity-number of @var{entity}. @end defun + +@node Entity Search, Entity Attributes, Entity hierarchy, Entity +@section Find Entity + @defun mime-find-entity-from-number entity-number &optional message Return entity from @var{entity-number} in @var{message}.@refill @@ -200,8 +221,17 @@ used. @end defun +@defun mime-find-entity-from-content-id cid &optional message + +Return entity from @var{cid} in @var{message}.@refill + +If @var{message} is not specified, @code{mime-message-structure} is +used. +@end defun + + -@node Entity Attributes, Entity-header, Entity hierarchy, Entity +@node Entity Attributes, Entity-header, Entity Search, Entity @section Functions about attributes of mime-entity @defun mime-entity-content-type entity @@ -242,7 +272,7 @@ code-converted. -@node Entity-header, Entity-content, Entity Attributes, Entity +@node Entity-header, entity formatting, Entity Attributes, Entity @section Information of entity header @defun mime-fetch-field field-name &optional entity @@ -280,7 +310,11 @@ If @var{field-name} field is not found, this function returns @end defun -@defun mime-insert-decoded-header entity &optional invisible-fields visible-fields + +@node entity formatting, Entity-content, Entity-header, Entity +@section Text presentation of entity + +@defun mime-insert-header entity &optional invisible-fields visible-fields Insert before point a decoded contents of header of @var{entity}.@refill @@ -290,12 +324,36 @@ hide.@refill If a field-name is matched with some elements of @var{invisible-fields} and matched with none of @var{visible-fields}, this function don't -insert the field. +insert the field.@refill + +Each encoded-word (@ref{encoded-word}) in the header is decoded. ``Raw +non us-ascii characters'' are also decoded as +@code{default-mime-charset}. @end defun +@defun mime-insert-text-content entity + +Insert before point a contents of @var{entity} as text entity.@refill + +Contents of the @var{entity} are decoded as MIME charset (@ref{MIME charset}). If the @var{entity} does not have charset parameter of +Content-Type field, @code{default-mime-charset} is used as default +value. +@end defun + + +@defvar default-mime-charset -@node Entity-content, Entity buffer, Entity-header, Entity +Symbol to indicate default value of MIME charset (@ref{MIME charset}).@refill + +It is used when MIME charset is not specified.@refill + +It is originally variable of APEL. +@end defvar + + + +@node Entity-content, Entity-network-representation, entity formatting, Entity @section Contents of Entity @defun mime-entity-content entity @@ -304,12 +362,28 @@ Return content of @var{entity} as byte sequence. @end defun +@defun mime-insert-entity-content entity + +Insert content of @var{entity} at point. +@end defun + + @defun mime-write-entity-content entity filename Write content of @var{entity} into @var{filename}. @end defun + +@node Entity-network-representation, Entity buffer, Entity-content, Entity +@section Network representation of Entity + +@defun mime-insert-entity entity + +Insert header and body of @var{entity} at point. +@end defun + + @defun mime-write-entity entity filename Write representation of @var{entity} into @var{filename}. @@ -323,7 +397,7 @@ Write body of @var{entity} into @var{filename}. -@node Entity buffer, mm-backend, Entity-content, Entity +@node Entity buffer, mm-backend, Entity-network-representation, Entity @section Entity as buffer representation @defun mime-entity-buffer entity @@ -378,33 +452,30 @@ contains @var{entity}. @node mm-backend, , Entity buffer, Entity @section Entity representations and implementations @cindex mm-backend -@cindex entity $B=hM}(B method +@cindex entity processing method @cindex representation-type -Entity $B$OCj>]2=$5$l$?%G!<%?I=8=$G!"A0$N@hF,$K(B @code{mm} $B$H$$$&(B -$B@\F,<-$rIU$1$?4X?tL>$+$i$J$k(B module $B$G!"$=$N(B module $BL>$OF1MM$K(B -representation-type $B$NL>A0$N@hF,$K(B @code{mm} $B$rIU$1$?$b$N$K$J$C$F(B -$B$$$^$9!#$3$N(B module $B$O(B representation-type $B$N(B entity $B$,:G=i$K@8@.$5$l$k(B -$B;~$K<+F0E*$K(B require $B$5$l$^$9!#(B +Module name of each mm-backend consists of the prefix @code{mm} +and its representation-type. The module is required automatically +when its entity is created at first. @menu * Request for entity:: Message-passing for entity -* mm-backend module:: How to make mm-backend +* mm-backend module:: Definition of mm-backend @end menu @node Request for entity, mm-backend module, mm-backend, mm-backend @@ -412,19 +483,49 @@ representation-type $B$NL>A0$N@hF,$K(B @code{mm} $B$rIU$1$?$b$N$K$J$C$F(B @defun mime-entity-send entity message &rest args -@var{entity} $B$K(B @var{message} $B$rAw$k!#(B@refill +Send @var{message} to @var{entity} with @var{args}, and return the +result.@refill -@var{args} $B$O(B @var{message} $B$N0z?t$G$"$k!#(B +@var{args} is arguments of the @var{message}. @end defun @node mm-backend module, , Request for entity, mm-backend -@subsection How to make mm-backend +@subsection Definition of mm-backend + +@defmac mm-define-backend type &optional parents + +Define @var{type} as a mm-backend.@refill + +If @var{PARENTS} is specified, @var{type} inherits parents. Each parent +must be representation-type.@refill + +Example:@refill + +@lisp +(mm-define-backend chao (generic)) +@end lisp +@end defmac -$B!J$9$_$^$;$s!#$=$N$&$A=q$-$^$9(B (^_^;$B!K(B@refill -$B!J$H$j$"$($:!"(Bmm*.el $B$r;29M$K$7$F$/$@$5$$!K(B +@defmac mm-define-method name args &rest body + +Define @var{name} as a method function of (nth 1 (car @var{args})) +backend.@refill + +@var{args} is like an argument list of lambda, but (car @var{args}) must +be specialized parameter. (car (car @var{args})) is name of variable +and (nth 1 (car @var{args})) is name of backend +(representation-type).@refill + +Example:@refill + +@lisp +(mm-define-method entity-cooked-p ((entity chao)) nil) +@end lisp +@end defmac + @node Content-Type, Content-Disposition, Entity, Top @@ -464,14 +565,14 @@ Content-Type field. @cindex subtype @cindex type -Content-Type $BMs$N7A<0$O0J2<$N$h$&$KDj5A$5$l$F$$$^$9!'(B +Format of Content-Type field is defined as follows: @quotation ``Content-Type'' ``:'' @strong{type} ``/'' @strong{subtype} *( ``;'' @strong{parameter} ) @end quotation -$BNc$($P!"(B +For example: @quotation @example @@ -479,8 +580,6 @@ Content-Type: image/jpeg @end example @end quotation -@noindent -$B$d(B @quotation @example @@ -488,18 +587,16 @@ Content-Type: text/plain; charset=iso-2022-jp @end example @end quotation -@noindent -$B$J$I$N$h$&$KMQ$$$i$l$^$9!#(B - -$B$3$3$G!"(B`type' $B$H(B `subtype' $B$O(B entity $B$N7A<0$r<($9$b$N$G!"N>N$7(B -$B$F!"(B`media-type' $B$H8F$V$3$H$K$7$^$9!#>e5-$NNc$K$*$1$k(B `image/jpeg' $B$d(B -`text/plain' $B$O(B media-type $B$N#1$D$G$9!#(B +`type' and `subtype' indicate format of an entity. In this document, +pair of them is called `media-type'. `image/jpeg' or `text/plain' is +a media-type. @noindent @strong{[Memo]} @quotation -Content-Type $BMs$N$J$$(B entity $B$O(B +If an entity does not have Content-Type field, it is regarded as +following: @quotation @example @@ -508,7 +605,7 @@ Content-Type: text/plain; charset=us-ascii @end quotation @noindent -$B$H$7$F2rpJs$r3JG<$9$k$?$a$N9=B$BN!#(B@refill +Structure to store information of a Content-Type field.@refill -$B$3$N9=B$BN$r;2>H$9$k$K$O(B @code{mime-content-type-$BMWAGL>(B} $B$H$$$&L>A0$N;2(B -$B>H4X?t$rMQ$$$k!#(B@refill +Applications should use reference functions +@code{mime-content-type-SLOT} to refer information of the +structure.@refill -$B$3$N9=B$BN$NMWAG$O0J2<$NDL$j$G$"$k!'(B +Slots of the structure are following: @table @var @item primary-type -media-type $B$Nl9g$O(B nil $B$rJV$9!#(B +Return @code{nil} if Content-Type field is not found. @end defun @@ -586,10 +686,11 @@ Return type/subtype string from @var{type} and @var{subtype}. @cindex mime-content-disposition @cindex RFC 2183 @cindex Standards Track -@cindex Content-Disposition $BMs(B +@cindex Content-Disposition field -@strong{Content-Disposition $BMs(B} $B$O(B entity $B$NI=<($d(B file $BL>$J$I(B -$B$NB0@-$K$J$I$K4X$9$k>pJs$r5-=R$9$k$?$a$N$b$N$G$9!#(B +@strong{Content-Disposition field} is an optional field to +specify presentation of an entity or attributes of an entity, such as +file name. @noindent @@ -600,9 +701,9 @@ Information in Internet Messages: The Content-Disposition Header'', August 1997, Standards Track. @end quotation -FLIM $B$O(B Content-Disposition $BMs$r9=J82r@O$9$k4X?t$H(B Content-Disposition -$BMs$N2r@O7k2L$r3JG<$9$k9=B$BN(B -@strong{mime-content-disposition} $B$rDs6!$7$^$9!#(B +FLIM provides parser for Content-Disposition field and structure +@strong{mime-content-disposition} to store information of +Content-Disposition field. @menu @@ -615,19 +716,21 @@ FLIM $B$O(B Content-Disposition $BMs$r9=J82r@O$9$k4X?t$H(B Content-Dispositi @deffn{Structure} mime-content-disposition -Content-Disposition $BMs$N2r@O7k2L$r<}$a$k$?$a$N9=B$BN!#(B@refill +Structure to store information of a Content-Disposition field.@refill -$B$3$N9=B$BN$r;2>H$9$k$K$O(B @code{mime-content-disposition-$BMWAGL>(B} $B$H$$$&L>(B -$BA0$N;2>H4X?t$rMQ$$$k!#(B@refill +Applications should use reference functions +@code{mime-content-disposition-SLOT} to refer information of the +structure.@refill -$B$3$N9=B$BN$NMWAG$O0J2<$NDL$j$G$"$k!'(B +Slots of the structure are following: @table @var @item disposition-type disposition-type (symbol). @item parameters -Content-Disposition $BMs$N(B parameter ($BO"A[(B list). +parameters of Content-Disposition field +(association-list). @end table @end deffn @@ -635,13 +738,13 @@ Content-Disposition $BMs$N(B parameter ($BO"A[(B list). @defun mime-content-disposition-parameter content-disposition parameter -@var{content-disposition} $B$N(B @var{parameter} $B$NCM$rJV$9!#(B +Return value of @var{parameter} of @var{content-disposition}. @end defun @defun mime-content-disposition-filename content-disposition -@var{content-disposition} $B$N(B filename $B$NCM$rJV$9!#(B +Return filename of @var{content-disposition}. @end defun @@ -651,64 +754,69 @@ Content-Disposition $BMs$N(B parameter ($BO"A[(B list). @defun mime-parse-Content-Disposition string -@var{string} $B$r(B content-disposition $B$H$7$F2r@O$7$?7k2L$rJV$9!#(B +Parse @var{string} as field-body of Content-Disposition field, and +return the result as mime-content-disposition +(@ref{mime-content-disposition}) structure. @end defun @defun mime-read-Content-Disposition -$B8=:_$N(B buffer $B$N(B Content-Disposition $BMs$rFI$_l9g$O(B nil $B$rJV$9!#(B +Return @code{nil} if Content-Disposition field is not found. @end defun @node Content-Transfer-Encoding, encoded-word, Content-Disposition, Top @chapter Encoding Method -@cindex Content-Transfer-Encoding $BMs(B +@cindex Content-Transfer-Encoding field -@strong{Content-Transfer-Encoding $BMs(B} $B$O(B entity $B$NId9f2=K!$r5-=R$9$k$?$a(B -$B$N$b$N$G$9!#(B@refill +@strong{Content-Transfer-Encoding field} is a header field to indicate +body encoding of a entity.@refill -FLIM $B$G$O(B Content-Transfer-Encoding $BMs$r9=J82r@O$9$k4X?t$rDs6!$7$^$9!#$3(B -$B$l$i$N4X?t$O(B Content-Transfer-Encoding $BMs$N>pJs$OJ8;zNs$GI=8=$7$^$9!#(B -@refill +FLIM provides parser functions for Content-Transfer-Encoding field. +They represent information of Content-Transfer-Encoding field as +string.@refill -$B$^$?!"(BContent-Transfer-Encoding $B$K4p$E$$$FId9f2=!&I|9f2=$r9T$&4X?t$bDs(B -$B6!$5$l$^$9!#(B +In addition, FLIM provides encoder/decoder functions by +Content-Transfer-Encoding. @menu * Content-Transfer-Encoding parser:: Parser -* Region encoder/decoder:: Region encoding/decoding -* String encoder/decoder:: String encoding/decoding -* File encoder/decoder:: File encoding/decoding +* encoder/decoder:: Encoder/decoder +* Encoding information:: Other utilities +* mel-backend:: How to write encoder/decoder module +* generic function for mel-backend:: How to add encoding/decoding service @end menu -@node Content-Transfer-Encoding parser, Region encoder/decoder, Content-Transfer-Encoding, Content-Transfer-Encoding +@node Content-Transfer-Encoding parser, encoder/decoder, Content-Transfer-Encoding, Content-Transfer-Encoding @section Parser @defun mime-parse-Content-Transfer-Encoding string -@var{string} $B$r(B content-transfer-encoding $B$H$7$F2r@O$7$?7k2L$rJV$9!#(B +Parse @var{string} as a field-body of Content-Transfer-Encoding field, +and return the result. @end defun @defun mime-read-Content-Transfer-Encoding &optional default-encoding -$B8=:_$N(B buffer $B$N(B Content-Transfer-Encoding $BMs$rFI$_l9g$O(B@var{default-encoding} $B$r(B -$BJV$9!#(B +Return @var{default-encoding} if Content-Transfer-Encoding field is not +found. If it is not specified, @code{nil} is used as the default value. @end defun -@node Region encoder/decoder, String encoder/decoder, Content-Transfer-Encoding parser, Content-Transfer-Encoding -@section Region encoding/decoding +@node encoder/decoder, Encoding information, Content-Transfer-Encoding parser, Content-Transfer-Encoding +@section Encoder/decoder @defun mime-encode-region start end encoding @@ -724,83 +832,124 @@ Decode region @var{start} to @var{end} of current buffer using @end defun -@defvar mime-encoding-method-alist - -Alist of encoding vs. corresponding method to encode region.@refill -Each element looks like @code{(STRING . FUNCTION)} or @code{(STRING -. nil)}. @var{string} is content-transfer-encoding. @code{function} is -region encoder and @code{nil} means not to encode. -@end defvar +@defun mime-decode-string string encoding +Decode @var{string} which is encoded in @var{encoding}, and return the +result. +@end defun -@defvar mime-decoding-method-alist -Alist of encoding vs. corresponding method to decode region.@refill -Each element looks like @code{(STRING . FUNCTION)} or @code{(STRING -. nil)}. @var{string} is content-transfer-encoding. @code{function} is -region decoder and @code{nil} means not to decode. -@end defvar +@defun mime-insert-encoded-file filename encoding +Insert file @var{FILENAME} encoded by @var{ENCODING} format. +@end defun -@node String encoder/decoder, File encoder/decoder, Region encoder/decoder, Content-Transfer-Encoding -@section String encoding/decoding +@defun mime-write-decoded-region start end filename encoding -@defun mime-decode-string string encoding +Decode and write current region encoded by @var{encoding} into +@var{filename}.@refill -@var{string} $B$r(B @var{encoding} $B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#(B +@var{start} and @var{end} are buffer positions. @end defun -@defvar mime-string-decoding-method-alist -Alist of encoding vs. corresponding method to decode string.@refill +@node Encoding information, mel-backend, encoder/decoder, Content-Transfer-Encoding +@section Other utilities -Each element looks like @code{(STRING . FUNCTION)}. STRING is -content-transfer-encoding. FUNCTION is string decoder. -@end defvar +@defun mime-encoding-list &optional SERVICE + +Return list of Content-Transfer-Encoding.@refill +If @var{service} is specified, it returns available list of +Content-Transfer-Encoding for it. +@end defun -@node File encoder/decoder, , String encoder/decoder, Content-Transfer-Encoding -@section File encoding/decoding +@defun mime-encoding-alist &optional SERVICE -@defun mime-insert-encoded-file filename encoding +Return table of Content-Transfer-Encoding for completion.@refill -Insert file @var{FILENAME} encoded by @var{ENCODING} format. +If @var{service} is specified, it returns available list of +Content-Transfer-Encoding for it. @end defun -@defun mime-write-decoded-region start end filename encoding -Decode and write current region encoded by @var{encoding} into -@var{filename}.@refill +@node mel-backend, generic function for mel-backend, Encoding information, Content-Transfer-Encoding +@section How to write encoder/decoder module -@var{start} and @var{end} are buffer positions. -@end defun +@defmac mel-define-method name args &rest body +Define @var{name} as a method function of (nth 1 (car (last +@var{args}))) backend.@refill -@defvar mime-file-encoding-method-alist +@var{args} is like an argument list of lambda, but (car (last +@var{args})) must be specialized parameter. (car (car (last +@var{args}))) is name of variable and (nth 1 (car (last @var{args}))) is +name of backend (encoding).@refill -Alist of encoding vs. corresponding method to insert encoded -file.@refill +Example:@refill -Each element looks like @code{(STRING . FUNCTION)}. STRING is -content-transfer-encoding. FUNCTION is function to insert encoded file. -@end defvar +@lisp +(mel-define-method mime-write-decoded-region (start end filename + (nil "base64")) + "Decode and write current region encoded by base64 into FILENAME. +START and END are buffer positions." + (interactive + (list (region-beginning) (region-end) + (read-file-name "Write decoded region to file: "))) + (let ((str (buffer-substring start end))) + (with-temp-buffer + (insert (decode-base64-string str)) + (write-region-as-binary (point-min) (point-max) filename) + ))) +@end lisp +@end defmac -@defvar mime-file-decoding-method-alist +@defmac mel-define-method-function spec function -Alist of encoding vs. corresponding method to write decoded region to -file.@refill +Set @var{spec}'s function definition to @var{function}.@refill -Each element looks like @code{(STRING . FUNCTION)}. STRING is -content-transfer-encoding. FUNCTION is function to write decoded region -to file. -@end defvar +First element of @var{spec} is service.@refill + +Rest of @var{args} is like an argument list of lambda, but (car (last +@var{args})) must be specialized parameter. (car (car (last +@var{args}))) is name of variable and (nth 1 (car (last @var{args}))) is +name of backend (encoding).@refill + +Example:@refill + +@lisp +(mel-define-method-function (mime-encode-string string (nil "base64")) + 'encode-base64-string) +@end lisp +@end defmac + + + +@node generic function for mel-backend, , mel-backend, Content-Transfer-Encoding +@section How to add encoding/decoding service + +@defmac mel-define-service name &optional args doc-string + +Define @var{name} as a service for Content-Transfer-Encodings.@refill + +If @var{args} is specified, @var{name} is defined as a generic function +for the service.@refill + +Example:@refill + +@lisp +(mel-define-service encoded-text-encode-string (string encoding) + "Encode STRING as encoded-text using ENCODING. +ENCODING must be string.") +@end lisp +@end defmac @@ -808,10 +957,11 @@ to file. @chapter Network representation of header @cindex RFC 2047 @cindex Standards Track +@cindex encoded-word @cindex RFC 2047 -encoded-word $B$O(B header $B$GHs(B ASCII (@ref{ASCII}) $BJ8;z$rI=8=$9$k$?$a$N7A<0(B -$B$G!"(B@strong{RFC 2047} $B$GDj5A$5$l$F$$$^$9!#(B@refill +@strong{RFC 2047} defines the @strong{encoded-word} which is a format to +represent non-ASCII (@ref{ASCII}) characters in a header.@refill @noindent @@ -822,10 +972,14 @@ Message Header Extensions for Non-ASCII Text'', November 1996, Standards Track (obsolete RFC 1521,1522,1590). @end quotation -$B$^$?!"9T57$N0-$$$3$H$@$H8@$($^$9$,!"(Bencoded-word $B$rMQ$$$:$KHs(B ASCII -(@ref{ASCII}) $BJ8;z$r(B header $B$KF~$l$?5-;v$bB8:_$7$^$9!#(B@refill +The encoded-word is the only valid format to represent non-ASCII +(@ref{ASCII}) characters in a header, but there are also invalid styles. +Such kinds of evil messages represent non-ASCII (@ref{ASCII}) characters +in headers without encoded-words (it is called "raw" non-ASCII +(@ref{ASCII}) characters).@refill -FLIM $B$O$3$l$i$rId9f2=!&I|9f2=$9$k5!G=$rDs6!$7$^$9!#(B +FLIM provides encoding/decoding features of both encoded-word and +invalid "raw" non-ASCII (@ref{ASCII}) characters. @menu @@ -835,16 +989,17 @@ FLIM $B$O$3$l$i$rId9f2=!&I|9f2=$9$k5!G=$rDs6!$7$^$9!#(B @node Header encoder/decoder, , encoded-word, encoded-word @section Header encoding/decoding -@defun eword-encode-header &optional code-conversion separator +@defun eword-decode-header &optional code-conversion separator Decode MIME encoded-words in header fields.@refill -If @var{code-conversion} is @code{nil}, it decodes only encoded-words. -If it is mime-charset, it decodes non-ASCII bit patterns as the -mime-charset. Otherwise it decodes non-ASCII bit patterns as the -default-mime-charset.@refill +If @var{code-conversion} is @code{nil}, only encoded-words are decoded. +If @var{code-conversion} is a MIME charset (@ref{MIME charset}), +non-ASCII bit patterns are decoded as the MIME charset. Otherwise +non-ASCII bit patterns are decoded as the +@code{default-mime-charset}. (cf. @ref{entity formatting}) @refill -If @var{separator} is not nil, it is used as header separator. +If @var{separator} is not @code{nil}, it is used as header separator. @end defun @@ -853,41 +1008,39 @@ If @var{separator} is not nil, it is used as header separator. Encode header fields to network representation, such as MIME encoded-word.@refill -It refer variable @code{eword-field-encoding-method-alist}. +Each field is encoded as corresponding method specified by variable +@code{mime-field-encoding-method-alist}. @end defun +@defvar mime-field-encoding-method-alist -@node custom, Appendix, encoded-word, Top -@chapter Various Customization - -@deffn{group} mime - -MIME $B4XO"5!G=$K4X$9$k(B group.@refill - -@code{mail} $B$H(B @code{news} $B$KB0$9$k!#(B -@end deffn +Association list to specify field encoding method. Each element looks +like (FIELD . METHOD).@refill +If METHOD is @code{mime}, the FIELD will be encoded into MIME format +(encoded-word).@refill -@defvar default-mime-charset +If METHOD is @code{nil}, the FIELD will not be encoded.@refill -$BE,@Z$J(B MIME charset (@ref{MIME charset}) $B$,8+$D$+$i$J$+$C$?>l9g$KMQ$$$i(B -$B$l$k(BMIME charset.@refill +If METHOD is a MIME charset, the FIELD will be encoded as the charset +when it must be convert into network-code.@refill -$BK\Mh$O(B APEL $B$NJQ?t$G$"$k!#(B +Otherwise the FIELD will be encoded as variable +@code{default-mime-charset} when it must be convert into network-code. @end defvar -@defvar mime-temp-directory -MIME $B5!G=$K4X$9$kl9g!"$=$l$r=i4|CM$H$7$F(B -$BMQ$$$k!#2?$b@_Dj$5$l$F$$$J$$>l9g!"(B@code{"/tmp/"} $B$rMQ$$$k!#(B -@end defvar +The group associated with functions related to MIME.@refill +It belongs to @code{mail} and @code{news}. +@end deffn @node Appendix, Concept Index, custom, Top @@ -1333,13 +1486,13 @@ interpreted as us-ascii. @cindex good bug report If you write bug-reports and/or suggestions for improvement, please -send them to the tm Mailing List: +send them to the EMACS-MIME Mailing List: @itemize @bullet @item - Japanese + English @item - English + Japanese @end itemize @@ -1356,17 +1509,17 @@ is very important. (cf. @ref{(emacs)Bugs}) @refill Bug may not appear only your environment, but also in a lot of environment (otherwise it might not bug). Therefor if you send mail to author directly, we must write a lot of mails. So please send mail -to address for tm bugs instead of author. +to address for EMACS-MIME Mailing List instead of author. -Via the tm ML, you can report FLIM bugs, obtain the latest release of -FLIM, and discuss future enhancements to FLIM. To join the tm ML, -send empty e-mail to: +Via the EMACS-MIME ML, you can report FLIM bugs, obtain the latest +release of FLIM, and discuss future enhancements to FLIM. To join the +EMACS-MIME ML, send an empty e-mail to: @itemize @bullet @item - Japanese + English @item - English + Japanese @end itemize @@ -1374,40 +1527,39 @@ send empty e-mail to: @node CVS, History, Bug report, Appendix @section CVS based development -FLIM $B$N(B file $B$O(B CVS $B$r;H$C$F4IM}$5$l$F$$$^$9!#$3$N$?$a!"0J2<$NJ}K!$G:G(B -$B?7$N(B FLIM $B$rF~ + @end itemize @noindent -$B$^$G!"(Baccount $BL>$H(B UNIX $B$N(B passwd $B$HF1$87A<0$N(B crypt $B2=$5$l$?(B password -$B$r1h$($F8fO"Mm$/$@$5$$!#(B +with your account name and your public key for ssh. +cvsroot is :ext:cvs@@cvs.m17n.org:/cvs/root. @node History, , CVS, Appendix @section History of FLIM -FLIM $B$N(B code $B$N:G8E$NItJ,$O(B $B1]JB(B $B;LCR(B $B;a$,=q$$$?(B @file{mime.el}$B$K5/8;$7(B +FLIM $B$N(B code $B$N:G8E$NItJ,$O(B $B1]JB(B $B;LCR(B $B;a$,=q$$$?(B @file{mime.el} $B$K5/8;$7(B $B$^$9!#$3$N>.$5$J(B program $B$O(B Nemacs $B$GF0:n$9$k(B iso-2022-jp $B$N(B B-encoding $B@lMQ$N(B encoded-word $B$NI|9f2=%W%m%0%i%`$G$7$?!#(B@refill @@ -1451,7 +1603,7 @@ tm $B$G$O8e$K!"A0$,(B FLIM$B$H$J$j$^$9!#(B@refill +package $B$NL>A0$,(B FLIM $B$H$J$j$^$9!#(B@refill $B$3$ND>A0$+$iEDCf(B $BE/(B $B;a$,$h$j(B RFC $B$KCi