+1998-10-26 Tanaka Akira <akr@jaist.ac.jp>
+
+ * Sync up to flim-1_11_2 from flim-1_11_0.
+
+ * mime-def.el (mime-library-product): Bump up to FLAM-DOODLE
+ 1.11.1.
+
1998-10-25 Tanaka Akira <akr@jaist.ac.jp>
* eword-decode.el (eword-decode-field-body): Change interface.
* eword-decode.el: Copied from AKEMI branch of SEMI.
\f
+1998-10-26 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * FLIM: Version 1.11.2 (Heij\e-Dò)\e-A was released.
+
+ * NEWS (Abolish variable `mime-temp-directory'): New subsection.
+
+ * README.en (Installation): Modify for APEL 9.6.
+
+1998-10-26 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * eword-encode.el (eword-encode-field-body): Don't eliminate
+ top-spaces.
+
+1998-10-25 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * FLIM-ELS (flim-modules): Don't install mel-b-el for Emacs 20.4.
+
+1998-10-25 Tanaka Akira <akr@jaist.ac.jp>
+
+ * eword-decode.el (eword-decode-field-body): Refine implementation.
+
+1998-10-24 Tanaka Akira <akr@jaist.ac.jp>
+
+ * mel-b-ccl.el, mel-q-ccl.el, mel.el, FLIM-ELS: Divide mel-ccl.el
+ into mel-b-ccl.el and mel-q-ccl.el.
+
+1998-09-11 Tanaka Akira <akr@jaist.ac.jp>
+
+ * mel.el (base64-encoded-length): New implementation.
+
+1998-10-25 Tanaka Akira <akr@jaist.ac.jp>
+
+ * eword-decode.el (eword-decode-field-body): New function.
+
+1998-10-25 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * eword-encode.el (eword-encode-field-body): Change interface.
+ (eword-encode-header): Use `eword-encode-field-body'; abolish
+ function `eword-encode-field'.
+
+1998-10-25 Tanaka Akira <akr@jaist.ac.jp>
+
+ * eword-encode.el (eword-encode-field-body): New function.
+ (eword-encode-field): Use `eword-encode-field-body'.
+
+1998-10-24 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mel.el, mel-b-el.el, FLIM-ELS: Rename mel-b.el -> mel-b-el.el.
+
+1998-10-24 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mel-u.el (uuencode-external-decode-region): Use
+ `temporary-file-directory' instead of `mime-temp-directory'.
+ (mime-write-decoded-region): Likewise.
+
+ * mime-def.el: Abolish variable `mime-temp-directory'.
+
+1998-10-24 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mmgeneric.el (mime-insert-header-from-buffer): New function.
+ (insert-header): Use `mime-insert-header-from-buffer'.
+
+1998-10-24 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * FLIM-ELS: Don't install mel-b-dl.el if the running emacs has
+ builtin base64 encoder/decoder.
+
+ * mel.el: Set up builtin base64 encoder/decoder if they are
+ available.
+
+ * mime-def.el (base64-dl-module): Set nil as initial value if the
+ running emacs has builtin base64 encoder/decoder.
+
+ * mel-b.el: Require `poe' instead of `emu'.
+ (base64-encode-string): Use `defun-maybe'.
+ (base64-encode-region): Likewise.
+ (base64-decode-region): Likewise.
+ (base64-decode-string): Likewise.
+
+ * mel-b-dl.el: Require `poe' instead of `emu'.
+
+\f
+1998-10-23 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * FLIM: Version 1.11.1 (Takanohara) was released.
+
+1998-10-22 Yoshiki Hayashi <g740685@komaba.ecc.u-tokyo.ac.jp>
+
+ * README.ja: New file.
+
+1998-10-20 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-def.el: Require mcharset.
+
+1998-10-20 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * mel-u.el (mime-write-decoded-region): Fix typo.
+
+ * mime-def.el: Enclose defining procedure for the constants
+ `std11-quoted-pair-regexp', `std11-non-qtext-char-list' and
+ `std11-qtext-regexp' with `eval-and-compile'.
+
+1998-10-19 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * NEWS (Behavior change of `mime-insert-header'): New subsection.
+
+ * mmgeneric.el (insert-header): Include `:' in field-name.
+
+1998-10-19 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-def.el (std11-qtext-regexp): Use `eval-when-compile'; don't
+ use `char-list-to-string'.
+ (std11-quoted-string-regexp): Use `eval-when-compile'.
+ - Use `def-edebug-spec' to define edebug-form-spec of
+ mm-define-method; fix definition of edebug-form-spec of
+ mm-define-method.
+
+1998-10-18 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-en.sgml, mime-ja.sgml (Header encoder/decoder): Add
+ description about `eword-field-encoding-method-alist'.
+
+ * mime-en.sgml (Header encoder/decoder): Modify description about
+ `eword-encode-header'.
+
+ * mime-ja.sgml (Header encoder/decoder): Translate.
+
+1998-10-18 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-en.sgml (entity formatting): Fix typo in description of
+ `default-mime-charset'.
+
+ * mime-en.sgml (Header encoder/decoder): Modify description of
+ `eword-decode-header'.
+
+ * mime-ja.sgml, mime-en.sgml (Header encoder/decoder): fix typo.
+
+ * mime-en.sgml (encoder/decoder): Translate description of
+ `mime-decode-string'.
+
+1998-10-18 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-en.sgml (Content-Disposition parser): Modify description.
+
+ * mime-en.sgml (Content-Type parser): Modify description.
+
+1998-10-18 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-en.sgml (Content-Transfer-Encoding parser): Translate.
+
+\f
1998-10-18 MORIOKA Tomohiko <morioka@jaist.ac.jp>
* FLIM: Version 1.11.0 (Yamadagawa) was released.
17 \e$B5`MU\e(B \e$B$/$A$P\e(B 10YR7.5/10.0 FLAM-DOODLE 1.10.1
18 \e$B@VGrFK\e(B \e$B$"$+$7$m$D$k$P$_\e(B 5.0YR8.0/6.0 FLAM-DOODLE 1.10.2
19 \e$B>.F&\e(B \e$B$"$:$-\e(B 2.5R3.5/5.0 FLAM-DOODLE 1.11.0
- 20 \e$BIrF:Cc\e(B \e$B$($S$A$c\e(B 5.0R4.0/11.0
+ 20 \e$BIrF:Cc\e(B \e$B$($S$A$c\e(B 5.0R4.0/11.0 FLAM-DOODLE 1.11.1
21 \e$B??<k\e(B \e$B$7$s$7$e\e(B 2.5R4.5/10.0
22 \e$B[XHi\e(B \e$B$R$O$@\e(B 2.0YR3.5/4.0
23 \e$B%Y%s%,%i\e(B \e$B$Y$s$,$i\e(B 7.5R4.0/7.0
(setq flim-modules '(std11
mime-def
- mel mel-b mel-q mel-u mel-g
+ mel mel-q mel-u mel-g
closure
natset
digraph
mailcap
))
-(if (fboundp 'dynamic-link)
- (setq flim-modules (cons 'mel-b-dl flim-modules))
+(unless (and (fboundp 'base64-encode-string)
+ (subrp (symbol-function 'base64-encode-string)))
+ (if (fboundp 'dynamic-link)
+ (setq flim-modules (cons 'mel-b-dl flim-modules))
+ )
+ (setq flim-modules (cons 'mel-b-el flim-modules))
)
(if (and (featurep 'mule)
(not (or (and (boundp 'MULE) MULE)
(and (featurep 'xemacs) (< emacs-major-version 21))
)))
- (setq flim-modules (cons 'mel-q-ccl (cons 'mel-b-ccl flim-modules)))
+ (setq flim-modules (cons 'mel-b-ccl (cons 'mel-q-ccl flim-modules)))
)
;;; FLIM-ELS ends here
1.10.4 Shin-H\e-Dòsono\e-A \e$(B?7=K1`\e(B ; <=> JR \e$(BJRD.@~\e(B \e$(B=K1`\e(B
1.10.5 Kizugawadai \e$(BLZDE@nBf\e(B
1.11.0 Yamadagawa \e$(B;3ED@n\e(B
------ Takanohara \e$(B9b$N86\e(B
------ Heij\e-Dò\e-A \e$(BJ?>k\e(B
+1.11.1 Takanohara \e$(B9b$N86\e(B
+1.11.2 Heij\e-Dò\e-A \e$(BJ?>k\e(B
----- Saidaiji \e$(B@>Bg;{\e(B
;;-------------------------------------------------------------------------
;; Kinki Nippon Railway \e$(B6a5&F|K\E4F;\e(B http://www.kintetsu.co.jp/
#
PACKAGE = flim
-VERSION = 1.11.0
+VERSION = 1.11.2
TAR = tar
RM = /bin/rm -f
as an obsolete alias.
+** Behavior change of `mime-insert-header'
+
+Each field-name of second and third argument of function
+`mime-insert-header' can include `:'.
+
+
+** Abolish variable `mime-temp-directory'
+
+Now FLIM uses `temporary-file-directory' instead of
+`mime-temp-directory'. So environment variable "MIME_TMP_DIR" and
+"TM_TMP_DIR" are not effective to specify temporary directory of FLIM.
+
+
** Add new function `eword-decode-and-unfold-unstructured-field'
Installation
============
-(0) before installing it, please install APEL (9.4 or later) package.
+(0) before installing it, please install APEL (9.6 or later) package.
APEL package is available at:
ftp://ftp.jaist.ac.jp/pub/GNU/elisp/apel/
--- /dev/null
+[FLIM \e$B$N\e(B README (\e$BF|K\8lHG\e(B)]
+
+FLIM \e$B$H$O!)\e(B
+===========
+
+ FLIM \e$B$O%a%C%;!<%8I=8=$HId9f2=$K4X$9$k4pACE*$J5!G=$rDs6!$9$k%i%$%V%i\e(B
+ \e$B%j!<$G$9!#0J2<$N%b%8%e!<%k$+$i9=@.$5$l$F$$$^$9\e(B:
+
+ std11.el --- STD 11 (RFC 822) \e$B$N2r@O4o$H%f!<%F%#%j%F%#!<\e(B
+
+ mime.el --- MIME \e$B%i%$%V%i%j!<\e(B
+
+ mime-def.el --- MIME \e$B$NMM<0$K4X$9$kDj5A\e(B
+
+ mime-parse.el --- MIME \e$B2r@O4o\e(B
+
+ mel.el --- MIME \e$BId9f4o\e(B/\e$BI|9f4o\e(B
+ mel-b-dl.el --- base64 (B-encoding) \e$BId9f4o\e(B/\e$BI|9f4o\e(B
+ (Emacs 20 \e$B$NF0E*FI$_9~$_5!G=IU$-MQ\e(B)
+ mel-b.el --- base64 (B-encoding) \e$BId9f4o\e(B/\e$BI|9f4o\e(B
+ (\e$BB>$N\e(B emacs \e$B4D6-MQ\e(B)
+ mel-q.el --- quoted-printable \e$B$H\e(B Q-encoding
+ \e$BId9f4o\e(B/\e$BI|9f4o\e(B
+ mel-ccl.el --- CCL \e$B$r;H$C$?\e(B base64 (B-encoding),
+ quoted-printable \e$B$H\e(B Q-encoding \e$B$NId9f4o\e(B/\e$BI|9f4o\e(B
+ mel-u.el --- uuencode \e$B$N$?$a$NHs8x<0%b%8%e!<%k\e(B
+ mel-g.el --- gzip64 \e$B$N$?$a$NHs8x<0%b%8%e!<%k\e(B
+
+ eword-decode.el --- encoded-word \e$BI|9f4o\e(B
+ eword-encode.el --- encoded-word \e$BId9f4o\e(B
+
+ mailcap.el --- mailcap \e$B2r@O4o$H%f!<%F%#%j%F%#!<\e(B
+
+
+\e$B%$%s%9%H!<%k\e(B
+============
+
+(0) \e$B%$%s%9%H!<%k$9$kA0$K!"\e(BAPEL \e$B%Q%C%1!<%8$r%$%s%9%H!<%k$7$F$/$@$5$$!#\e(B
+ APEL \e$B%Q%C%1!<%8$O0J2<$N$H$3$m$G<hF@$G$-$^$9\e(B:
+
+ ftp://ftp.jaist.ac.jp/pub/GNU/elisp/apel/
+
+(1-a) \e$BE83+$7$?>l=j$G<B9T\e(B
+
+ \e$BB>$N%G%#%l%/%H%j!<$K%$%s%9%H!<%k$7$?$/$J$$$J$i!"0J2<$N$3$H$@$1$r$d$C\e(B
+ \e$B$F$/$@$5$$\e(B:
+
+ % make
+
+ emacs \e$B$N%3%^%s%IL>$r;XDj$9$k$3$H$,$G$-$^$9!#Nc$($P!"\e(B
+
+ % make EMACS=xemacs
+
+ `EMACS=...' \e$B$,>JN,$5$l$k$H!"\e(BEmacs=emacs \e$B$,;H$o$l$^$9!#\e(B
+
+(b) make install
+
+ \e$BB>$N%G%#%l%/%H%j!<$K%$%s%9%H!<%k$7$?$$$J$i!"0J2<$N$3$H$r$7$F$/$@$5$$\e(B:
+
+ % make install
+
+ emacs \e$B$N%3%^%s%IL>$r;XDj$9$k$3$H$,$G$-$^$9!#Nc$($P!"\e(B
+
+ % make install EMACS=xemacs
+
+ `EMACS=...' \e$B$,>JN,$5$l$k$H!"\e(BEmacs=emacs \e$B$,;H$o$l$^$9!#\e(B
+
+ Emacs Lisp \e$B%W%m%0%i%`$H%7%'%k%9%/%j%W%H$N$?$a$N%G%#%l%/%H%j!<LZ$N@\\e(B
+ \e$BF,<-\e(B (prefix) \e$B$r;XDj$9$k$3$H$,$G$-$^$9!#Nc$($P!"\e(B
+
+ % make install PREFIX=~/
+
+ `PREFIX=...' \e$B$,>JN,$5$l$k$H!";XDj$5$l$?\e(B emacs \e$B%3%^%s%I$N%G%#%l%/%H%j!<\e(B
+ \e$BLZ$N@\F,<-$,;HMQ$5$l$^$9\e(B (\e$B$*$=$i$/\e(B /usr/local \e$B$G$9\e(B)\e$B!#\e(B
+
+ \e$BNc$($P!"\e(BPREFIX=/usr/local \e$B$H\e(B Emacs 19.34 \e$B$,;XDj$5$l$l$P!"0J2<$N%G%#%l\e(B
+ \e$B%/%H%j!<LZ$,:n@.$5$l$^$9!#\e(B
+
+ /usr/local/share/emacs/site-lisp/flim/ --- FLIM
+
+ Emacs Lisp \e$B%W%m%0%i%`$N$?$a$N\e(B lisp \e$B%G%#%l%/%H%j!<$r;XDj$9$k$3$H$,$G\e(B
+ \e$B$-$^$9!#Nc$($P!"\e(B:
+
+ % make install LISPDIR=~/share/emacs/elisp
+
+ `LISPDIR=...' \e$B$,>JN,$5$l$k$H!";XDj$5$l$?\e(B emacs \e$B$N%3%^%s%I$N\e(B
+ site-lisp \e$B%G%#%l%/%H%j!<$,;H$o$l$^$9\e(B (\e$B$*$=$i$/\e(B
+ /usr/local/share/emacs/site-lisp \e$B$+\e(B /usr/local/lib/xemacs/site-lisp)
+ \e$B$G$9!#\e(B
+
+ emu \e$B%b%8%e!<%k\e(B (APEL \e$B%Q%C%1!<%8$KF~$C$F$$$^$9\e(B) \e$B$,I8=`$G$J$$%G%#%l%/\e(B
+ \e$B%H%j!<$K%$%s%9%H!<%k$5$l$F$$$k>l9g$O!"$=$l$i$N$"$k>l=j$r;XDj$9$kI,MW\e(B
+ \e$B$,$"$j$^$9!#Nc$($P!"\e(B:
+
+ % make install VERSION_SPECIFIC_LISPDIR=~/elisp
+
+ \e$B$I$N%U%!%$%k$,\e(B emu \e$B%b%8%e!<%k$+\e(B apel \e$B%b%8%e!<%k$N0lIt$J$N$+!"$=$l$i\e(B
+ \e$B$,$I$3$K%$%s%9%H!<%k$5$l$k$+$rCN$j$?$$$H$-$O!"<!$N$h$&$J%3%^%s%I$rF~\e(B
+ \e$BNO$9$k$3$H$,$G$-$^$9!#\e(B
+
+ % make what-where LISPDIR=~/elisp VERSION_SPECIFIC_LISPDIR=~/elisp
+
+ \e$B%U%!%$%k\e(B FLIM-CFG \e$B$rJT=8$9$k$3$H$GB>$NA*Br<+M3$J@_Dj$r;XDj$9$k$3$H$,\e(B
+ \e$B$G$-$^$9!#$=$NCf$N%3%a%s%H$rFI$s$G$/$@$5$$!#\e(B
+
+(1-c) XEmacs \e$B$N%Q%C%1!<%8$H$7$F%$%s%9%H!<%k$9$k\e(B
+
+ XEmacs \e$B$N%Q%C%1!<%8%G%#%l%/%H%j!<$K%$%s%9%H!<%k$9$k>l9g$O!"0J2<$N$3\e(B
+ \e$B$H$r$7$F$/$@$5$$\e(B:
+
+ % make install-package
+
+ emacs \e$B$N%3%^%s%IL>$r;XDj$9$k$3$H$,$G$-$^$9!#Nc$($P!"\e(B
+
+ % make install-package XEMACS=xemacs-21
+
+ `XEMACS=...' \e$B$,>JN,$5$l$k$H!"\e(BXEMACS=xemacs \e$B$,;HMQ$5$l$^$9!#\e(B
+
+ \e$B%Q%C%1!<%8$N%G%#%l%/%H%j!<$r;XDj$9$k$3$H$,$G$-$^$9!#Nc$($P\e(B:
+
+ % make install PACKAGEDIR=~/.xemacs
+
+ `PACKAGEDIR=...' \e$B$,>JN,$5$l$k$H!"B8:_$9$k%Q%C%1!<%8%G%#%l%/%H%j!<$N\e(B
+ \e$B:G=i$N$b$N$,;H$o$l$^$9!#\e(B
+
+ XEmacs \e$B$N%Q%C%1!<%8%7%9%F%`$O\e(B XEmacs 21.0 \e$B$+$=$l0J9_$rMW5a$9$k$3$H$K\e(B
+ \e$BCm0U$7$F$/$@$5$$!#\e(B
+
+load-path (Emacs \e$B$H\e(B MULE \e$BMQ\e(B)
+=============================
+
+ Emacs \e$B$+\e(B Mule \e$B$r;H$C$F$$$k$J$i!"\e(BFLIM \e$B$N%G%#%l%/%H%j!<$r\e(B
+ load-path \e$B$KDI2C$7$F$/$@$5$$!#=i4|@_Dj$G%$%s%9%H!<%k$7$?$J$i!"<!$N$h\e(B
+ \e$B$&$K\e(B subdirs.el \e$B$r=q$/$3$H$,$G$-$^$9!#Nc\e(B:
+
+ --------------------------------------------------------------------
+ (normal-top-level-add-to-load-path '("apel" "flim"))
+ --------------------------------------------------------------------
+
+ XEmacs \e$B$r;H$C$F$$$k$J$i!"\e(Bload-path \e$B$r@_Dj$9$kI,MW$O$"$j$^$;$s!#\e(B
+
+\e$B%P%0Js9p\e(B
+===========
+
+ \e$B%P%0Js9p$d2~A1$NDs0F$r=q$$$?$H$-$O!"@'Hs\e(B tm \e$B%a!<%j%s%0%j%9%H$KAw$C$F\e(B
+ \e$B$/$@$5$$\e(B:
+
+ bug-tm-en@chamonix.jaist.ac.jp (\e$B1Q8l\e(B)
+ bug-tm-ja@chamonix.jaist.ac.jp (\e$BF|K\8l\e(B)
+
+ tm ML \e$B$rDL$7$F!"\e(BFLIM \e$B$N%P%0$rJs9p$7$?$j!"\e(BFLIM \e$B$N:G?7$N%j%j!<%9$r<hF@\e(B
+ \e$B$7$?$j!"\e(BFLIM \e$B$N>-Mh$N3HD%$N5DO@$r$7$?$j$9$k$3$H$,$G$-$^$9!#\e(Btm ML \e$B$K\e(B
+ \e$B;22C$9$k$K$O!"6u$NEE;R%a!<%k$r\e(B
+
+ tm-en-help@chamonix.jaist.ac.jp (\e$B1Q8l\e(B)
+ tm-ja-help@chamonix.jaist.ac.jp (\e$BF|K\8l\e(B)
+
+ \e$B$KAw$C$F$/$@$5$$!#\e(B
Non MIME encoded-word part in FILED-BODY is decoded with
`default-mime-charset'."
+ (if (symbolp field-name) (setq field-name (symbol-name field-name)))
(let ((decoded
(if unfolded
(let ((ew-ignore-76bytes-limit t))
- (ew-decode-field (symbol-name field-name)
- (ew-lf-crlf-to-crlf field-body)))
- (ew-decode-field (symbol-name field-name)
- (ew-lf-crlf-to-crlf field-body)))))
+ (ew-decode-field
+ field-name (ew-lf-crlf-to-crlf field-body)))
+ (ew-decode-field
+ field-name (ew-lf-crlf-to-crlf field-body)))))
(if max-column
(setq decoded (ew-crlf-refold
decoded
(1+ (string-width field-name))
- (if (integerp max-column) max-column fill-column)))
+ (if (eq max-column t) fill-column max-column)))
(setq decoded (ew-crlf-unfold decoded)))
(ew-crlf-to-lf decoded)))
(or column eword-encode-default-start-column)
(eword-encode-split-string string 'text))))
-(defun eword-encode-field (string)
- "Encode header field STRING, and return the result.
+(defun eword-encode-field-body (field-body field-name)
+ "Encode FIELD-BODY as FIELD-NAME, and return the result.
A lexical token includes non-ASCII character is encoded as MIME
encoded-word. ASCII token is not encoded."
- (setq string (std11-unfold-string string))
- (let ((ret (string-match std11-field-head-regexp string)))
- (or (if ret
- (let ((field-name (substring string 0 (1- (match-end 0))))
- (field-body (eliminate-top-spaces
- (substring string (match-end 0))))
- field-name-symbol)
- (if (setq ret
- (cond ((string= field-body "") "")
- ((memq (setq field-name-symbol
- (intern (capitalize field-name)))
- '(Reply-To
- From Sender
- Resent-Reply-To Resent-From
- Resent-Sender To Resent-To
- Cc Resent-Cc Bcc Resent-Bcc
- Dcc))
- (eword-encode-address-list
- field-body (+ (length field-name) 2))
- )
- ((eq field-name-symbol 'In-Reply-To)
- (eword-encode-in-reply-to
- field-body (+ (length field-name) 2))
- )
- ((memq field-name-symbol
- '(Mime-Version User-Agent))
- (eword-encode-structured-field-body
- field-body (+ (length field-name) 2))
- )
- (t
- (eword-encode-unstructured-field-body
- field-body (1+ (length field-name)))
- ))
- )
- (concat field-name ": " ret)
- )))
- (eword-encode-string string 0)
- )))
+ (if (string= field-body "")
+ ""
+ (let (start)
+ (if (symbolp field-name)
+ (setq start (1+ (length (symbol-name field-name))))
+ (setq start (1+ (length field-name))
+ field-name (intern (capitalize field-name))))
+ (cond ((memq field-name
+ '(Reply-To
+ From Sender
+ Resent-Reply-To Resent-From
+ Resent-Sender To Resent-To
+ Cc Resent-Cc Bcc Resent-Bcc
+ Dcc))
+ (eword-encode-address-list field-body start)
+ )
+ ((eq field-name 'In-Reply-To)
+ (eword-encode-in-reply-to field-body start)
+ )
+ ((memq field-name '(Mime-Version User-Agent))
+ (eword-encode-structured-field-body field-body start)
+ )
+ (t
+ (eword-encode-unstructured-field-body field-body start)
+ ))
+ )))
(defun eword-in-subject-p ()
(let ((str (std11-field-body "Subject")))
(std11-narrow-to-header mail-header-separator)
(goto-char (point-min))
(let ((default-cs (mime-charset-to-coding-system default-mime-charset))
- beg end field-name)
+ bbeg end field-name)
(while (re-search-forward std11-field-head-regexp nil t)
- (setq beg (match-beginning 0))
- (setq field-name (buffer-substring beg (1- (match-end 0))))
- (setq end (std11-field-end))
- (and (find-non-ascii-charset-region beg end)
+ (setq bbeg (match-end 0)
+ field-name (buffer-substring (match-beginning 0) (1- bbeg))
+ end (std11-field-end))
+ (and (find-non-ascii-charset-region bbeg end)
(let ((method (eword-find-field-encoding-method
(downcase field-name))))
(cond ((eq method 'mime)
- (let ((field
- (buffer-substring-no-properties beg end)
+ (let ((field-body
+ (buffer-substring-no-properties bbeg end)
))
- (delete-region beg end)
- (insert (eword-encode-field field))
+ (delete-region bbeg end)
+ (insert (eword-encode-field-body field-body
+ field-name))
))
(code-conversion
(let ((cs
(or (mime-charset-to-coding-system
method)
default-cs)))
- (encode-coding-region beg end cs)
+ (encode-coding-region bbeg end cs)
)))
))
))
;;; Code:
-(require 'emu)
+(require 'poe)
(require 'mime-def)
(eval-and-compile
--- /dev/null
+;;; mel-b-el.el: Base64 encoder/decoder for GNU Emacs
+
+;; Copyright (C) 1992,1995,1996,1997,1998 Free Software Foundation, Inc.
+
+;; Author: ENAMI Tsugutomo <enami@sys.ptg.sony.co.jp>
+;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Created: 1995/6/24
+;; Keywords: MIME, Base64
+
+;; This file is part of MEL (MIME Encoding Library).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Code:
+
+(require 'poe)
+(require 'mime-def)
+
+
+;;; @ variables
+;;;
+
+(defgroup base64 nil
+ "Base64 encoder/decoder"
+ :group 'mime)
+
+(defcustom base64-external-encoder '("mmencode")
+ "*list of base64 encoder program name and its arguments."
+ :group 'base64
+ :type '(cons (file :tag "Command")(repeat :tag "Arguments" string)))
+
+(defcustom base64-external-decoder '("mmencode" "-u")
+ "*list of base64 decoder program name and its arguments."
+ :group 'base64
+ :type '(cons (file :tag "Command")(repeat :tag "Arguments" string)))
+
+(defcustom base64-external-decoder-option-to-specify-file '("-o")
+ "*list of options of base64 decoder program to specify file."
+ :group 'base64
+ :type '(repeat :tag "Arguments" string))
+
+(defcustom base64-internal-encoding-limit 1000
+ "*limit size to use internal base64 encoder.
+If size of input to encode is larger than this limit,
+external encoder is called."
+ :group 'base64
+ :type '(choice (const :tag "Always use internal encoder" nil)
+ (integer :tag "Size")))
+
+(defcustom base64-internal-decoding-limit (if (and (featurep 'xemacs)
+ (featurep 'mule))
+ 1000
+ 7600)
+ "*limit size to use internal base64 decoder.
+If size of input to decode is larger than this limit,
+external decoder is called."
+ :group 'base64
+ :type '(choice (const :tag "Always use internal decoder" nil)
+ (integer :tag "Size")))
+
+
+;;; @ internal base64 encoder
+;;; based on base64 decoder by Enami Tsugutomo
+
+(eval-and-compile
+ (defconst base64-characters
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
+ )
+
+(defmacro base64-num-to-char (n)
+ `(aref base64-characters ,n))
+
+(defun base64-encode-1 (pack)
+ (let ((a (car pack))
+ (b (nth 1 pack))
+ (c (nth 2 pack)))
+ (concat
+ (char-to-string (base64-num-to-char (ash a -2)))
+ (if b
+ (concat
+ (char-to-string
+ (base64-num-to-char (logior (ash (logand a 3) 4) (ash b -4))))
+ (if c
+ (concat
+ (char-to-string
+ (base64-num-to-char (logior (ash (logand b 15) 2) (ash c -6))))
+ (char-to-string (base64-num-to-char (logand c 63)))
+ )
+ (concat (char-to-string
+ (base64-num-to-char (ash (logand b 15) 2))) "=")
+ ))
+ (concat (char-to-string
+ (base64-num-to-char (ash (logand a 3) 4))) "==")
+ ))))
+
+(defun-maybe base64-encode-string (string)
+ "Encode STRING to base64, and return the result."
+ (let ((len (length string))
+ (b 0)(e 57)
+ dest)
+ (while (< e len)
+ (setq dest
+ (concat dest
+ (mapconcat
+ (function base64-encode-1)
+ (pack-sequence (substring string b e) 3)
+ "")
+ "\n"))
+ (setq b e
+ e (+ e 57)
+ )
+ )
+ (let* ((es (mapconcat
+ (function base64-encode-1)
+ (pack-sequence (substring string b) 3)
+ ""))
+ (m (mod (length es) 4))
+ )
+ (concat dest es (cond ((= m 3) "=")
+ ((= m 2) "==")
+ ))
+ )))
+
+(defun base64-internal-encode-region (beg end)
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (let ((str (buffer-substring beg end)))
+ (delete-region beg end)
+ (insert (base64-encode-string str))
+ )
+ (or (bolp)
+ (insert "\n")
+ )
+ )))
+
+
+;;; @ internal base64 decoder
+;;;
+
+(defconst base64-numbers
+ (eval-when-compile
+ (let ((len (length base64-characters))
+ (vec (make-vector 123 nil))
+ (i 0))
+ (while (< i len)
+ (aset vec (aref base64-characters i) i)
+ (setq i (1+ i)))
+ vec)))
+
+(defmacro base64-char-to-num (c)
+ `(aref base64-numbers ,c))
+
+(defsubst base64-internal-decode (string buffer)
+ (let* ((len (length string))
+ (i 0)
+ (j 0)
+ v1 v2 v3)
+ (catch 'tag
+ (while (< i len)
+ (when (prog1 (setq v1 (base64-char-to-num (aref string i)))
+ (setq i (1+ i)))
+ (setq v2 (base64-char-to-num (aref string i))
+ i (1+ i)
+ v3 (base64-char-to-num (aref string i))
+ i (1+ i))
+ (aset buffer j (logior (lsh v1 2)(lsh v2 -4)))
+ (setq j (1+ j))
+ (if v3
+ (let ((v4 (base64-char-to-num (aref string i))))
+ (setq i (1+ i))
+ (aset buffer j (logior (lsh (logand v2 15) 4)(lsh v3 -2)))
+ (setq j (1+ j))
+ (if v4
+ (aset buffer (prog1 j (setq j (1+ j)))
+ (logior (lsh (logand v3 3) 6) v4))
+ (throw 'tag nil)
+ ))
+ (throw 'tag nil)
+ ))))
+ (substring buffer 0 j)
+ ))
+
+(defun base64-internal-decode-string (string)
+ (base64-internal-decode string (make-string (length string) 0)))
+
+;; (defsubst base64-decode-string! (string)
+;; (setq string (string-as-unibyte string))
+;; (base64-internal-decode string string))
+
+(defun base64-internal-decode-region (beg end)
+ (save-excursion
+ (let ((str (string-as-unibyte (buffer-substring beg end))))
+ (delete-region beg end)
+ (goto-char beg)
+ (insert (base64-internal-decode str str)))))
+
+;; (defun base64-internal-decode-region2 (beg end)
+;; (save-excursion
+;; (let ((str (buffer-substring beg end)))
+;; (delete-region beg end)
+;; (goto-char beg)
+;; (insert (base64-decode-string! str)))))
+
+;; (defun base64-internal-decode-region3 (beg end)
+;; (save-excursion
+;; (let ((str (buffer-substring beg end)))
+;; (delete-region beg end)
+;; (goto-char beg)
+;; (insert (base64-internal-decode-string str)))))
+
+
+;;; @ external encoder/decoder
+;;;
+
+(defun base64-external-encode-region (beg end)
+ (save-excursion
+ (save-restriction
+ (narrow-to-region beg end)
+ (as-binary-process
+ (apply (function call-process-region)
+ beg end (car base64-external-encoder)
+ t t nil (cdr base64-external-encoder)))
+ ;; for OS/2
+ ;; regularize line break code
+ (goto-char (point-min))
+ (while (re-search-forward "\r$" nil t)
+ (replace-match ""))
+ )))
+
+(defun base64-external-decode-region (beg end)
+ (save-excursion
+ (as-binary-process
+ (apply (function call-process-region)
+ beg end (car base64-external-decoder)
+ t t nil (cdr base64-external-decoder)))
+ ))
+
+(defun base64-external-decode-string (string)
+ (with-temp-buffer
+ (insert string)
+ (as-binary-process
+ (apply (function call-process-region)
+ (point-min) (point-max)
+ (car base64-external-decoder)
+ t t nil (cdr base64-external-decoder)))
+ (buffer-string)))
+
+
+;;; @ application interfaces
+;;;
+
+(defun-maybe base64-encode-region (start end)
+ "Encode current region by base64.
+START and END are buffer positions.
+This function calls internal base64 encoder if size of region is
+smaller than `base64-internal-encoding-limit', otherwise it calls
+external base64 encoder specified by `base64-external-encoder'. In
+this case, you must install the program (maybe mmencode included in
+metamail or XEmacs package)."
+ (interactive "r")
+ (if (and base64-internal-encoding-limit
+ (> (- end start) base64-internal-encoding-limit))
+ (base64-external-encode-region start end)
+ (base64-internal-encode-region start end)))
+
+(defun-maybe base64-decode-region (start end)
+ "Decode current region by base64.
+START and END are buffer positions.
+This function calls internal base64 decoder if size of region is
+smaller than `base64-internal-decoding-limit', otherwise it calls
+external base64 decoder specified by `base64-external-decoder'. In
+this case, you must install the program (maybe mmencode included in
+metamail or XEmacs package)."
+ (interactive "r")
+ (if (and base64-internal-decoding-limit
+ (> (- end start) base64-internal-decoding-limit))
+ (base64-external-decode-region start end)
+ (base64-internal-decode-region start end)))
+
+(defun-maybe base64-decode-string (string)
+ "Decode STRING which is encoded in base64, and return the result.
+This function calls internal base64 decoder if size of STRING is
+smaller than `base64-internal-decoding-limit', otherwise it calls
+external base64 decoder specified by `base64-external-decoder'. In
+this case, you must install the program (maybe mmencode included in
+metamail or XEmacs package)."
+ (interactive "r")
+ (if (and base64-internal-decoding-limit
+ (> (length string) base64-internal-decoding-limit))
+ (base64-external-decode-string string)
+ (base64-internal-decode-string string)))
+
+
+(mel-define-method-function (mime-encode-string string (nil "base64"))
+ 'base64-encode-string)
+(mel-define-method-function (mime-decode-string string (nil "base64"))
+ 'base64-decode-string)
+(mel-define-method-function (mime-encode-region start end (nil "base64"))
+ 'base64-encode-region)
+(mel-define-method-function (mime-decode-region start end (nil "base64"))
+ 'base64-decode-region)
+
+(mel-define-method-function (encoded-text-encode-string string (nil "B"))
+ 'base64-encode-string)
+
+(mel-define-method encoded-text-decode-string (string (nil "B"))
+ (if (and (string-match B-encoded-text-regexp string)
+ (string= string (match-string 0 string)))
+ (base64-decode-string string)
+ (error "Invalid encoded-text %s" string)))
+
+(defun base64-insert-encoded-file (filename)
+ "Encode contents of file FILENAME to base64, and insert the result.
+It calls external base64 encoder specified by
+`base64-external-encoder'. So you must install the program (maybe
+mmencode included in metamail or XEmacs package)."
+ (interactive (list (read-file-name "Insert encoded file: ")))
+ (if (and base64-internal-encoding-limit
+ (> (nth 7 (file-attributes filename))
+ base64-internal-encoding-limit))
+ (apply (function call-process) (car base64-external-encoder)
+ filename t nil (cdr base64-external-encoder))
+ (insert
+ (base64-encode-string
+ (with-temp-buffer
+ (set-buffer-multibyte nil)
+ (insert-file-contents-as-binary filename)
+ (buffer-string))))
+ (or (bolp)
+ (insert "\n"))
+ ))
+
+(mel-define-method-function (mime-insert-encoded-file filename (nil "base64"))
+ 'base64-insert-encoded-file)
+
+(defun base64-write-decoded-region (start end filename)
+ "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: ")))
+ (if (and base64-internal-decoding-limit
+ (> (- end start) base64-internal-decoding-limit))
+ (as-binary-process
+ (apply (function call-process-region)
+ start end (car base64-external-decoder)
+ nil nil nil
+ (append (cdr base64-external-decoder)
+ base64-external-decoder-option-to-specify-file
+ (list filename))))
+ (let ((str (buffer-substring start end)))
+ (with-temp-buffer
+ (insert (base64-internal-decode-string str))
+ (write-region-as-binary (point-min) (point-max) filename)
+ ))))
+
+(mel-define-method-function
+ (mime-write-decoded-region start end filename (nil "base64"))
+ 'base64-write-decoded-region)
+
+
+;;; @ etc
+;;;
+
+(defun pack-sequence (seq size)
+ "Split sequence SEQ into SIZE elements packs,
+and return list of packs. [mel-b-el; tl-seq function]"
+ (let ((len (length seq)) (p 0) obj
+ unit (i 0)
+ dest)
+ (while (< p len)
+ (setq obj (elt seq p))
+ (setq unit (cons obj unit))
+ (setq i (1+ i))
+ (if (= i size)
+ (progn
+ (setq dest (cons (reverse unit) dest))
+ (setq unit nil)
+ (setq i 0)
+ ))
+ (setq p (1+ p))
+ )
+ (if unit
+ (setq dest (cons (reverse unit) dest))
+ )
+ (reverse dest)
+ ))
+
+
+;;; @ end
+;;;
+
+(provide 'mel-b-el)
+
+;;; mel-b-el.el ends here.
+++ /dev/null
-;;; mel-b.el: Base64 encoder/decoder for GNU Emacs
-
-;; Copyright (C) 1992,1995,1996,1997,1998 Free Software Foundation, Inc.
-
-;; Author: ENAMI Tsugutomo <enami@sys.ptg.sony.co.jp>
-;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Created: 1995/6/24
-;; Keywords: MIME, Base64
-
-;; This file is part of MEL (MIME Encoding Library).
-
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2, or (at
-;; your option) any later version.
-
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;; General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Code:
-
-(require 'emu)
-(require 'mime-def)
-
-
-;;; @ variables
-;;;
-
-(defgroup base64 nil
- "Base64 encoder/decoder"
- :group 'mime)
-
-(defcustom base64-external-encoder '("mmencode")
- "*list of base64 encoder program name and its arguments."
- :group 'base64
- :type '(cons (file :tag "Command")(repeat :tag "Arguments" string)))
-
-(defcustom base64-external-decoder '("mmencode" "-u")
- "*list of base64 decoder program name and its arguments."
- :group 'base64
- :type '(cons (file :tag "Command")(repeat :tag "Arguments" string)))
-
-(defcustom base64-external-decoder-option-to-specify-file '("-o")
- "*list of options of base64 decoder program to specify file."
- :group 'base64
- :type '(repeat :tag "Arguments" string))
-
-(defcustom base64-internal-encoding-limit 1000
- "*limit size to use internal base64 encoder.
-If size of input to encode is larger than this limit,
-external encoder is called."
- :group 'base64
- :type '(choice (const :tag "Always use internal encoder" nil)
- (integer :tag "Size")))
-
-(defcustom base64-internal-decoding-limit (if (and (featurep 'xemacs)
- (featurep 'mule))
- 1000
- 7600)
- "*limit size to use internal base64 decoder.
-If size of input to decode is larger than this limit,
-external decoder is called."
- :group 'base64
- :type '(choice (const :tag "Always use internal decoder" nil)
- (integer :tag "Size")))
-
-
-;;; @ internal base64 encoder
-;;; based on base64 decoder by Enami Tsugutomo
-
-(eval-and-compile
- (defconst base64-characters
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
- )
-
-(defmacro base64-num-to-char (n)
- `(aref base64-characters ,n))
-
-(defun base64-encode-1 (pack)
- (let ((a (car pack))
- (b (nth 1 pack))
- (c (nth 2 pack)))
- (concat
- (char-to-string (base64-num-to-char (ash a -2)))
- (if b
- (concat
- (char-to-string
- (base64-num-to-char (logior (ash (logand a 3) 4) (ash b -4))))
- (if c
- (concat
- (char-to-string
- (base64-num-to-char (logior (ash (logand b 15) 2) (ash c -6))))
- (char-to-string (base64-num-to-char (logand c 63)))
- )
- (concat (char-to-string
- (base64-num-to-char (ash (logand b 15) 2))) "=")
- ))
- (concat (char-to-string
- (base64-num-to-char (ash (logand a 3) 4))) "==")
- ))))
-
-(defun base64-encode-string (string)
- "Encode STRING to base64, and return the result."
- (let ((len (length string))
- (b 0)(e 57)
- dest)
- (while (< e len)
- (setq dest
- (concat dest
- (mapconcat
- (function base64-encode-1)
- (pack-sequence (substring string b e) 3)
- "")
- "\n"))
- (setq b e
- e (+ e 57)
- )
- )
- (let* ((es (mapconcat
- (function base64-encode-1)
- (pack-sequence (substring string b) 3)
- ""))
- (m (mod (length es) 4))
- )
- (concat dest es (cond ((= m 3) "=")
- ((= m 2) "==")
- ))
- )))
-
-(defun base64-internal-encode-region (beg end)
- (save-excursion
- (save-restriction
- (narrow-to-region beg end)
- (let ((str (buffer-substring beg end)))
- (delete-region beg end)
- (insert (base64-encode-string str))
- )
- (or (bolp)
- (insert "\n")
- )
- )))
-
-
-;;; @ internal base64 decoder
-;;;
-
-(defconst base64-numbers
- (eval-when-compile
- (let ((len (length base64-characters))
- (vec (make-vector 123 nil))
- (i 0))
- (while (< i len)
- (aset vec (aref base64-characters i) i)
- (setq i (1+ i)))
- vec)))
-
-(defmacro base64-char-to-num (c)
- `(aref base64-numbers ,c))
-
-(defsubst base64-internal-decode (string buffer)
- (let* ((len (length string))
- (i 0)
- (j 0)
- v1 v2 v3)
- (catch 'tag
- (while (< i len)
- (when (prog1 (setq v1 (base64-char-to-num (aref string i)))
- (setq i (1+ i)))
- (setq v2 (base64-char-to-num (aref string i))
- i (1+ i)
- v3 (base64-char-to-num (aref string i))
- i (1+ i))
- (aset buffer j (logior (lsh v1 2)(lsh v2 -4)))
- (setq j (1+ j))
- (if v3
- (let ((v4 (base64-char-to-num (aref string i))))
- (setq i (1+ i))
- (aset buffer j (logior (lsh (logand v2 15) 4)(lsh v3 -2)))
- (setq j (1+ j))
- (if v4
- (aset buffer (prog1 j (setq j (1+ j)))
- (logior (lsh (logand v3 3) 6) v4))
- (throw 'tag nil)
- ))
- (throw 'tag nil)
- ))))
- (substring buffer 0 j)
- ))
-
-(defun base64-internal-decode-string (string)
- (base64-internal-decode string (make-string (length string) 0)))
-
-;; (defsubst base64-decode-string! (string)
-;; (setq string (string-as-unibyte string))
-;; (base64-internal-decode string string))
-
-(defun base64-internal-decode-region (beg end)
- (save-excursion
- (let ((str (string-as-unibyte (buffer-substring beg end))))
- (delete-region beg end)
- (goto-char beg)
- (insert (base64-internal-decode str str)))))
-
-;; (defun base64-internal-decode-region2 (beg end)
-;; (save-excursion
-;; (let ((str (buffer-substring beg end)))
-;; (delete-region beg end)
-;; (goto-char beg)
-;; (insert (base64-decode-string! str)))))
-
-;; (defun base64-internal-decode-region3 (beg end)
-;; (save-excursion
-;; (let ((str (buffer-substring beg end)))
-;; (delete-region beg end)
-;; (goto-char beg)
-;; (insert (base64-internal-decode-string str)))))
-
-
-;;; @ external encoder/decoder
-;;;
-
-(defun base64-external-encode-region (beg end)
- (save-excursion
- (save-restriction
- (narrow-to-region beg end)
- (as-binary-process
- (apply (function call-process-region)
- beg end (car base64-external-encoder)
- t t nil (cdr base64-external-encoder)))
- ;; for OS/2
- ;; regularize line break code
- (goto-char (point-min))
- (while (re-search-forward "\r$" nil t)
- (replace-match ""))
- )))
-
-(defun base64-external-decode-region (beg end)
- (save-excursion
- (as-binary-process
- (apply (function call-process-region)
- beg end (car base64-external-decoder)
- t t nil (cdr base64-external-decoder)))
- ))
-
-(defun base64-external-decode-string (string)
- (with-temp-buffer
- (insert string)
- (as-binary-process
- (apply (function call-process-region)
- (point-min) (point-max)
- (car base64-external-decoder)
- t t nil (cdr base64-external-decoder)))
- (buffer-string)))
-
-
-;;; @ application interfaces
-;;;
-
-(defun base64-encode-region (start end)
- "Encode current region by base64.
-START and END are buffer positions.
-This function calls internal base64 encoder if size of region is
-smaller than `base64-internal-encoding-limit', otherwise it calls
-external base64 encoder specified by `base64-external-encoder'. In
-this case, you must install the program (maybe mmencode included in
-metamail or XEmacs package)."
- (interactive "r")
- (if (and base64-internal-encoding-limit
- (> (- end start) base64-internal-encoding-limit))
- (base64-external-encode-region start end)
- (base64-internal-encode-region start end)))
-
-(defun base64-decode-region (start end)
- "Decode current region by base64.
-START and END are buffer positions.
-This function calls internal base64 decoder if size of region is
-smaller than `base64-internal-decoding-limit', otherwise it calls
-external base64 decoder specified by `base64-external-decoder'. In
-this case, you must install the program (maybe mmencode included in
-metamail or XEmacs package)."
- (interactive "r")
- (if (and base64-internal-decoding-limit
- (> (- end start) base64-internal-decoding-limit))
- (base64-external-decode-region start end)
- (base64-internal-decode-region start end)))
-
-(defun base64-decode-string (string)
- "Decode STRING which is encoded in base64, and return the result.
-This function calls internal base64 decoder if size of STRING is
-smaller than `base64-internal-decoding-limit', otherwise it calls
-external base64 decoder specified by `base64-external-decoder'. In
-this case, you must install the program (maybe mmencode included in
-metamail or XEmacs package)."
- (interactive "r")
- (if (and base64-internal-decoding-limit
- (> (length string) base64-internal-decoding-limit))
- (base64-external-decode-string string)
- (base64-internal-decode-string string)))
-
-
-(mel-define-method-function (mime-encode-string string (nil "base64"))
- 'base64-encode-string)
-(mel-define-method-function (mime-decode-string string (nil "base64"))
- 'base64-decode-string)
-(mel-define-method-function (mime-encode-region start end (nil "base64"))
- 'base64-encode-region)
-(mel-define-method-function (mime-decode-region start end (nil "base64"))
- 'base64-decode-region)
-
-(mel-define-method-function (encoded-text-encode-string string (nil "B"))
- 'base64-encode-string)
-
-(mel-define-method encoded-text-decode-string (string (nil "B"))
- (if (and (string-match B-encoded-text-regexp string)
- (string= string (match-string 0 string)))
- (base64-decode-string string)
- (error "Invalid encoded-text %s" string)))
-
-(defun base64-insert-encoded-file (filename)
- "Encode contents of file FILENAME to base64, and insert the result.
-It calls external base64 encoder specified by
-`base64-external-encoder'. So you must install the program (maybe
-mmencode included in metamail or XEmacs package)."
- (interactive (list (read-file-name "Insert encoded file: ")))
- (if (and base64-internal-encoding-limit
- (> (nth 7 (file-attributes filename))
- base64-internal-encoding-limit))
- (apply (function call-process) (car base64-external-encoder)
- filename t nil (cdr base64-external-encoder))
- (insert
- (base64-encode-string
- (with-temp-buffer
- (set-buffer-multibyte nil)
- (insert-file-contents-as-binary filename)
- (buffer-string))))
- (or (bolp)
- (insert "\n"))
- ))
-
-(mel-define-method-function (mime-insert-encoded-file filename (nil "base64"))
- 'base64-insert-encoded-file)
-
-(defun base64-write-decoded-region (start end filename)
- "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: ")))
- (if (and base64-internal-decoding-limit
- (> (- end start) base64-internal-decoding-limit))
- (as-binary-process
- (apply (function call-process-region)
- start end (car base64-external-decoder)
- nil nil nil
- (append (cdr base64-external-decoder)
- base64-external-decoder-option-to-specify-file
- (list filename))))
- (let ((str (buffer-substring start end)))
- (with-temp-buffer
- (insert (base64-internal-decode-string str))
- (write-region-as-binary (point-min) (point-max) filename)
- ))))
-
-(mel-define-method-function
- (mime-write-decoded-region start end filename (nil "base64"))
- 'base64-write-decoded-region)
-
-
-;;; @ etc
-;;;
-
-(defun pack-sequence (seq size)
- "Split sequence SEQ into SIZE elements packs,
-and return list of packs. [mel-b; tl-seq function]"
- (let ((len (length seq)) (p 0) obj
- unit (i 0)
- dest)
- (while (< p len)
- (setq obj (elt seq p))
- (setq unit (cons obj unit))
- (setq i (1+ i))
- (if (= i size)
- (progn
- (setq dest (cons (reverse unit) dest))
- (setq unit nil)
- (setq i 0)
- ))
- (setq p (1+ p))
- )
- (if unit
- (setq dest (cons (reverse unit) dest))
- )
- (reverse dest)
- ))
-
-
-;;; @ end
-;;;
-
-(provide 'mel-b)
-
-;;; mel-b.el ends here.
(buffer-substring (match-beginning 0)
(match-end 0))
)))))
- (default-directory mime-temp-directory))
+ (default-directory temporary-file-directory))
(if filename
(as-binary-process
(apply (function call-process-region)
)
(mel-define-method mime-write-decoded-region (start end filename
- (nil "x-gzip64"))
+ (nil "x-uue"))
"Decode and write current region encoded by uuencode into FILENAME.
START and END are buffer positions."
(interactive
(buffer-substring (match-beginning 0)
(match-end 0))
)))))
- (default-directory mime-temp-directory))
+ (default-directory temporary-file-directory))
(if file
(as-binary-process
(apply (function call-process-region)
;;; @ setting for modules
;;;
-(defvar mel-ccl-module (featurep 'mule))
+(mel-define-backend "7bit")
+(mel-define-method-function (mime-encode-string string (nil "7bit"))
+ 'identity)
+(mel-define-method-function (mime-decode-string string (nil "7bit"))
+ 'identity)
+(mel-define-method mime-encode-region (start end (nil "7bit")))
+(mel-define-method mime-decode-region (start end (nil "7bit")))
+(mel-define-method-function (mime-insert-encoded-file filename (nil "7bit"))
+ 'insert-file-contents-as-binary)
+(mel-define-method-function (mime-write-decoded-region
+ start end filename (nil "7bit"))
+ 'write-region-as-binary)
+
+(mel-define-backend "8bit" ("7bit"))
+
+(mel-define-backend "binary" ("8bit"))
+
+(when (and (fboundp 'base64-encode-string)
+ (subrp (symbol-function 'base64-encode-string)))
+ (mel-define-backend "base64")
+ (mel-define-method-function (mime-encode-string string (nil "base64"))
+ 'base64-encode-string)
+ (mel-define-method-function (mime-decode-string string (nil "base64"))
+ 'base64-decode-string)
+ (mel-define-method-function (mime-encode-region start end (nil "base64"))
+ 'base64-encode-region)
+ (mel-define-method-function (mime-decode-region start end (nil "base64"))
+ 'base64-decode-region)
+ (mel-define-method mime-insert-encoded-file (filename (nil "base64"))
+ "Encode contents of file FILENAME to base64, and insert the result.
+It calls external base64 encoder specified by
+`base64-external-encoder'. So you must install the program (maybe
+mmencode included in metamail or XEmacs package)."
+ (interactive (list (read-file-name "Insert encoded file: ")))
+ (insert (base64-encode-string
+ (with-temp-buffer
+ (set-buffer-multibyte nil)
+ (insert-file-contents-as-binary filename)
+ (buffer-string))))
+ (or (bolp)
+ (insert "\n"))
+ )
+
+ (mel-define-method-function (encoded-text-encode-string string (nil "B"))
+ 'base64-encode-string)
+ (mel-define-method encoded-text-decode-string (string (nil "B"))
+ (if (and (string-match B-encoded-text-regexp string)
+ (string= string (match-string 0 string)))
+ (base64-decode-string string)
+ (error "Invalid encoded-text %s" string)))
+ )
+
+(mel-use-module 'mel-b-el '("base64" "B"))
+(mel-use-module 'mel-q '("quoted-printable" "Q"))
+(mel-use-module 'mel-g '("x-gzip64"))
+(mel-use-module 'mel-u '("x-uue" "x-uuencode"))
(defvar mel-b-ccl-module
- (and mel-ccl-module
+ (and (featurep 'mule)
(progn
(require 'path-util)
(module-installed-p 'mel-b-ccl)
)))
(defvar mel-q-ccl-module
- (and mel-ccl-module
+ (and (featurep 'mule)
(progn
(require 'path-util)
(module-installed-p 'mel-q-ccl)
)))
-(mel-use-module 'mel-b '("base64" "B"))
-(mel-use-module 'mel-q '("quoted-printable" "Q"))
-(mel-use-module 'mel-g '("x-gzip64"))
-(mel-use-module 'mel-u '("x-uue" "x-uuencode"))
-
(if mel-b-ccl-module
(mel-use-module 'mel-b-ccl '("base64" "B"))
)
(mel-use-module 'mel-b-dl '("base64" "B"))
)
-(mel-define-backend "7bit")
-(mel-define-method-function (mime-encode-string string (nil "7bit"))
- 'identity)
-(mel-define-method-function (mime-decode-string string (nil "7bit"))
- 'identity)
-(mel-define-method mime-encode-region (start end (nil "7bit")))
-(mel-define-method mime-decode-region (start end (nil "7bit")))
-(mel-define-method-function (mime-insert-encoded-file filename (nil "7bit"))
- 'insert-file-contents-as-binary)
-(mel-define-method-function (mime-write-decoded-region
- start end filename (nil "7bit"))
- 'write-region-as-binary)
-
-(mel-define-backend "8bit" ("7bit"))
-
-(mel-define-backend "binary" ("8bit"))
-
;;; @ region
;;;
;;; Code:
+(require 'mcharset)
+
(eval-and-compile
- (defconst mime-library-product ["FLAM-DOODLE" (1 11 0) "\e$B>.F&\e(B 2.5R3.5/5.0"]
+ (defconst mime-library-product ["FLAM-DOODLE" (1 11 1) "\e$BIrF:Cc\e(B 5.0R4.0/11.0"]
"Product name, version number and code name of MIME-library package.")
)
(custom-handle-keyword 'default-mime-charset :group 'mime
'custom-variable)
-(defcustom mime-temp-directory (or (getenv "MIME_TMP_DIR")
- (getenv "TM_TMP_DIR")
- (getenv "TMPDIR")
- (getenv "TMP")
- (getenv "TEMP")
- "/tmp/")
- "*Directory for temporary files."
- :group 'mime
- :type 'directory)
-
(defcustom mime-uuencode-encoding-name-list '("x-uue" "x-uuencode")
"*List of encoding names for uuencode format."
:group 'mime
;;; @ about STD 11
;;;
-(defconst std11-quoted-pair-regexp "\\\\.")
-(defconst std11-non-qtext-char-list '(?\" ?\\ ?\r ?\n))
-(defconst std11-qtext-regexp
- (concat "[^" (char-list-to-string std11-non-qtext-char-list) "]"))
+(eval-and-compile
+ (defconst std11-quoted-pair-regexp "\\\\.")
+ (defconst std11-non-qtext-char-list '(?\" ?\\ ?\r ?\n))
+ (defconst std11-qtext-regexp
+ (eval-when-compile
+ (concat "[^" (apply #'string std11-non-qtext-char-list) "]"))))
(defconst std11-quoted-string-regexp
- (concat "\""
- (regexp-*
- (regexp-or std11-qtext-regexp std11-quoted-pair-regexp))
- "\""))
+ (eval-when-compile
+ (concat "\""
+ (regexp-*
+ (regexp-or std11-qtext-regexp std11-quoted-pair-regexp))
+ "\"")))
;;; @ about MIME
))))
(put 'mm-define-method 'lisp-indent-function 'defun)
-(put 'mm-define-method 'edebug-form-spec
- '(&define name ((arg symbolp) &rest arg) def-body))
+(def-edebug-spec mm-define-method
+ (&define name ((arg symbolp)
+ [&rest arg]
+ [&optional ["&optional" arg &rest arg]]
+ &optional ["&rest" arg]
+ )
+ def-body))
(defsubst mm-arglist-to-arguments (arglist)
(let (dest)
)))
(defvar base64-dl-module
- (and (fboundp 'dynamic-link)
- (let ((path (expand-file-name "base64.so" exec-directory)))
- (and (file-exists-p path)
- path))))
+ (if (and (fboundp 'base64-encode-string)
+ (subrp (symbol-function 'base64-encode-string)))
+ nil
+ (if (fboundp 'dynamic-link)
+ (let ((path (expand-file-name "base64.so" exec-directory)))
+ (and (file-exists-p path)
+ path)
+ ))))
;;; @ end
<defvar name="default-mime-charset">
<p>
-Symbol to indicate default value of <dref>MIME-charset</dref>.
+Symbol to indicate default value of <dref>MIME charset</dref>.
<p>
-It is used when MIME-charset is not specified.
+It is used when MIME charset is not specified.
<p>
It is originally variable of APEL.
</defvar>
<node> Content-Type parser
<p>
<defun name="mime-parse-Content-Type">
- <args> string
+ <args> string
<p>
-Parse <var>string</var> as field-body of Content-Type field.
+Parse <var>string</var> as a field-body of Content-Type field, and
+return the result as <dref>mime-content-type</dref> structure.
</defun>
<defun name="mime-read-Content-Type">
<p>
-Read field-body of Content-Type field from current-buffer,
-and return parsed it.
+Parse Content-Type field of the current buffer, and return the result
+as <dref>mime-content-type</dref> structure.
<p>
Return <code>nil</code> if Content-Type field is not found.
</defun>
<node> Content-Type utility
<p>
<defun name="mime-type/subtype-string">
- <args> type <opts> subtype
+ <args> type <opts> subtype
<p>
Return type/subtype string from <var>type</var> and
<var>subtype</var>.
file name.
<rfc number="2183" type="Standards Track"
- author="S. Dorner, K. Moore and R. Troost"
- title="Communicating Presentation Information in
- Internet Messages: The Content-Disposition Header"
- date="August 1997">
+ author="S. Dorner, K. Moore and R. Troost"
+ title="Communicating Presentation Information in Internet
+ Messages: The Content-Disposition Header" date="August
+ 1997">
<p>
FLIM provides parser for Content-Disposition field and structure
<concept>mime-content-disposition</concept> to store information of
<args> string
<p>
Parse <var>string</var> as field-body of Content-Disposition field,
-and return the result.
+and return the result as <dref>mime-content-disposition</dref>
+structure.
</defun>
<defun name="mime-read-Content-Disposition">
<p>
-Read field-body of Content-Disposition field from current-buffer,
+Parse Content-Disposition field of the current buffer, and return the
+result as <dref>mime-content-disposition</dref> structure.
<p>
-Return nil if Content-Disposition field is not found.
+Return <code>nil</code> if Content-Disposition field is not found.
</defun>
<node> Content-Transfer-Encoding parser
<p>
<defun name="mime-parse-Content-Transfer-Encoding">
- <args> string
+ <args> string
<p>
-<var>string</var> \e$B$r\e(B content-transfer-encoding \e$B$H$7$F2r@O$7$?7k2L$rJV$9!#\e(B
+Parse <var>string</var> as a field-body of Content-Transfer-Encoding
+field, and return the result.
</defun>
<defun name="mime-read-Content-Transfer-Encoding">
- <opts>default-encoding
+ <opts>default-encoding
<p>
-\e$B8=:_$N\e(B buffer \e$B$N\e(B Content-Transfer-Encoding \e$BMs$rFI$_<h$j!"2r@O$7$?7k2L$r\e(B
-\e$BJV$9!#\e(B
+Parse Content-Transfer-Encoding field of the current buffer, and
+return the result.
<p>
-Content-Transfer-Encoding \e$BMs$,B8:_$7$J$$>l9g$O\e(B
-<var>default-encoding</var> \e$B$rJV$9!#\e(B
+Return <var>default-encoding</var> if Content-Transfer-Encoding field
+is not found. If it is not specified, <code>nil</code> is used as the
+default value.
</defun>
<defun name="mime-decode-string">
- <args> string encoding
+ <args> string encoding
<p>
-<var>string</var> \e$B$r\e(B <var>encoding</var> \e$B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#\e(B
+Decode <var>string</var> which is encoded in <var>encoding</var>, and
+return the result.
</defun>
<h2> Header encoding/decoding
<node> Header encoder/decoder
<p>
-<defun name="eword-encode-header">
- <opts> code-conversion separator
+<defun name="eword-decode-header">
+ <opts> code-conversion separator
<p>
Decode MIME encoded-words in header fields.
<p>
-If <var>code-conversion</var> is <code>nil</code>, 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.
+If <var>code-conversion</var> is <code>nil</code>, only encoded-words
+are decoded. If <var>code-conversion</var> is a <dref>MIME
+charset</dref>, non-ASCII bit patterns are decoded as the MIME
+charset. Otherwise non-ASCII bit patterns are decoded as the
+<code>default-mime-charset</code>. <cf node="entity formatting">
<p>
-If <var>separator</var> is not nil, it is used as header separator.
+If <var>separator</var> is not <code>nil</code>, it is used as header
+separator.
</defun>
<defun name="eword-encode-header">
- <opts> code-conversion
+ <opts> code-conversion
<p>
Encode header fields to network representation, such as MIME
encoded-word.
<p>
-It refer variable <code>eword-field-encoding-method-alist</code>.
+Each field is encoded as corresponding method specified by variable
+<code>eword-field-encoding-method-alist</code>.
</defun>
+<defvar name="eword-field-encoding-method-alist">
+<p>
+Association list to specify field encoding method. Each element looks
+like (FIELD . METHOD).
+<p>
+If METHOD is <code>mime</code>, the FIELD will be encoded into MIME
+format (encoded-word).
+<p>
+If METHOD is <code>nil</code>, the FIELD will not be encoded.
+<p>
+If METHOD is a MIME charset, the FIELD will be encoded as the charset
+when it must be convert into network-code.
+<p>
+Otherwise the FIELD will be encoded as variable
+<code>default-mime-charset</code> when it must be convert into
+network-code.
+</defvar>
+
<h1> Various Customization
<node> custom
If @var{buffer} is omitted, current buffer is used.@refill
@var{type} is representation-type of created
-mime-entity. (cf. @ref{mm-backend}) Default value is @var{buffer}.
+mime-entity. (cf. @ref{mm-backend})
+ Default value is @var{buffer}.
@end defun
@defvar default-mime-charset
-Symbol to indicate default value of MIME-charset
-(@ref{MIME-charset}).@refill
+Symbol to indicate default value of MIME charset (@ref{MIME charset}).@refill
-It is used when MIME-charset is not specified.@refill
+It is used when MIME charset is not specified.@refill
It is originally variable of APEL.
@end defvar
@defun mime-parse-Content-Type string
-Parse @var{string} as field-body of Content-Type field.
+Parse @var{string} as a field-body of Content-Type field, and return the
+result as mime-content-type (@ref{mime-content-type}) structure.
@end defun
@defun mime-read-Content-Type
-Read field-body of Content-Type field from current-buffer, and return
-parsed it.@refill
+Parse Content-Type field of the current buffer, and return the result as
+mime-content-type (@ref{mime-content-type}) structure.@refill
Return @code{nil} if Content-Type field is not found.
@end defun
@defun mime-parse-Content-Disposition string
Parse @var{string} as field-body of Content-Disposition field, and
-return the result.
+return the result as mime-content-disposition
+(@ref{mime-content-disposition}) structure.
@end defun
@defun mime-read-Content-Disposition
-Read field-body of Content-Disposition field from current-buffer,@refill
+Parse Content-Disposition field of the current buffer, and return the
+result as mime-content-disposition (@ref{mime-content-disposition})
+structure.@refill
-Return nil if Content-Disposition field is not found.
+Return @code{nil} if Content-Disposition field is not found.
@end defun
@defun mime-parse-Content-Transfer-Encoding string
-@var{string} \e$B$r\e(B content-transfer-encoding \e$B$H$7$F2r@O$7$?7k2L$rJV$9!#\e(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
-\e$B8=:_$N\e(B buffer \e$B$N\e(B Content-Transfer-Encoding \e$BMs$rFI$_<h$j!"2r@O$7$?7k2L$r\e(B
-\e$BJV$9!#\e(B@refill
+Parse Content-Transfer-Encoding field of the current buffer, and return
+the result.@refill
-Content-Transfer-Encoding \e$BMs$,B8:_$7$J$$>l9g$O\e(B@var{default-encoding} \e$B$r\e(B
-\e$BJV$9!#\e(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
@defun mime-decode-string string encoding
-@var{string} \e$B$r\e(B @var{encoding} \e$B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#\e(B
+Decode @var{string} which is encoded in @var{encoding}, and return the
+result.
@end defun
@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
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{eword-field-encoding-method-alist}.
@end defun
+@defvar eword-field-encoding-method-alist
+
+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
+
+If METHOD is @code{nil}, the FIELD will not be encoded.@refill
+
+If METHOD is a MIME charset, the FIELD will be encoded as the charset
+when it must be convert into network-code.@refill
+
+Otherwise the FIELD will be encoded as variable
+@code{default-mime-charset} when it must be convert into network-code.
+@end defvar
+
+
@node custom, Appendix, encoded-word, Top
@chapter Various Customization
<defun name="mime-decode-string">
- <args> string encoding
+ <args> string encoding
<p>
-<var>string</var> \e$B$r\e(B <var>encoding</var> \e$B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#\e(B
+<var>string</var> \e$B$r\e(B <var>encoding</var> \e$B$H$7$FI|9f$7$?7k2L$rJV$9!#\e(B
</defun>
<h2> Header \e$B$NId9f2=!&I|9f2=\e(B
<node> Header encoder/decoder
<p>
-<defun name="eword-encode-header">
- <opts> code-conversion separator
+<defun name="eword-decode-header">
+ <opts> code-conversion separator
<p>
-Decode MIME encoded-words in header fields.
+Header \e$BCf$N\e(B encoded-word \e$B$rI|9f$9$k!#\e(B
<p>
-If <var>code-conversion</var> is <code>nil</code>, 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.
+\e$B$b$7\e(B <var>code-conversion</var> \e$B$,\e(B <code>nil</code> \e$B$J$i!"\e(Bencoded-word
+\e$B$@$1$,I|9f$5$l$k!#$b$7!"\e(B<var>code-conversion</var> \e$B$,\e(B <dref>MIME
+charset</dref> \e$B$J$i!"Hs\e(B ASCII bit patterns \e$B$O$=$N\e(B MIME charset \e$B$H$7$F\e(B
+\e$BI|9f$5$l$k!#$3$l0J30$N>l9g!"Hs\e(B ASCII bit patterns \e$B$O\e(B
+<code>default-mime-charset</code>. \e$B$H$7$FI|9f$5$l$k!#\e(B<cf node="entity
+formatting">
<p>
-If <var>separator</var> is not nil, it is used as header separator.
+\e$B$b$7\e(B <var>separator</var> \e$B$,\e(B <code>nil</code> \e$B$G$J$1$l$P!"$=$NCM$,\e(B
+header separator \e$B$H$7$FMQ$$$i$l$k!#\e(B
</defun>
<defun name="eword-encode-header">
- <opts> code-conversion
+ <opts> code-conversion
<p>
-Encode header fields to network representation, such as MIME
-encoded-word.
+Header \e$B$r\e(B network \e$BI=8=$KId9f2=$9$k!#\e(B
<p>
-It refer variable <code>eword-field-encoding-method-alist</code>.
+\e$B3F\e(B field \e$B$O\e(B <code>eword-field-encoding-method-alist</code> \e$B$G;XDj$5$l\e(B
+\e$B$?J}<0$GId9f2=$5$l$k!#\e(B
</defun>
+<defvar name="eword-field-encoding-method-alist">
+<p>
+Association list to specify field encoding method. Each element looks
+like (FIELD . METHOD).
+<p>
+If METHOD is <code>mime</code>, the FIELD will be encoded into MIME
+format (encoded-word).
+<p>
+If METHOD is <code>nil</code>, the FIELD will not be encoded.
+<p>
+If METHOD is a MIME charset, the FIELD will be encoded as the charset
+when it must be convert into network-code.
+<p>
+Otherwise the FIELD will be encoded as variable
+<code>default-mime-charset</code> when it must be convert into
+network-code.
+</defvar>
+
<h1> \e$B0lHL@_Dj\e(B
<node> custom
@defun mime-decode-string string encoding
-@var{string} \e$B$r\e(B @var{encoding} \e$B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#\e(B
+@var{string} \e$B$r\e(B @var{encoding} \e$B$H$7$FI|9f$7$?7k2L$rJV$9!#\e(B
@end defun
@node Header encoder/decoder, , encoded-word, encoded-word
@section Header \e$B$NId9f2=!&I|9f2=\e(B
-@defun eword-encode-header &optional code-conversion separator
+@defun eword-decode-header &optional code-conversion separator
-Decode MIME encoded-words in header fields.@refill
+Header \e$BCf$N\e(B encoded-word \e$B$rI|9f$9$k!#\e(B@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
+\e$B$b$7\e(B @var{code-conversion} \e$B$,\e(B @code{nil} \e$B$J$i!"\e(Bencoded-word \e$B$@$1$,I|9f$5\e(B
+\e$B$l$k!#$b$7!"\e(B@var{code-conversion} \e$B$,\e(B MIME charset (@ref{MIME charset})
+\e$B$J$i!"Hs\e(B ASCII bit patterns \e$B$O$=$N\e(B MIME charset \e$B$H$7$FI|9f$5$l$k!#$3$l0J\e(B
+\e$B30$N>l9g!"Hs\e(B ASCII bit patterns \e$B$O\e(B@code{default-mime-charset}. \e$B$H$7$FI|\e(B
+\e$B9f$5$l$k!#\e(B(cf. @ref{entity formatting}) @refill
-If @var{separator} is not nil, it is used as header separator.
+\e$B$b$7\e(B @var{separator} \e$B$,\e(B @code{nil} \e$B$G$J$1$l$P!"$=$NCM$,\e(Bheader separator
+\e$B$H$7$FMQ$$$i$l$k!#\e(B
@end defun
@defun eword-encode-header &optional code-conversion
-Encode header fields to network representation, such as MIME
-encoded-word.@refill
+Header \e$B$r\e(B network \e$BI=8=$KId9f2=$9$k!#\e(B@refill
-It refer variable @code{eword-field-encoding-method-alist}.
+\e$B3F\e(B field \e$B$O\e(B @code{eword-field-encoding-method-alist} \e$B$G;XDj$5$l$?J}<0$G\e(B
+\e$BId9f2=$5$l$k!#\e(B
@end defun
+@defvar eword-field-encoding-method-alist
+
+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
+
+If METHOD is @code{nil}, the FIELD will not be encoded.@refill
+
+If METHOD is a MIME charset, the FIELD will be encoded as the charset
+when it must be convert into network-code.@refill
+
+Otherwise the FIELD will be encoded as variable
+@code{default-mime-charset} when it must be convert into network-code.
+@end defvar
+
+
@node custom, Appendix, encoded-word, Top
@chapter \e$B0lHL@_Dj\e(B
)
t)))
+(defun mime-insert-header-from-buffer (buffer start end
+ &optional invisible-fields
+ visible-fields)
+ (let ((the-buf (current-buffer))
+ f-b p f-e field-name len field field-body)
+ (save-excursion
+ (set-buffer buffer)
+ (save-restriction
+ (narrow-to-region start end)
+ (goto-char start)
+ (while (re-search-forward std11-field-head-regexp nil t)
+ (setq f-b (match-beginning 0)
+ p (match-end 0)
+ field-name (buffer-substring f-b p)
+ len (string-width field-name)
+ f-e (std11-field-end))
+ (when (mime-visible-field-p field-name
+ visible-fields invisible-fields)
+ (setq field (buffer-substring f-b (1- p))
+ field-body (buffer-substring p f-e))
+ (with-current-buffer the-buf
+ (insert
+ field-name
+ (eword-decode-field-body field-body field nil t)
+ "\n")
+ )))))))
+
(mm-define-method insert-header ((entity generic)
&optional invisible-fields visible-fields)
- (save-restriction
- (narrow-to-region (point)(point))
- (let ((the-buf (current-buffer))
- (src-buf (mime-entity-buffer entity))
- (h-end (mime-entity-header-end-internal entity))
- beg p end field-name len field-body decoded)
- (save-excursion
- (set-buffer src-buf)
- (goto-char (mime-entity-header-start-internal entity))
- (save-restriction
- (narrow-to-region (point) h-end)
- (while (re-search-forward std11-field-head-regexp nil t)
- (setq beg (match-beginning 0)
- p (match-end 0)
- field-name (buffer-substring beg (1- p))
- len (string-width field-name)
- end (std11-field-end))
- (when (mime-visible-field-p field-name
- visible-fields invisible-fields)
- (save-excursion
- (set-buffer the-buf)
- (setq field-body (ew-lf-crlf-to-crlf
- (save-excursion
- (set-buffer src-buf)
- (buffer-substring p end))))
- (setq decoded (ew-decode-field field-name field-body))
- (unless (equal field-body decoded)
- (setq decoded (ew-crlf-refold
- decoded
- (1+ (string-width field-name))
- fill-column)))
- (setq beg (point))
- (insert field-name)
- (insert ":")
- (insert (ew-crlf-to-lf decoded))
- (insert "\n")
- (add-text-properties beg (point)
- (list 'original-field-name field-name
- 'original-field-body field-body))
- ))))))))
+ (mime-insert-header-from-buffer
+ (mime-entity-buffer entity)
+ (mime-entity-header-start-internal entity)
+ (mime-entity-header-end-internal entity)
+ invisible-fields visible-fields)
+ )
(mm-define-method insert-text-content ((entity generic))
(insert