-(defvar mime-view-body-visible-condition
- '(type
- (nil)
- (text subtype
- (plain)
- (enriched)
- (rfc822-headers)
- (richtext)
- (x-latex)
- (x-pgp))
- (application subtype
- (octet-stream encoding
- (nil)
- ("7bit")
- ("8bit"))
- (pgp)
- (x-latex)
- (x-selection)
- (x-comment))
- (message subtype
- (delivery-status)))
- "Condition-tree to be able to display body of entity.")
-
-(defun mime-view-body-visible-p (entity message-info)
- "Return non-nil if body of ENTITY is visible."
- (ctree-match-calist
- mime-view-body-visible-condition
- (list* (cons 'type (mime-entity-media-type entity))
- (cons 'subtype (mime-entity-media-subtype entity))
- (cons 'encoding (mime-entity-encoding entity))
- (cons 'major-mode major-mode)
- (mime-entity-parameters entity))))
-
-;; (defvar mime-view-visible-media-type-list
-;; '("text/plain" nil "text/richtext" "text/enriched"
-;; "text/rfc822-headers"
-;; "text/x-latex" "application/x-latex"
-;; "message/delivery-status"
-;; "application/pgp" "text/x-pgp"
-;; "application/octet-stream"
-;; "application/x-selection" "application/x-comment")
-;; "*List of media-types to be able to display in MIME-preview buffer.
-;; Each elements are string of TYPE/SUBTYPE, e.g. \"text/plain\".")
-
-;; (defun mime-view-body-visible-p (entity message-info)
-;; "Return non-nil if body of ENTITY is visible."
-;; (let ((media-type (mime-entity-media-type entity))
-;; (media-subtype (mime-entity-media-subtype entity))
-;; (ctype (mime-entity-type/subtype entity)))
-;; (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) '(nil "7bit" "8bit"))
-;; t))))
-
-
-;;; @@ entity filter
+(defun mime-calist::field-match-method-as-default-rule (calist
+ field-type field-value)
+ (let ((s-field (assq field-type calist)))
+ (cond ((null s-field)
+ (cons (cons field-type field-value) calist)
+ )
+ (t calist))))
+
+(define-calist-field-match-method
+ 'header #'mime-calist::field-match-method-as-default-rule)
+
+(define-calist-field-match-method
+ 'body #'mime-calist::field-match-method-as-default-rule)
+
+
+(defvar mime-preview-condition nil
+ "Condition-tree about how to display entity.")
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . application)(subtype . octet-stream)
+ (encoding . nil)
+ (body . visible)))
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . application)(subtype . octet-stream)
+ (encoding . "7bit")
+ (body . visible)))
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . application)(subtype . octet-stream)
+ (encoding . "8bit")
+ (body . visible)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . application)(subtype . pgp)
+ (body . visible)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . application)(subtype . x-latex)
+ (body . visible)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . application)(subtype . x-selection)
+ (body . visible)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . application)(subtype . x-comment)
+ (body . visible)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . message)(subtype . delivery-status)
+ (body . visible)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((body . visible)
+ (body-presentation-method . with-filter)
+ (body-filter . mime-preview-filter-for-text/plain)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . nil)
+ (body . visible)
+ (body-presentation-method . with-filter)
+ (body-filter . mime-preview-filter-for-text/plain)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . text)(subtype . enriched)
+ (body . visible)
+ (body-presentation-method . with-filter)
+ (body-filter
+ . mime-preview-filter-for-text/enriched)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . text)(subtype . richtext)
+ (body . visible)
+ (body-presentation-method . with-filter)
+ (body-filter
+ . mime-preview-filter-for-text/richtext)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . text)(subtype . t)
+ (body . visible)
+ (body-presentation-method . with-filter)
+ (body-filter . mime-preview-filter-for-text/plain)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . message)(subtype . partial)
+ (body-presentation-method
+ . mime-view-insert-message/partial-button)))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . message)(subtype . rfc822)
+ (body-presentation-method . nil)
+ (childrens-situation (header . visible)
+ (entity-button . invisible))))
+
+(ctree-set-calist-strictly
+ 'mime-preview-condition '((type . message)(subtype . news)
+ (body-presentation-method . nil)
+ (childrens-situation (header . visible)
+ (entity-button . invisible))))
+
+
+;;; @@@ entity filter