* Sync up to flim-1_11_0 from flim-1_10_5. doodle-1_11_0
authorakr <akr>
Sun, 18 Oct 1998 21:31:08 +0000 (21:31 +0000)
committerakr <akr>
Sun, 18 Oct 1998 21:31:08 +0000 (21:31 +0000)
* mime-def.el (mime-library-product): Bump up to FLAM-DOODLE
1.11.0.

20 files changed:
ChangeLog
DOODLE-VERSION
FLIM-ELS
FLIM-MK
FLIM-VERSION
Makefile
README.en
eword-decode.el
mel-g.el
mime-def.el
mime-en.sgml
mime-en.texi
mime-ja.sgml
mime-ja.texi
mime-parse.el
mime.el
mmbuffer.el
mmcooked.el
mmgeneric.el
std11.el

index ad8faa6..35b2494 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+1998-10-18  Tanaka Akira      <akr@jaist.ac.jp>
+
+       * Sync up to flim-1_11_0 from flim-1_10_5.
+
+       * mime-def.el (mime-library-product): Bump up to FLAM-DOODLE
+       1.11.0.
+
 1998-10-17  Tanaka Akira      <akr@jaist.ac.jp>
 
        * mel-ccl.el: Check broken facility consistency by
        * eword-decode.el: Copied from AKEMI branch of SEMI.
 
 \f
+1998-10-18  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * FLIM: Version 1.11.0 (Yamadagawa) was released.
+
+1998-10-17  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-ja.sgml, mime-en.sgml (entity formatting): Add description
+       about `mime-insert-text-content'.
+
+1998-10-17  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-ja.sgml, mime-en.sgml (entity formatting): New node; move
+       `mime-insert-header' from `Entity-header'; move
+       `default-mime-charset' from `custom'.
+
+1998-10-17  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-en.sgml, mime-ja.sgml (Entity-header): Generic function
+       `mime-insert-decoded-header' was renamed to `mime-insert-header'.
+
+1998-10-17  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * NEWS: New file.
+
+1998-10-16  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime.el (mime-insert-header): Renamed from
+       `mime-insert-decoded-header'; define `mime-insert-decoded-header'
+       as an obsolete alias.
+
+       * mmgeneric.el, mmcooked.el (insert-header): Renamed from
+       `insert-decoded-header'.
+
+       * README.en (Installation): Add required version of APEL.
+
+1998-10-16  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mel-g.el: Require mel.
+
+       * mel-g.el: Require poem instead of emu.
+
+1998-10-16  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime.el (mime-insert-text-content): New generic function.
+
+       * mmcooked.el, mmgeneric.el (insert-text-content): New method.
+
+1998-10-02  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * std11.el (std11-unfold-string): New implementation.
+
+1998-10-02  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mmgeneric.el: New module.
+
+       * mmbuffer.el: Use `generic' as mother backend.
+
+       * FLIM-ELS (flim-modules): Add mmgeneric.
+
+1998-10-01  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-parse.el (mime-parse-message): Modify for
+       `make-mime-entity-internal'.
+
+       * mime-def.el (make-mime-entity-internal): Change interface to be
+       able to specify original-header and parsed-header.
+
+1998-09-30  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * eword-decode.el (eword-decode-and-unfold-unstructured-field):
+       New function.
+
+1998-09-30  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime.el (mime-entity-content-type): New implementation.
+       (mime-entity-content-disposition): New implementation.
+       (mime-entity-encoding): New implementation.
+
+       * mime.el (mime-fetch-field): Refer internal slots for Date,
+       Message-Id and References fields.
+
+       * mime-parse.el (mime-parse-message): Modify for
+       `make-mime-entity-internal'.
+
+       * mime-def.el: Change `mime-entity-*-internal' and
+       `mime-entity-set-*-internal' to macro.
+       (make-mime-entity-internal): Change interface and data format for
+       NOV data; changed to macro.
+       (mime-entity-set-location-internal): New macro.
+       (mime-entity-decoded-subject-internal): New macro.
+       (mime-entity-set-decoded-subject-internal): New macro.
+       (mime-entity-decoded-from-internal): New macro.
+       (mime-entity-set-decoded-from-internal): New macro.
+       (mime-entity-date-internal): New macro.
+       (mime-entity-set-date-internal): New macro.
+       (mime-entity-message-id-internal): New macro.
+       (mime-entity-set-message-id-internal): New macro.
+       (mime-entity-references-internal): New macro.
+       (mime-entity-set-references-internal): New macro.
+       (mime-entity-chars-internal): New macro.
+       (mime-entity-set-chars-internal): New macro.
+       (mime-entity-lines-internal): New macro.
+       (mime-entity-set-lines-internal): New macro.
+       (mime-entity-xref-internal): New macro.
+       (mime-entity-set-xref-internal): New macro.
+       (mime-entity-original-header-internal): Modify for new structure;
+       changed to macro.
+       (mime-entity-set-original-header-internal): Likewise.
+       (mime-entity-parsed-header-internal): Likewise.
+       (mime-entity-set-parsed-header-internal): Likewise.
+       (mime-entity-buffer-internal): Likewise.
+       (mime-entity-set-buffer-internal): Likewise.
+       (mime-entity-header-start-internal): Likewise.
+       (mime-entity-set-header-start-internal): Likewise.
+       (mime-entity-header-end-internal): Likewise.
+       (mime-entity-set-header-end-internal): Likewise.
+       (mime-entity-body-start-internal): Likewise.
+       (mime-entity-set-body-start-internal): Likewise.
+       (mime-entity-body-end-internal): Likewise.
+       (mime-entity-set-body-end-internal): Likewise.
+
+\f
 1998-10-14  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
 
        * FLIM: Version 1.10.5 (Kizugawadai) was released.
