;; Renamed: 1997/02/19 from tm-view.el
;; Keywords: MIME, multimedia, mail, news
-;; This file is part of SEMI (Sophisticated Emacs MIME Interfaces).
+;; This file is part of WEMI (Widget based Emacs MIME Interfaces).
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;;; Code:
-(require 'std11)
-(require 'mime-lib)
-(require 'mime-parse)
+(require 'mime)
(require 'semi-def)
(require 'calist)
(require 'alist)
;;; @ in raw-buffer (representation space)
;;;
-(defvar mime-raw-message-info nil
- "Information about structure of message.
-Please use reference function `mime-entity-SLOT' to get value of SLOT.
-
-Following is a list of slots of the structure:
-
-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)
&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-message-structure' is used."
(mime-raw-find-entity-from-number (reverse entity-node-id) message-info))
(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."
+`mime-message-structure' is used."
(or message-info
- (setq message-info mime-raw-message-info))
+ (setq message-info mime-message-structure))
(if (eq entity-number t)
message-info
(let ((sn (car entity-number)))
(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."
+`mime-message-structure' is used."
(or message-info
- (setq message-info mime-raw-message-info))
+ (setq message-info mime-message-structure))
(if (and (<= (mime-entity-point-min message-info) point)
(<= point (mime-entity-point-max message-info)))
(let ((children (mime-entity-children message-info)))
;;; @ entity information
;;;
+(defsubst mime-entity-representation-type (entity)
+ (with-current-buffer (mime-entity-buffer entity)
+ (or mime-raw-representation-type
+ (cdr (or (assq major-mode mime-raw-representation-type-alist)
+ (assq t mime-raw-representation-type-alist))))))
+
+(defsubst mime-entity-cooked-p (entity)
+ (eq (mime-entity-representation-type entity) 'cooked))
+
(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' in buffer of ENTITY is used."
+`mime-message-structure' 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))))
+ mime-message-structure))))
(defun mime-entity-situation (entity)
"Return situation of ENTITY."
(defun mime-entity-filename (entity)
(or (mime-entity-uu-filename entity)
- (let ((ret (mime-entity-content-disposition entity)))
- (and ret
- (setq ret (mime-content-disposition-filename ret))
- (std11-strip-quoted-string ret)
- ))
- (let ((ret (mime-entity-content-type entity)))
- (and ret
- (setq ret
- (cdr
- (let ((param (mime-content-type-parameters ret)))
- (or (assoc "name" param)
- (assoc "x-name" param))
- )))
- (std11-strip-quoted-string ret)
- ))
- ))
+ (mime-content-disposition-filename
+ (mime-entity-content-disposition entity))
+ (cdr (let ((param (mime-content-type-parameters
+ (mime-entity-content-type entity))))
+ (or (assoc "name" param)
+ (assoc "x-name" param))
+ ))))
(defun mime-view-entity-title (entity)
(or (mime-entity-read-field entity 'Content-Description)
(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-message-structure' 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."
+`mime-message-structure' is used."
(mime-entity-number (mime-raw-find-entity-from-point point message-info)))
(defun mime-raw-flatten-message-info (&optional message-info)
"Return list of entity in mime-raw-buffer.
If optional argument MESSAGE-INFO is not specified,
-`mime-raw-message-info' is used."
+`mime-message-structure' is used."
(or message-info
- (setq message-info mime-raw-message-info))
+ (setq message-info mime-message-structure))
(let ((dest (list message-info))
(rcl (mime-entity-children message-info)))
(while rcl
(defvar mime-view-announcement-for-message/partial
(if (and (>= emacs-major-version 19) window-system)
"\
-\[[ This is message/partial style split message. ]]
-\[[ Please press `v' key in this buffer ]]
-\[[ or click here by mouse button-2. ]]"
+This is message/partial style split message.
+Please press `v' key in this buffer or click here by mouse button-2."
"\
-\[[ This is message/partial style split message. ]]
-\[[ Please press `v' key in this buffer. ]]"
+This is message/partial style split message.
+Please press `v' key in this buffer."
))
(defun mime-display-message/partial-button (&optional entity situation)
(insert "\n")
)
(goto-char (point-max))
- (narrow-to-region (point-max)(point-max))
- (insert mime-view-announcement-for-message/partial)
- (mime-add-button (point-min)(point-max)
- #'mime-preview-play-current-entity)
+ ;;(narrow-to-region (point-max)(point-max))
+ ;;(insert mime-view-announcement-for-message/partial)
+ ;; (mime-add-button (point-min)(point-max)
+ ;; #'mime-preview-play-current-entity)
+ (mime-insert-button mime-view-announcement-for-message/partial
+ #'mime-preview-play-current-entity)
))
(defun mime-display-multipart/mixed (entity situation)
(when header-is-visible
(if header-presentation-method
(funcall header-presentation-method entity situation)
- (mime-insert-decoded-header
- entity
- mime-view-ignored-field-list mime-view-visible-field-list
- (save-excursion
- (set-buffer raw-buffer)
- (if (eq (cdr (assq major-mode mime-raw-representation-type-alist))
- 'binary)
- default-mime-charset)
- )))
+ (mime-insert-decoded-header entity
+ mime-view-ignored-field-list
+ mime-view-visible-field-list
+ (if (mime-entity-cooked-p entity)
+ nil
+ default-mime-charset))
+ )
(goto-char (point-max))
(insert "\n")
(run-hooks 'mime-display-header-hook)
(setq preview-buffer
(concat "*Preview-" (buffer-name raw-buffer) "*")))
(set-buffer raw-buffer)
- (setq mime-raw-message-info (mime-parse-message))
+ (mime-parse-buffer)
(setq mime-preview-buffer preview-buffer)
(let ((inhibit-read-only t))
(switch-to-buffer preview-buffer)