(defvar mime-raw-message-info
"Information about structure of message.
-Please use reference function `mime-entity-SLOT' to get value of
-SLOT.
+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 or t)
+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)
children entities included in this entity (list of content-infos)
If an entity includes other entities in its body, such as multipart or
-message/rfc822, entity-infos of other entities are included in
-`children', so entity-info become a tree.")
+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
(or (eq media-subtype 'x-selection)
(and (eq media-subtype 'octet-stream)
(let ((mother-entity
- (mime-raw-entity-node-id-to-entity-info
+ (mime-raw-find-entity-from-node-id
(cdr entity-node-id) message-info)))
(and (eq (mime-entity-media-type mother-entity)
'multipart)
(let ((entity-node-id (mime-entity-node-id entity)))
(or (null entity-node-id)
(member (mime-entity-type/subtype
- (mime-raw-entity-node-id-to-entity-info
+ (mime-raw-find-entity-from-node-id
(cdr entity-node-id) message-info))
mime-view-childrens-header-showing-Content-Type-list)
)))
(and (member ctype mime-view-visible-media-type-list)
(if (and (eq media-type 'application)
(eq media-subtype 'octet-stream))
- (member (mime-entity-encoding entity-info)
- '(nil "7bit" "8bit"))
+ (member (mime-entity-encoding entity) '(nil "7bit" "8bit"))
t))))
TYPE/SUBTYPE is a string of media-type and FUNCTION is a filter
function. t means default media-type.")
-(defun mime-view-display-body (beg end entity-node-id cinfo
- ctype params subj encoding)
+(defun mime-view-display-body (start end entity message-info subj)
(save-restriction
(narrow-to-region (point-max)(point-max))
- (insert-buffer-substring mime-raw-buffer beg end)
- (let ((f (cdr (or (assoc ctype mime-view-content-filter-alist)
- (assq t mime-view-content-filter-alist)))))
+ (insert-buffer-substring mime-raw-buffer start end)
+ (let* ((ctype (mime-entity-type/subtype entity))
+ (params (mime-entity-parameters entity))
+ (encoding (mime-entity-encoding entity))
+ (f (cdr (or (assoc ctype mime-view-content-filter-alist)
+ (assq t mime-view-content-filter-alist)))))
(and (functionp f)
- (funcall f ctype params encoding)
- )
+ (funcall f ctype params encoding))
)))
(defvar mime-view-announcement-for-message/partial
(defvar mime-view-uuencode-encoding-name-list '("x-uue" "x-uuencode"))
+(defvar mime-raw-buffer-coding-system-alist
+ `((mh-show-mode . no-conversion)
+ (t . ,(mime-charset-to-coding-system default-mime-charset)))
+ "Alist of major-mode vs. corresponding coding-system of `mime-raw-buffer'.")
;;; @ buffer setup
(or mime-view-redisplay
(setq mime-raw-message-info (mime-parse-message ctl encoding))
)
- (let* ((cinfo mime-raw-message-info)
- (pcl (mime-raw-flatten-message-info cinfo))
+ (let* ((message-info mime-raw-message-info)
+ (pcl (mime-raw-flatten-message-info message-info))
(the-buf (current-buffer))
(mode major-mode)
)
(setq major-mode 'mime-view-mode)
(setq mode-name "MIME-View")
(while pcl
- (mime-view-display-entity (car pcl) cinfo the-buf obuf)
+ (mime-view-display-entity (car pcl) message-info the-buf obuf)
(setq pcl (cdr pcl))
)
(set-buffer-modified-p nil)
(mime-view-insert-entity-button entity message-info subj)
))
(cond ((mime-view-body-visible-p entity message-info)
- (mime-view-display-body he end
- entity-node-id message-info
- ctype params subj encoding)
+ (mime-view-display-body he end entity message-info subj)
)
((and (eq media-type 'message)(eq media-subtype 'partial))
(mime-view-insert-message/partial-button)
(setq ne (point-max))
(widen)
(put-text-property nb ne 'mime-view-raw-buffer ibuf)
- (put-text-property nb ne 'mime-view-entity-info entity)
+ (put-text-property nb ne 'mime-view-entity entity)
(goto-char ne)
))
;;; @ entity information
;;;
-(defun mime-raw-point-to-entity-number (position &optional message-info)
- "Return entity-number from POTION in mime-raw-buffer.
-If optional argument MESSAGE-INFO is not specified,
-`mime-raw-message-info' is used."
- (or message-info
- (setq message-info mime-raw-message-info))
- (let ((b (mime-entity-point-min message-info))
- (e (mime-entity-point-max message-info))
- (c (mime-entity-children message-info))
- )
- (if (and (<= b position)(<= position e))
- (or (let (co ret (sn 0))
- (catch 'tag
- (while c
- (setq co (car c))
- (setq ret (mime-raw-point-to-entity-number position co))
- (cond ((eq ret t) (throw 'tag (list sn)))
- (ret (throw 'tag (cons sn ret)))
- )
- (setq c (cdr c))
- (setq sn (1+ sn))
- )))
- t))))
-
-(defun mime-raw-point-to-entity-node-id (position &optional message-info)
- "Return entity-node-id from POTION in mime-raw-buffer.
-If optional argument MESSAGE-INFO is not specified,
-`mime-raw-message-info' is used."
- (reverse (mime-raw-point-to-entity-number position message-info)))
-
-(defsubst mime-raw-entity-node-id-to-entity-info (entity-node-id
- &optional message-info)
- "Return entity-info from ENTITY-NODE-ID in mime-raw-buffer.
+(defsubst mime-raw-find-entity-from-node-id (entity-node-id
+ &optional message-info)
+ "Return entity from ENTITY-NODE-ID in mime-raw-buffer.
If optional argument MESSAGE-INFO is not specified,
`mime-raw-message-info' is used."
- (mime-raw-entity-number-to-entity-info (reverse entity-node-id)
- message-info))
+ (mime-raw-find-entity-from-number (reverse entity-node-id) message-info))
-(defun mime-raw-entity-number-to-entity-info (entity-number
- &optional message-info)
- "Return entity-info from ENTITY-NUMBER in mime-raw-buffer.
+(defun mime-raw-find-entity-from-number (entity-number &optional message-info)
+ "Return entity from ENTITY-NUMBER in mime-raw-buffer.
If optional argument MESSAGE-INFO is not specified,
`mime-raw-message-info' is used."
(or message-info
message-info
(let ((rc (nth sn (mime-entity-children message-info))))
(if rc
- (mime-raw-entity-number-to-entity-info (cdr entity-number) rc)
+ (mime-raw-find-entity-from-number (cdr entity-number) rc)
))
))))
+(defun mime-raw-find-entity-from-point (point &optional message-info)
+ "Return entity from POINT in mime-raw-buffer.
+If optional argument MESSAGE-INFO is not specified,
+`mime-raw-message-info' is used."
+ (or message-info
+ (setq message-info mime-raw-message-info))
+ (if (and (<= (mime-entity-point-min message-info) point)
+ (<= point (mime-entity-point-max message-info)))
+ (let ((children (mime-entity-children message-info)))
+ (catch 'tag
+ (while children
+ (let ((ret
+ (mime-raw-find-entity-from-point point (car children))))
+ (if ret
+ (throw 'tag ret)
+ ))
+ (setq children (cdr children)))
+ message-info))))
+
+(defsubst mime-raw-point-to-entity-node-id (point &optional message-info)
+ "Return entity-node-id from POINT in mime-raw-buffer.
+If optional argument MESSAGE-INFO is not specified,
+`mime-raw-message-info' is used."
+ (mime-entity-node-id (mime-raw-find-entity-from-point point message-info)))
+
+(defsubst mime-raw-point-to-entity-number (point &optional message-info)
+ "Return entity-number from POINT in mime-raw-buffer.
+If optional argument MESSAGE-INFO is not specified,
+`mime-raw-message-info' is used."
+ (reverse (mime-raw-point-to-entity-node-id point message-id)))
+
(defun mime-raw-flatten-message-info (&optional message-info)
- "Return list of entity-infos in mime-raw-buffer.
+ "Return list of entity in mime-raw-buffer.
If optional argument MESSAGE-INFO is not specified,
`mime-raw-message-info' is used."
(or message-info
(setq mime-mother-buffer mother)
))
(mime-view-define-keymap default-keymap-or-function)
- (let ((point (next-single-property-change (point-min) 'mime-view-entity-info)))
+ (let ((point
+ (next-single-property-change (point-min) 'mime-view-entity)))
(if point
(goto-char point)
(goto-char (point-min))
It calls following-method selected from variable
`mime-view-following-method-alist'."
(interactive)
- (let ((message-info (get-text-property (point-min) 'mime-view-entity-info))
+ (let ((message-info (get-text-property (point-min) 'mime-view-entity))
entity)
(while (null (setq entity
- (get-text-property (point) 'mime-view-entity-info)))
+ (get-text-property (point) 'mime-view-entity)))
(backward-char)
)
(let* ((p-beg
- (previous-single-property-change (point) 'mime-view-entity-info))
+ (previous-single-property-change (point) 'mime-view-entity))
p-end
(entity-node-id (mime-entity-node-id entity))
(len (length entity-node-id))
(cond ((null p-beg)
(setq p-beg
(if (eq (next-single-property-change (point-min)
- 'mime-view-entity-info)
+ 'mime-view-entity)
(point))
(point)
(point-min)))
)
- ((eq (next-single-property-change p-beg 'mime-view-entity-info)
+ ((eq (next-single-property-change p-beg 'mime-view-entity)
(point))
(setq p-beg (point))
))
- (setq p-end (next-single-property-change p-beg 'mime-view-entity-info))
+ (setq p-end (next-single-property-change p-beg 'mime-view-entity))
(cond ((null p-end)
(setq p-end (point-max))
)
(let (e)
(while (setq e
(next-single-property-change
- (point) 'mime-view-entity-info))
+ (point) 'mime-view-entity))
(goto-char e)
(let ((rc (mime-entity-node-id
(get-text-property (point)
- 'mime-view-entity-info))))
+ 'mime-view-entity))))
(or (equal entity-node-id
(nthcdr (- (length rc) len) rc))
(throw 'tag nil)
(set-buffer a-buf)
(setq
ci
- (mime-raw-entity-node-id-to-entity-info
- entity-node-id))
+ (mime-raw-find-entity-from-node-id entity-node-id))
(save-restriction
(narrow-to-region
(mime-entity-point-min ci)
(interactive)
(let (cinfo)
(while (null (setq cinfo
- (get-text-property (point) 'mime-view-entity-info)))
+ (get-text-property (point) 'mime-view-entity)))
(backward-char)
)
- (let ((r (mime-raw-entity-node-id-to-entity-info
+ (let ((r (mime-raw-find-entity-from-node-id
(cdr (mime-entity-node-id cinfo))
- (get-text-property 1 'mime-view-entity-info)))
+ (get-text-property 1 'mime-view-entity)))
point)
(catch 'tag
(while (setq point (previous-single-property-change
- (point) 'mime-view-entity-info))
+ (point) 'mime-view-entity))
(goto-char point)
- (if (eq r (get-text-property (point) 'mime-view-entity-info))
+ (if (eq r (get-text-property (point) 'mime-view-entity))
(throw 'tag t)
)
)
If there is no previous entity, it calls function registered in
variable `mime-view-over-to-previous-method-alist'."
(interactive)
- (while (null (get-text-property (point) 'mime-view-entity-info))
+ (while (null (get-text-property (point) 'mime-view-entity))
(backward-char)
)
(let ((point
- (previous-single-property-change (point) 'mime-view-entity-info)))
+ (previous-single-property-change (point) 'mime-view-entity)))
(if point
(goto-char point)
(let ((f (assq mime-preview-original-major-mode
If there is no previous entity, it calls function registered in
variable `mime-view-over-to-next-method-alist'."
(interactive)
- (let ((point (next-single-property-change (point) 'mime-view-entity-info)))
+ (let ((point (next-single-property-change (point) 'mime-view-entity)))
(if point
(goto-char point)
(let ((f (assq mime-preview-original-major-mode
(funcall (cdr f))
))
(let ((point
- (or (next-single-property-change (point) 'mime-view-entity-info)
+ (or (next-single-property-change (point) 'mime-view-entity)
(point-max))))
(forward-line h)
(if (> (point) point)
(while (> (point) 1)
(if (setq point
(previous-single-property-change (point)
- 'mime-view-entity-info))
+ 'mime-view-entity))
(throw 'tag t)
)
(backward-char)