index 2045ad2..c23bbc2 100644 (file)
@@ -22,7 +22,7 @@ Order is not significant.
   16 \e$B4;;R\e(B        \e$B$3$&$8\e(B                    7.5YR7.0/11.0   FLAM-DOODLE 1.10.0
   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
+  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
   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
index bdf113d..0f5a6ed 100644 (file)
--- a/FLIM-ELS
+++ b/FLIM-ELS
@@ -27,7 +27,7 @@
                      ew-dec
                     eword-decode eword-encode
                      ew-compat
-                    mime mime-parse mmbuffer mmcooked
+                    mime mime-parse mmgeneric mmbuffer mmcooked
                     mailcap
                      ))
 
diff --git a/FLIM-MK b/FLIM-MK
index 8c7dc25..e381f48 100644 (file)
--- a/FLIM-MK
+++ b/FLIM-MK
@@ -1,7 +1,8 @@
 ;;; -*-Emacs-Lisp-*-
-;;;
-;;; $Id: FLIM-MK,v 1.1.16.2 1998-10-14 12:40:10 akr Exp $
-;;;
+
+;; FLIM-MK: installer for FLIM.
+
+;;; Code:
 
 (defun config-flim ()
   (let (prefix lisp-dir version-specific-lisp-dir)
index 9f82250..2eba772 100644 (file)
@@ -28,7 +28,7 @@
 1.10.3 Komada                  \e$(B9}ED\e(B
 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
------  Yamadagawa              \e$(B;3ED@n\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
 -----  Saidaiji                \e$(B@>Bg;{\e(B
 1.7.0  Goj\e-Dò\e-A                      \e$(B8^>r\e(B
 1.8.0  Shij\e-Dò\e-A                     \e$(B;M>r\e(B             ; <=> \e$(B:e5^\e(B \e$(B5~ET@~\e(B
 1.9.0  Karasuma Oike           \e$(B1(4]8fCS\e(B ; = \e$(B5~ET;T8rDL6I\e(B \e$(BEl@>@~\e(B
------  Marutamach              \e$(B4]B@D.\e(B
+1.10.0 Marutamach              \e$(B4]B@D.\e(B
+1.11.0 Imadegawa               \e$(B:#=P@n\e(B
+1.11.1 Kuramaguchi             \e$(B0HGO8}\e(B
+1.11.2 Kita\e-Dòji\e-A                   \e$(BKLBgO)\e(B
+1.11.3 Kitayama                \e$(BKL;3\e(B
+1.11.4 Matugasaki              \e$(B>>%v:j\e(B
+1.11.5 Kokusaikaikan           \e$(B9q:]2q4[\e(B
index 6cc57d9..c1fd0e4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 #
 
 PACKAGE = flim
-VERSION = 1.10.5
+VERSION = 1.11.0
 
 TAR    = tar
 RM     = /bin/rm -f
index 4dce259..004fbe3 100644 (file)
--- a/README.en
+++ b/README.en
@@ -36,8 +36,8 @@ What's FLIM
 Installation
 ============
 
-(0) before installing it, please install APEL package.  APEL package
-    is available at:
+(0) before installing it, please install APEL (9.4 or later) package.
+    APEL package is available at:
 
        ftp://ftp.jaist.ac.jp/pub/GNU/elisp/apel/
 
index 42beb16..f176a48 100644 (file)
@@ -407,6 +407,19 @@ such as a version of Net$cape)."
   (let ((decoded (ew-decode-field "" (ew-lf-crlf-to-crlf string))))
     (ew-crlf-to-lf (ew-crlf-unfold decoded))))
 
+(defun eword-decode-and-unfold-unstructured-field (string)
+  "Decode and unfold STRING as unstructured field body.
+It decodes non us-ascii characters in FULL-NAME encoded as
+encoded-words or invalid \"raw\" string.  \"Raw\" non us-ascii
+characters are regarded as variable `default-mime-charset'.
+
+If an encoded-word is broken or your emacs implementation can not
+decode the charset included in it, it is not decoded."
+  (rotate-memo args-eword-decode-and-unfold-unstructured-field
+              (list string))
+  (let ((decoded (ew-decode-field "" (ew-lf-crlf-to-crlf string))))
+    (ew-crlf-to-lf (ew-crlf-unfold decoded))))
+
 
 ;;; @ for region
 ;;;
@@ -690,8 +703,7 @@ be the result."
                   (cdr decoded)))))))
 
 (defun eword-analyze-atom (string &optional must-unfold)
-  (if (let ((enable-multibyte-characters nil))
-        (string-match std11-atom-regexp string))
+  (if (string-match std11-atom-regexp (string-as-unibyte string))
       (let ((end (match-end 0)))
        (if (and eword-decode-sticked-encoded-word
                 (string-match eword-encoded-word-in-phrase-regexp
index bc2c510..8be016c 100644 (file)
--- a/mel-g.el
+++ b/mel-g.el
@@ -33,8 +33,9 @@
 
 ;;; Code:
 
-(require 'emu)
+(require 'poem)
 (require 'path-util)
+(require 'mel)
 
 
 ;;; @ variables
index 2444b42..a952121 100644 (file)
@@ -25,7 +25,7 @@
 ;;; Code:
 
 (eval-and-compile
-  (defconst mime-library-product ["FLAM-DOODLE" (1 10 2) "\e$B@VGrFK\e(B 5.0YR8.0/6.0"]
+  (defconst mime-library-product ["FLAM-DOODLE" (1 11 0) "\e$B>.F&\e(B 2.5R3.5/5.0"]
     "Product name, version number and code name of MIME-library package.")
   )
 
 ;;; @ MIME entity
 ;;;
 
-(defsubst make-mime-entity-internal (representation-type location
+(defmacro make-mime-entity-internal (representation-type location
                                     &optional content-type
                                     children parent node-id
+                                    ;; for NOV
+                                    decoded-subject decoded-from
+                                    date message-id references
+                                    chars lines
+                                    xref
+                                    ;; for other fields
+                                    original-header parsed-header
+                                    ;; for buffer representation
                                     buffer
                                     header-start header-end
                                     body-start body-end)
-  (vector representation-type location
-         content-type nil nil children parent node-id
-         buffer header-start header-end body-start body-end
-         nil nil))
-
-(defsubst mime-entity-representation-type-internal (entity)
-  (aref entity 0))
-(defsubst mime-entity-set-representation-type-internal (entity type)
-  (aset entity 0 type))
-(defsubst mime-entity-location-internal (entity)
-  (aref entity 1))
-
-(defsubst mime-entity-content-type-internal (entity)
-  (aref entity 2))
-(defsubst mime-entity-set-content-type-internal (entity type)
-  (aset entity 2 type))
-(defsubst mime-entity-content-disposition-internal (entity)
-  (aref entity 3))
-(defsubst mime-entity-set-content-disposition-internal (entity disposition)
-  (aset entity 3 disposition))
-(defsubst mime-entity-encoding-internal (entity)
-  (aref entity 4))
-(defsubst mime-entity-set-encoding-internal (entity encoding)
-  (aset entity 4 encoding))
-
-(defsubst mime-entity-children-internal (entity)
-  (aref entity 5))
-(defsubst mime-entity-set-children-internal (entity children)
-  (aset entity 5 children))
-(defsubst mime-entity-parent-internal (entity)
-  (aref entity 6))
-(defsubst mime-entity-node-id-internal (entity)
-  (aref entity 7))
-
-(defsubst mime-entity-buffer-internal (entity)
-  (aref entity 8))
-(defsubst mime-entity-set-buffer-internal (entity buffer)
-  (aset entity 8 buffer))
-(defsubst mime-entity-header-start-internal (entity)
-  (aref entity 9))
-(defsubst mime-entity-set-header-start-internal (entity point)
-  (aset entity 9 point))
-(defsubst mime-entity-header-end-internal (entity)
-  (aref entity 10))
-(defsubst mime-entity-set-header-end-internal (entity point)
-  (aset entity 10 point))
-(defsubst mime-entity-body-start-internal (entity)
-  (aref entity 11))
-(defsubst mime-entity-set-body-start-internal (entity point)
-  (aset entity 11 point))
-(defsubst mime-entity-body-end-internal (entity)
-  (aref entity 12))
-(defsubst mime-entity-set-body-end-internal (entity point)
-  (aset entity 12 point))
-
-(defsubst mime-entity-original-header-internal (entity)
-  (aref entity 13))
-(defsubst mime-entity-set-original-header-internal (entity header)
-  (aset entity 13 header))
-(defsubst mime-entity-parsed-header-internal (entity)
-  (aref entity 14))
-(defsubst mime-entity-set-parsed-header-internal (entity header)
-  (aset entity 14 header))
+  `(vector ,representation-type ,location
+          ,content-type nil nil ,children ,parent ,node-id
+          ;; for NOV
+          ,decoded-subject ,decoded-from
+          ,date ,message-id ,references
+          ,chars ,lines
+          ,xref
+          ;; for other fields
+          ,original-header ,parsed-header
+          ;; for buffer representation
+          ,buffer ,header-start ,header-end ,body-start ,body-end))
+
+(defmacro mime-entity-representation-type-internal (entity)
+  `(aref ,entity 0))
+(defmacro mime-entity-set-representation-type-internal (entity type)
+  `(aset ,entity 0 ,type))
+(defmacro mime-entity-location-internal (entity)
+  `(aref ,entity 1))
+(defmacro mime-entity-set-location-internal (entity location)
+  `(aset ,entity 1 ,location))
+
+(defmacro mime-entity-content-type-internal (entity)
+  `(aref ,entity 2))
+(defmacro mime-entity-set-content-type-internal (entity type)
+  `(aset ,entity 2 ,type))
+(defmacro mime-entity-content-disposition-internal (entity)
+  `(aref ,entity 3))
+(defmacro mime-entity-set-content-disposition-internal (entity disposition)
+  `(aset ,entity 3 ,disposition))
+(defmacro mime-entity-encoding-internal (entity)
+  `(aref ,entity 4))
+(defmacro mime-entity-set-encoding-internal (entity encoding)
+  `(aset ,entity 4 ,encoding))
+
+(defmacro mime-entity-children-internal (entity)
+  `(aref ,entity 5))
+(defmacro mime-entity-set-children-internal (entity children)
+  `(aset ,entity 5 ,children))
+(defmacro mime-entity-parent-internal (entity)
+  `(aref ,entity 6))
+(defmacro mime-entity-node-id-internal (entity)
+  `(aref ,entity 7))
+
+(defmacro mime-entity-decoded-subject-internal (entity)
+  `(aref ,entity 8))
+(defmacro mime-entity-set-decoded-subject-internal (entity subject)
+  `(aset ,entity 8 ,subject))
+(defmacro mime-entity-decoded-from-internal (entity)
+  `(aref ,entity 9))
+(defmacro mime-entity-set-decoded-from-internal (entity from)
+  `(aset ,entity 9 ,from))
+(defmacro mime-entity-date-internal (entity)
+  `(aref ,entity 10))
+(defmacro mime-entity-set-date-internal (entity date)
+  `(aset ,entity 10 ,date))
+(defmacro mime-entity-message-id-internal (entity)
+  `(aref ,entity 11))
+(defmacro mime-entity-set-message-id-internal (entity message-id)
+  `(aset ,entity 11 ,message-id))
+(defmacro mime-entity-references-internal (entity)
+  `(aref ,entity 12))
+(defmacro mime-entity-set-references-internal (entity references)
+  `(aset ,entity 12 ,references))
+(defmacro mime-entity-chars-internal (entity)
+  `(aref ,entity 13))
+(defmacro mime-entity-set-chars-internal (entity chars)
+  `(aset ,entity 13 ,chars))
+(defmacro mime-entity-lines-internal (entity)
+  `(aref ,entity 14))
+(defmacro mime-entity-set-lines-internal (entity lines)
+  `(aset ,entity 14 ,lines))
+(defmacro mime-entity-xref-internal (entity)
+  `(aref ,entity 15))
+(defmacro mime-entity-set-xref-internal (entity xref)
+  `(aset ,entity 15 ,xref))
+
+(defmacro mime-entity-original-header-internal (entity)
+  `(aref ,entity 16))
+(defmacro mime-entity-set-original-header-internal (entity header)
+  `(aset ,entity 16 ,header))
+(defmacro mime-entity-parsed-header-internal (entity)
+  `(aref ,entity 17))
+(defmacro mime-entity-set-parsed-header-internal (entity header)
+  `(aset ,entity 17 ,header))
+
+(defmacro mime-entity-buffer-internal (entity)
+  `(aref ,entity 18))
+(defmacro mime-entity-set-buffer-internal (entity buffer)
+  `(aset ,entity 18 ,buffer))
+(defmacro mime-entity-header-start-internal (entity)
+  `(aref ,entity 19))
+(defmacro mime-entity-set-header-start-internal (entity point)
+  `(aset ,entity 19 ,point))
+(defmacro mime-entity-header-end-internal (entity)
+  `(aref ,entity 20))
+(defmacro mime-entity-set-header-end-internal (entity point)
+  `(aset ,entity 20 ,point))
+(defmacro mime-entity-body-start-internal (entity)
+  `(aref ,entity 21))
+(defmacro mime-entity-set-body-start-internal (entity point)
+  `(aset ,entity 21 ,point))
+(defmacro mime-entity-body-end-internal (entity)
+  `(aref ,entity 22))
+(defmacro mime-entity-set-body-end-internal (entity point)
+  `(aset ,entity 22 ,point))
 
 
 ;;; @ message structure
index 1aeb63c..2523585 100644 (file)
@@ -264,7 +264,11 @@ If <var>field-name</var> field is not found, this function returns
 <code>nil</code>.
 </defun>
 
-<defun name="mime-insert-decoded-header">
+
+<h2> Text presentation of entity
+<node> entity formatting
+<p>
+<defun name="mime-insert-header">
            <args> entity <opts> invisible-fields visible-fields
 <p>
 Insert before point a decoded contents of header of <var>entity</var>.
@@ -276,8 +280,32 @@ field-name to hide.
 If a field-name is matched with some elements of
 <var>invisible-fields</var> and matched with none of
 <var>visible-fields</var>, this function don't insert the field.
+<p>
+Each <dref>encoded-word</dref> in the header is decoded.  ``Raw non
+us-ascii characters'' are also decoded as
+<code>default-mime-charset</code>.
 </defun>
 
+<defun name="mime-insert-text-content">
+           <args> entity
+<p>
+Insert before point a contents of <var>entity</var> as text entity.
+<p>
+Contents of the <var>entity</var> are decoded as <dref>MIME
+charset</dref>.  If the <var>entity</var> does not have charset
+parameter of Content-Type field, <code>default-mime-charset</code> is
+used as default value.
+</defun>
+
+<defvar name="default-mime-charset">
+<p>
+Symbol to indicate default value of <dref>MIME-charset</dref>.
+<p>
+It is used when MIME-charset is not specified.
+<p>
+It is originally variable of APEL.
+</defvar>
+
 
 <h2> Contents of Entity
 <node> Entity-content
@@ -857,14 +885,6 @@ MIME \e$B4XO"5!G=$K4X$9$k\e(B group.
 <code>mail</code> \e$B$H\e(B <code>news</code> \e$B$KB0$9$k!#\e(B
 </define>
 
-<defvar name="default-mime-charset">
-<p>
-\e$BE,@Z$J\e(B <dref>MIME charset</dref> \e$B$,8+$D$+$i$J$+$C$?>l9g$KMQ$$$i$l$k\e(B
-MIME charset.
-<p>
-\e$BK\Mh$O\e(B APEL \e$B$NJQ?t$G$"$k!#\e(B
-</defvar>
-
 <defvar name="mime-temp-directory">
 <p>
 MIME \e$B5!G=$K4X$9$k<BAu$,0l;~E*$K;HMQ$9$k\e(B file \e$B$r:n@.$9$k\e(B directory.
index 1f28037..e53af52 100644 (file)
@@ -1,4 +1,5 @@
 \input texinfo.tex
+@c Generated automatically from mime-en.sgml by sinfo 3.7.
 @setfilename mime-en.info
 @settitle{FLIM 1.10 Manual about MIME Features}
 @titlepage
@@ -73,6 +74,7 @@ information of entity.  In this document, it is called simply
 * Entity hierarchy::            Features about message tree
 * 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 buffer::               Entity as buffer representation
 * mm-backend::                  Entity representations and implementations
@@ -255,7 +257,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
@@ -293,7 +295,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
 
@@ -303,12 +309,37 @@ 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
+
+Symbol to indicate default value of MIME-charset
+(@ref{MIME-charset}).@refill
+
+It is used when MIME-charset is not specified.@refill
 
-@node Entity-content, Entity buffer, Entity-header, Entity
+It is originally variable of APEL.
+@end defvar
+
+
+
+@node Entity-content, Entity buffer, entity formatting, Entity
 @section Contents of Entity
 
 @defun mime-entity-content entity
@@ -951,15 +982,6 @@ MIME \e$B4XO"5!G=$K4X$9$k\e(B group.@refill
 @end deffn
 
 
-@defvar default-mime-charset
-
-\e$BE,@Z$J\e(B MIME charset (@ref{MIME charset}) \e$B$,8+$D$+$i$J$+$C$?>l9g$KMQ$$$i\e(B
-\e$B$l$k\e(BMIME charset.@refill
-
-\e$BK\Mh$O\e(B APEL \e$B$NJQ?t$G$"$k!#\e(B
-@end defvar
-
-
 @defvar mime-temp-directory
 
 MIME \e$B5!G=$K4X$9$k<BAu$,0l;~E*$K;HMQ$9$k\e(B file \e$B$r:n@.$9$k\e(B 
index 50d67d3..7afcd96 100644 (file)
@@ -263,7 +263,11 @@ code-converted.
 <var>field-name</var> \e$BMs$,B8:_$7$J$$>l9g$O\e(B nil \e$B$rJV$9!#\e(B
 </defun>
 
-<defun name="mime-insert-decoded-header">
+
+<h2> Entity \e$B$NJ8;zI=8=\e(B
+<node> entity formatting
+<p>
+<defun name="mime-insert-header">
            <args> entity <opts> invisible-fields visible-fields
 <p>
 \e$B8=:_0LCV$K\e(B <var>entity</var> \e$B$NI|9f$7$?\e(B header \e$B$rA^F~$9$k!#\e(B
@@ -273,9 +277,32 @@ list \e$B$G!"$=$l$>$l!"I=<($7$?$/$J$$\e(B field \e$BL>$HI=<($7$?$$MsL>$rI=8=$7$?$b$
 \e$B$G$"$k!#\e(B
 <p>
 <var>invisible-fields</var> \e$B$NMWAG$N$I$l$+$K\e(B match \e$B$7!"$+$D!"\e(B
-<var>visible-fields</var> \e$B$NMWAG$N$I$l$K$b\e(B match \e$B$7$J$$Ms$OI=<($5$l$J$$!#\e(B
+<var>visible-fields</var> \e$B$NMWAG$N$I$l$K$b\e(B match \e$B$7$J$$Ms$OI=<($5$l$J\e(B
+\e$B$$!#\e(B
+<p>
+<dref>encoded-word</dref> \e$B$OI|9f$5$l$k!#!X@8$NHs\e(B us-ascii \e$BJ8;z!Y$O\e(B 
+<code>default-mime-charset</code> \e$B$H$7$F2r<a$5$l$k!#\e(B
+</defun>
+
+<defun name="mime-insert-text-content">
+           <args> entity
+<p>
+Insert before point a contents of <var>entity</var> as text entity.
+<p>
+Contents of the <var>entity</var> are decoded as <dref>MIME
+charset</dref>.  If the <var>entity</var> does not have charset
+parameter of Content-Type field, <code>default-mime-charset</code> is
+used as default value.
 </defun>
 
+<defvar name="default-mime-charset">
+<p>
+\e$BE,@Z$J\e(B <dref>MIME charset</dref> \e$B$,8+$D$+$i$J$+$C$?>l9g$KMQ$$$i$l$k\e(B
+MIME charset.
+<p>
+\e$BK\Mh$O\e(B APEL \e$B$NJQ?t$G$"$k!#\e(B
+</defvar>
+
 
 <h2> Entity \e$B$NFbMF\e(B
 <node> Entity-content
@@ -853,14 +880,6 @@ MIME \e$B4XO"5!G=$K4X$9$k\e(B group.
 <code>mail</code> \e$B$H\e(B <code>news</code> \e$B$KB0$9$k!#\e(B
 </define>
 
-<defvar name="default-mime-charset">
-<p>
-\e$BE,@Z$J\e(B <dref>MIME charset</dref> \e$B$,8+$D$+$i$J$+$C$?>l9g$KMQ$$$i$l$k\e(B
-MIME charset.
-<p>
-\e$BK\Mh$O\e(B APEL \e$B$NJQ?t$G$"$k!#\e(B
-</defvar>
-
 <defvar name="mime-temp-directory">
 <p>
 MIME \e$B5!G=$K4X$9$k<BAu$,0l;~E*$K;HMQ$9$k\e(B file \e$B$r:n@.$9$k\e(B directory.
index 4c77393..f5cf4fc 100644 (file)
@@ -1,4 +1,5 @@
 \input texinfo.tex
+@c Generated automatically from mime-ja.sgml by sinfo 3.7.
 @setfilename mime-ja.info
 @settitle{FLIM 1.10 MIME \e$B5!G=@bL@=q\e(B}
 @titlepage
@@ -76,6 +77,7 @@ FLIM \e$B$O\e(B entity \e$B$N>pJs$rI=8=$9$k$?$a$K\e(B@strong{mime-entity} \e$B9=\e(B
 * Entity hierarchy::            Entity \e$B3,AX\e(B
 * Entity Attributes::           Entity \e$B$NB0@-\e(B
 * Entity-header::               Entity header \e$B$N>pJs\e(B
+* entity formatting::           Entity \e$B$NJ8;zI=8=\e(B
 * Entity-content::              Entity \e$B$NFbMF\e(B
 * Entity buffer::               Entity \e$B$N\e(B buffer \e$B$K$h$kI=8=\e(B
 * mm-backend::                  Entity \e$B$NI=8=$H<B8=\e(B
@@ -259,7 +261,7 @@ code-converted.
 
 
 
-@node Entity-header, Entity-content, Entity Attributes, Entity
+@node Entity-header, entity formatting, Entity Attributes, Entity
 @section Entity header \e$B$N>pJs\e(B
 
 @defun mime-fetch-field field-name  &optional  entity
@@ -292,7 +294,11 @@ code-converted.
 @end defun
 
 
-@defun mime-insert-decoded-header entity  &optional  invisible-fields visible-fields
+
+@node entity formatting, Entity-content, Entity-header, Entity
+@section Entity \e$B$NJ8;zI=8=\e(B
+
+@defun mime-insert-header entity  &optional  invisible-fields visible-fields
 
 \e$B8=:_0LCV$K\e(B @var{entity} \e$B$NI|9f$7$?\e(B header \e$B$rA^F~$9$k!#\e(B@refill
 
@@ -302,11 +308,34 @@ code-converted.
 
 @var{invisible-fields} \e$B$NMWAG$N$I$l$+$K\e(B match \e$B$7!"$+$D!"\e(B
 @var{visible-fields} \e$B$NMWAG$N$I$l$K$b\e(B match \e$B$7$J$$Ms$OI=<($5$l$J$$!#\e(B
+@refill
+
+encoded-word (@ref{encoded-word}) \e$B$OI|9f$5$l$k!#!X@8$NHs\e(B us-ascii \e$BJ8;z!Y\e(B
+\e$B$O\e(B @code{default-mime-charset} \e$B$H$7$F2r<a$5$l$k!#\e(B
+@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
+\e$BE,@Z$J\e(B MIME charset (@ref{MIME charset}) \e$B$,8+$D$+$i$J$+$C$?>l9g$KMQ$$$i\e(B
+\e$B$l$k\e(BMIME charset.@refill
+
+\e$BK\Mh$O\e(B APEL \e$B$NJQ?t$G$"$k!#\e(B
+@end defvar
+
+
+
+@node Entity-content, Entity buffer, entity formatting, Entity
 @section Entity \e$B$NFbMF\e(B
 
 @defun mime-entity-content entity
@@ -949,15 +978,6 @@ MIME \e$B4XO"5!G=$K4X$9$k\e(B group.@refill
 @end deffn
 
 
-@defvar default-mime-charset
-
-\e$BE,@Z$J\e(B MIME charset (@ref{MIME charset}) \e$B$,8+$D$+$i$J$+$C$?>l9g$KMQ$$$i\e(B
-\e$B$l$k\e(BMIME charset.@refill
-
-\e$BK\Mh$O\e(B APEL \e$B$NJQ?t$G$"$k!#\e(B
-@end defvar
-
-
 @defvar mime-temp-directory
 
 MIME \e$B5!G=$K4X$9$k<BAu$,0l;~E*$K;HMQ$9$k\e(B file \e$B$r:n@.$9$k\e(B 
index fa20a85..8951509 100644 (file)
@@ -242,6 +242,9 @@ If is is not found, return DEFAULT-ENCODING."
     (make-mime-entity-internal representation-type
                               (current-buffer)
                               content-type nil parent node-id
+                              nil nil nil nil
+                              nil nil nil nil
+                              nil nil
                               (current-buffer)
                               header-start header-end
                               body-start body-end)
diff --git a/mime.el b/mime.el
index 908923f..8892814 100644 (file)
--- a/mime.el
+++ b/mime.el
@@ -190,39 +190,59 @@ If MESSAGE is specified, it is regarded as root entity."
       (setq field-name (intern (capitalize (capitalize field-name)))))
   (or entity
       (setq entity mime-message-structure))
-  (let* ((header (mime-entity-original-header-internal entity))
-        (field-body (cdr (assq field-name header))))
-    (or field-body
-       (progn
-         (if (setq field-body
-                   (mime-entity-send entity 'fetch-field
-                                     (symbol-name field-name)))
-             (mime-entity-set-original-header-internal
-              entity (put-alist field-name field-body header))
-           )
-         field-body))))
-
-(defalias 'mime-entity-content-type 'mime-entity-content-type-internal)
+  (cond ((eq field-name 'Date)
+        (or (mime-entity-date-internal entity)
+            (mime-entity-set-date-internal
+             entity (mime-entity-send entity 'fetch-field "Date"))
+            ))
+       ((eq field-name 'Message-Id)
+        (or (mime-entity-message-id-internal entity)
+            (mime-entity-set-message-id-internal
+             entity (mime-entity-send entity 'fetch-field "Message-Id"))
+            ))
+       ((eq field-name 'References)
+        (or (mime-entity-references-internal entity)
+            (mime-entity-set-references-internal
+             entity (mime-entity-send entity 'fetch-field "References"))
+            ))
+       (t
+        (let* ((header (mime-entity-original-header-internal entity))
+               (field-body (cdr (assq field-name header))))
+          (or field-body
+              (progn
+                (if (setq field-body
+                          (mime-entity-send entity 'fetch-field
+                                            (symbol-name field-name)))
+                    (mime-entity-set-original-header-internal
+                     entity (put-alist field-name field-body header))
+                  )
+                field-body))
+          ))))
+
+(defun mime-entity-content-type (entity)
+  (or (mime-entity-content-type-internal entity)
+      (let ((ret (mime-fetch-field 'Content-Type entity)))
+       (if ret
+           (mime-entity-set-content-type-internal
+            entity (mime-parse-Content-Type ret))
+         ))))
 
 (defun mime-entity-content-disposition (entity)
   (or (mime-entity-content-disposition-internal entity)
       (let ((ret (mime-fetch-field 'Content-Disposition entity)))
        (if ret
-           (let ((disposition (mime-parse-Content-Disposition ret)))
-             (when disposition
-               (mime-entity-set-content-disposition-internal
-                entity disposition)
-               disposition))))))
+           (mime-entity-set-content-disposition-internal
+            entity (mime-parse-Content-Disposition ret))
+         ))))
 
 (defun mime-entity-encoding (entity &optional default-encoding)
   (or (mime-entity-encoding-internal entity)
-      (let ((encoding
-            (or (let ((ret (mime-fetch-field
-                            'Content-Transfer-Encoding entity)))
-                  (and ret (mime-parse-Content-Transfer-Encoding ret)))
-                default-encoding "7bit")))
-       (mime-entity-set-encoding-internal entity encoding)
-       encoding)))
+      (let ((ret (mime-fetch-field 'Content-Transfer-Encoding entity)))
+       (mime-entity-set-encoding-internal
+        entity
+        (or (and ret (mime-parse-Content-Transfer-Encoding ret))
+            default-encoding "7bit"))
+       )))
 
 (defun mime-read-field (field-name &optional entity)
   (or (symbolp field-name)
@@ -269,10 +289,13 @@ If MESSAGE is specified, it is regarded as root entity."
                    entity (put-alist field-name field header))
                   field)))))))
 
-(mm-define-generic insert-decoded-header (entity &optional invisible-fields
-                                         visible-fields)
+(mm-define-generic insert-header (entity &optional invisible-fields
+                                        visible-fields)
   "Insert before point a decoded header of ENTITY.")
 
+(define-obsolete-function-alias
+  'mime-insert-decoded-header 'mime-insert-header)
+
 
 ;;; @ Entity Attributes
 ;;;
@@ -317,6 +340,9 @@ If MESSAGE is specified, it is regarded as root entity."
 (mm-define-generic entity-content (entity)
   "Return content of ENTITY as byte sequence (string).")
 
+(mm-define-generic insert-text-content (entity)
+  "Insert decoded text body of ENTITY.")
+
 (mm-define-generic write-entity-content (entity filename)
   "Write content of ENTITY into FILENAME.")
 
index f16f0d1..93b2ff3 100644 (file)
 
 ;;; Code:
 
-(require 'mime)
-(require 'mime-parse)
+(require 'mmgeneric)
 
-(mm-define-backend buffer)
+(mm-define-backend buffer (generic))
 
 (mm-define-method initialize-instance ((entity buffer))
   (mime-entity-set-buffer-internal
@@ -62,6 +61,8 @@
       (mime-entity-set-body-end-internal entity body-end)
       )))
 
+;;; redefine to speed up
+
 (mm-define-method entity-point-min ((entity buffer))
   (mime-entity-header-start-internal entity))
 
       (std11-fetch-field field-name)
       )))
 
-(mm-define-method entity-cooked-p ((entity buffer)) nil)
-
-(mm-define-method entity-children ((entity buffer))
-  (let* ((content-type (mime-entity-content-type entity))
-        (primary-type (mime-content-type-primary-type content-type)))
-    (cond ((eq primary-type 'multipart)
-          (mime-parse-multipart entity)
-          )
-         ((and (eq primary-type 'message)
-               (memq (mime-content-type-subtype content-type)
-                     '(rfc822 news external-body)
-                     ))
-          (mime-parse-encapsulated entity)
-          ))
-    ))
-
 (mm-define-method entity-content ((entity buffer))
   (save-excursion
     (set-buffer (mime-entity-buffer-internal entity))
                            filename)
     ))
 
-(defun mime-visible-field-p (field-name visible-fields invisible-fields)
-  (or (catch 'found
-       (while visible-fields
-         (let ((regexp (car visible-fields)))
-           (if (string-match regexp field-name)
-               (throw 'found t)
-             ))
-         (setq visible-fields (cdr visible-fields))
-         ))
-      (catch 'found
-       (while invisible-fields
-         (let ((regexp (car invisible-fields)))
-           (if (string-match regexp field-name)
-               (throw 'found nil)
-             ))
-         (setq invisible-fields (cdr invisible-fields))
-         )
-       t)))
-
-(mm-define-method insert-decoded-header ((entity buffer)
-                                        &optional invisible-fields
-                                        visible-fields)
-  (save-restriction
-    (narrow-to-region (point)(point))
-    (let ((the-buf (current-buffer))
-         (src-buf (mime-entity-buffer-internal 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))
-               ))))))))
-
 
 ;;; @ end
 ;;;
index cd261f4..6995469 100644 (file)
                  filename)
     ))
 
-(mm-define-method insert-decoded-header ((entity cooked)
-                                        &optional invisible-fields
-                                        visible-fields)
+(mm-define-method insert-header ((entity cooked)
+                                &optional invisible-fields visible-fields)
   (let (default-mime-charset)
     (funcall (mime-find-function 'insert-decoded-header 'buffer)
             entity invisible-fields visible-fields)
     ))
 
+(mm-define-method insert-text-content ((entity cooked))
+  (let ((str (mime-entity-content entity)))
+    (insert
+     (if (member (mime-entity-encoding entity)
+                '(nil "7bit" "8bit" "binary"))
+        str
+       (decode-mime-charset-string str
+                                  (or (mime-content-type-parameter
+                                       (mime-entity-content-type entity)
+                                       "charset")
+                                      default-mime-charset)
+                                  'CRLF)
+       ))))
+
 
 ;;; @ end
 ;;;
index 634c80a..447b3af 100644 (file)
     (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)
+         beg p end field-name len field-body decoded)
       (save-excursion
        (set-buffer src-buf)
        (goto-char (mime-entity-header-start-internal entity))
                  end (std11-field-end))
            (when (mime-visible-field-p field-name
                                        visible-fields invisible-fields)
-             (setq field (intern (capitalize field-name)))
              (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 ":")
-               (cond ((memq field eword-decode-ignored-field-list)
-                      ;; Don't decode
-                      (insert-buffer-substring src-buf p end)
-                      )
-                     ((memq field eword-decode-structured-field-list)
-                      ;; Decode as structured field
-                      (let ((body (save-excursion
-                                    (set-buffer src-buf)
-                                    (buffer-substring p end)
-                                    )))
-                        (insert (eword-decode-and-fold-structured-field
-                                 body (1+ len)))
-                        ))
-                     (t
-                      ;; Decode as unstructured field
-                      (let ((body (save-excursion
-                                    (set-buffer src-buf)
-                                    (buffer-substring p end)
-                                    )))
-                        (insert (eword-decode-unstructured-field-body
-                                 body (1+ len)))
-                        )))
+               (insert (ew-crlf-to-lf decoded))
                (insert "\n")
+               (add-text-properties beg (point)
+                                    (list 'original-field-name field-name
+                                          'original-field-body field-body))
                ))))))))
 
 (mm-define-method insert-text-content ((entity generic))
index d62b88b..616d3ad 100644 (file)
--- a/std11.el
+++ b/std11.el
@@ -116,16 +116,18 @@ header separator. [std11.el]"
 ;;;
 
 (defun std11-unfold-string (string)
-  "Unfold STRING as message header field. [std11.el]"
-  (let ((dest ""))
-    (while (string-match "\n\\([ \t]\\)" string)
+  "Unfold STRING as message header field."
+  (let ((dest "")
+       (p 0))
+    (while (string-match "\n\\([ \t]\\)" string p)
       (setq dest (concat dest
-                         (substring string 0 (match-beginning 0))
-                         (match-string 1 string)
+                         (substring string p (match-beginning 0))
+                         (substring string
+                                   (match-beginning 1)
+                                   (setq p (match-end 0)))
                          ))
-      (setq string (substring string (match-end 0)))
       )
-    (concat dest string)
+    (concat dest (substring string p))
     ))