(mime-entity-parent): New function; abolish `mime-raw-entity-parent'.
[elisp/semi.git] / mime-view.el
index 565c152..ab76cb8 100644 (file)
@@ -76,25 +76,38 @@ Please use reference function `mime-entity-SLOT' to get value of SLOT.
 
 Following is a list of slots of the structure:
 
-node-id                reversed entity-number (list of integers)
-point-min      beginning point of region in raw-buffer
-point-max      end point of region in raw-buffer
-type           media-type (symbol)
-subtype                media-subtype (symbol)
-type/subtype   media-type/subtype (string or nil)
-parameters     parameter of Content-Type field (association list)
-encoding       Content-Transfer-Encoding (string or nil)
-children       entities included in this entity (list of content-infos)
+buffer                 buffer includes this entity (buffer).
+node-id                        node-id (list of integers)
+header-start           minimum point of header in raw-buffer
+header-end             maximum point of header in raw-buffer
+body-start             minimum point of body in raw-buffer
+body-end               maximum point of body in raw-buffer
+content-type           content-type (content-type)
+content-disposition    content-disposition (content-disposition)
+encoding               Content-Transfer-Encoding (string or nil)
+children               entities included in this entity (list of entity)
 
 If an entity includes other entities in its body, such as multipart or
 message/rfc822, `mime-entity' structures of them are included in
 `children', so the `mime-entity' structure become a tree.")
 (make-variable-buffer-local 'mime-raw-message-info)
 
+
 (defvar mime-preview-buffer nil
   "MIME-preview buffer corresponding with the (raw) buffer.")
 (make-variable-buffer-local 'mime-preview-buffer)
 
+
+(defvar mime-raw-representation-type nil
+  "Representation-type of mime-raw-buffer.
+It must be nil, `binary' or `cooked'.
+If it is nil, `mime-raw-representation-type-alist' is used as default
+value.
+Notice that this variable is usually used as buffer local variable in
+raw-buffer.")
+
+(make-variable-buffer-local 'mime-raw-representation-type)
+
 (defvar mime-raw-representation-type-alist
   '((mime-show-message-mode     . binary)
     (mime-temp-message-mode     . binary)
@@ -188,12 +201,16 @@ If optional argument MESSAGE-INFO is not specified,
 `mime-raw-message-info' is used."
   (reverse (mime-raw-point-to-entity-node-id point message-info)))
 
-(defsubst mime-raw-entity-parent (entity &optional message-info)
+(defsubst mime-entity-parent (entity &optional message-info)
   "Return mother entity of ENTITY.
 If optional argument MESSAGE-INFO is not specified,
-`mime-raw-message-info' is used."
-  (mime-raw-find-entity-from-node-id (cdr (mime-entity-node-id entity))
-                                    message-info))
+`mime-raw-message-info' in buffer of ENTITY is used."
+  (mime-raw-find-entity-from-node-id
+   (cdr (mime-entity-node-id entity))
+   (or message-info
+       (save-excursion
+        (set-buffer (mime-entity-buffer entity))
+        mime-raw-message-info))))
 
 (defun mime-raw-flatten-message-info (&optional message-info)
   "Return list of entity in mime-raw-buffer.
@@ -227,7 +244,7 @@ Please redefine this function if you want to change default setting."
        (and (not (eq media-subtype 'x-selection))
             (or (not (eq media-subtype 'octet-stream))
                 (let ((mother-entity
-                       (mime-raw-entity-parent entity message-info)))
+                       (mime-entity-parent entity message-info)))
                   (or (not (eq (mime-entity-media-type mother-entity)
                                'multipart))
                       (not (eq (mime-entity-media-subtype mother-entity)
@@ -575,7 +592,7 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t.  t means default."
                                               (copy-alist situation))))
        )
       (setq children (cdr children)
-           situation (cdr situations)
+           situations (cdr situations)
            i (1+ i))
       )))