1 ;;; mime-view.el --- interactive MIME viewer for GNU Emacs
3 ;; Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <tomo@m17n.org>
7 ;; Renamed: 1994/08/31 from tm-body.el
8 ;; Renamed: 1997/02/19 from tm-view.el
9 ;; Keywords: MIME, multimedia, mail, news
11 ;; This file is part of SEMI (Sample of Elastic MIME Interfaces).
13 ;; This program is free software; you can redistribute it and/or
14 ;; modify it under the terms of the GNU General Public License as
15 ;; published by the Free Software Foundation; either version 2, or (at
16 ;; your option) any later version.
18 ;; This program is distributed in the hope that it will be useful, but
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ;; General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
41 (defconst mime-view-version
42 (concat (mime-product-name mime-user-interface-product) " MIME-View "
43 (mapconcat #'number-to-string
44 (mime-product-version mime-user-interface-product) ".")
45 " (" (mime-product-code-name mime-user-interface-product) ")"))
51 (defgroup mime-view nil
55 (defcustom mime-situation-examples-file "~/.mime-example"
56 "*File name of situation-examples demonstrated by user."
60 (defcustom mime-preview-move-scroll nil
61 "*Decides whether to scroll when moving to next entity.
62 When t, scroll the buffer. Non-nil but not t means scroll when
63 the next entity is within next-screen-context-lines from top or
64 buttom. Nil means don't scroll at all."
66 :type '(choice (const :tag "Off" nil)
68 (sexp :tag "Situation" 1)))
71 ;;; @ in raw-buffer (representation space)
74 (defvar mime-preview-buffer nil
75 "MIME-preview buffer corresponding with the (raw) buffer.")
76 (make-variable-buffer-local 'mime-preview-buffer)
79 (defvar mime-raw-representation-type-alist
80 '((mime-show-message-mode . binary)
81 (mime-temp-message-mode . binary)
84 "Alist of major-mode vs. representation-type of mime-raw-buffer.
85 Each element looks like (SYMBOL . REPRESENTATION-TYPE). SYMBOL is
86 major-mode or t. t means default. REPRESENTATION-TYPE must be
87 `binary' or `cooked'.")
90 ;;; @ in preview-buffer (presentation space)
93 (defvar mime-mother-buffer nil
94 "Mother buffer corresponding with the (MIME-preview) buffer.
95 If current MIME-preview buffer is generated by other buffer, such as
96 message/partial, it is called `mother-buffer'.")
97 (make-variable-buffer-local 'mime-mother-buffer)
99 ;; (defvar mime-raw-buffer nil
100 ;; "Raw buffer corresponding with the (MIME-preview) buffer.")
101 ;; (make-variable-buffer-local 'mime-raw-buffer)
103 (defvar mime-preview-original-window-configuration nil
104 "Window-configuration before mime-view-mode is called.")
105 (make-variable-buffer-local 'mime-preview-original-window-configuration)
107 (defun mime-preview-original-major-mode (&optional recursive point)
108 "Return major-mode of original buffer.
109 If optional argument RECURSIVE is non-nil and current buffer has
110 mime-mother-buffer, it returns original major-mode of the
112 (if (and recursive mime-mother-buffer)
114 (set-buffer mime-mother-buffer)
115 (mime-preview-original-major-mode recursive)
117 (cdr (assq 'major-mode
118 (get-text-property (or point
119 (if (> (point) (buffer-size))
120 (max (1- (point-max)) (point-min))
122 'mime-view-situation)))))
125 ;;; @ entity information
128 (defun mime-entity-situation (entity &optional situation)
129 "Return situation of ENTITY."
130 (let (rest param name)
132 (unless (assq 'type situation)
133 (setq rest (or (mime-entity-content-type entity)
134 (make-mime-content-type 'text 'plain))
135 situation (cons (car rest) situation)
138 (unless (assq 'subtype situation)
140 (setq rest (or (cdr (mime-entity-content-type entity))
141 '((subtype . plain)))))
142 (setq situation (cons (car rest) situation)
146 (setq param (car rest))
147 (or (assoc (car param) situation)
148 (setq situation (cons param situation)))
149 (setq rest (cdr rest)))
151 ;; Content-Disposition
153 (unless (assq 'disposition-type situation)
154 (setq rest (mime-entity-content-disposition entity))
156 (setq situation (cons (cons 'disposition-type
157 (mime-content-disposition-type rest))
159 rest (mime-content-disposition-parameters rest))
162 (setq param (car rest)
164 (if (cond ((string= name "filename")
165 (if (assq 'filename situation)
167 (setq name 'filename)))
168 ((string= name "creation-date")
169 (if (assq 'creation-date situation)
171 (setq name 'creation-date)))
172 ((string= name "modification-date")
173 (if (assq 'modification-date situation)
175 (setq name 'modification-date)))
176 ((string= name "read-date")
177 (if (assq 'read-date situation)
179 (setq name 'read-date)))
180 ((string= name "size")
181 (if (assq 'size situation)
184 (t (setq name (cons 'disposition name))
185 (if (assoc name situation)
189 (cons (cons name (cdr param))
191 (setq rest (cdr rest)))
193 ;; Content-Transfer-Encoding
194 (or (assq 'encoding situation)
196 (cons (cons 'encoding (or (mime-entity-encoding entity)
202 (defsubst mime-delq-null-situation (situations field
203 &rest ignored-values)
206 (let* ((situation (car situations))
207 (cell (assq field situation)))
209 (or (memq (cdr cell) ignored-values)
210 (setq dest (cons situation dest))
212 (setq situations (cdr situations)))
215 (defun mime-compare-situation-with-example (situation example)
216 (let ((example (copy-alist example))
219 (let* ((cell (car situation))
221 (ecell (assoc key example)))
223 (if (equal cell ecell)
224 (setq match (1+ match))
225 (setq example (delq ecell example))
228 (setq situation (cdr situation))
233 (defun mime-sort-situation (situation)
243 (disposition-type . 6)
247 (let ((ret (assq a-t order)))
249 (setq a-order (cdr ret))
255 (let ((ret (assq b-t order)))
257 (setq b-order (cdr ret))
262 (if (= a-order b-order)
263 (string< (format "%s" a-t)(format "%s" b-t))
268 (defun mime-unify-situations (entity-situation
269 condition situation-examples
270 &optional required-name ignored-value
273 (in-calist-package 'mime-view)
275 (ctree-find-calist condition entity-situation
278 (setq ret (mime-delq-null-situation ret required-name
280 (or (assq 'ignore-examples entity-situation)
288 (let ((situation (car rest))
289 (examples situation-examples))
292 (mime-compare-situation-with-example
293 situation (caar examples)))
294 (ret-score (car ret)))
295 (cond ((> ret-score max-score)
296 (setq max-score ret-score
297 max-escore (cdar examples)
298 max-examples (list (cdr ret))
299 max-situations (list situation))
301 ((= ret-score max-score)
302 (cond ((> (cdar examples) max-escore)
303 (setq max-escore (cdar examples)
304 max-examples (list (cdr ret))
305 max-situations (list situation))
307 ((= (cdar examples) max-escore)
309 (cons (cdr ret) max-examples))
310 (or (member situation max-situations)
312 (cons situation max-situations)))
314 (setq examples (cdr examples))))
315 (setq rest (cdr rest)))
317 (setq ret max-situations)
319 (let* ((example (car max-examples))
321 (assoc example situation-examples)))
323 (setcdr cell (1+ (cdr cell)))
324 (setq situation-examples
325 (cons (cons example 0)
328 (setq max-examples (cdr max-examples))
330 (cons ret situation-examples)
331 ;; ret: list of situations
332 ;; situation-examples: new examples (notoce that contents of
333 ;; argument `situation-examples' has bees modified)
336 (defun mime-view-entity-title (entity)
337 (or (mime-entity-read-field entity 'Content-Description)
338 (mime-entity-read-field entity 'Subject)
339 (mime-entity-filename entity)
342 (defvar mime-preview-situation-example-list nil)
343 (defvar mime-preview-situation-example-list-max-size 16)
344 ;; (defvar mime-preview-situation-example-condition nil)
346 (defun mime-find-entity-preview-situation (entity
347 &optional default-situation)
349 (mime-unify-situations
350 (append (mime-entity-situation entity)
352 mime-preview-condition
353 mime-preview-situation-example-list)))
354 (setq mime-preview-situation-example-list
360 (defvar mime-acting-situation-example-list nil)
361 (defvar mime-acting-situation-example-list-max-size 16)
362 (defvar mime-situation-examples-file-coding-system nil)
364 (defun mime-save-situation-examples ()
365 (if (or mime-preview-situation-example-list
366 mime-acting-situation-example-list)
367 (let ((file mime-situation-examples-file))
369 (insert ";;; " (file-name-nondirectory file) "\n")
370 (insert "\n;; This file is generated automatically by "
371 mime-view-version "\n\n")
372 (insert ";;; Code:\n\n")
373 (if mime-preview-situation-example-list
374 (pp `(setq mime-preview-situation-example-list
375 ',mime-preview-situation-example-list)
377 (if mime-acting-situation-example-list
378 (pp `(setq mime-acting-situation-example-list
379 ',mime-acting-situation-example-list)
382 (file-name-nondirectory file)
385 ((boundp 'buffer-file-coding-system)
386 (setq buffer-file-coding-system
387 mime-situation-examples-file-coding-system))
388 ((boundp 'file-coding-system)
389 (setq file-coding-system
390 mime-situation-examples-file-coding-system)))
391 (setq buffer-file-name file)
394 (add-hook 'kill-emacs-hook 'mime-save-situation-examples)
396 (defun mime-reduce-situation-examples (situation-examples)
397 (let ((len (length situation-examples))
405 ir situation-examples)
409 jr situation-examples)
413 (setq ret (mime-compare-situation-with-example (car ic)(car jc))
415 det-ret (+ (length (car ic))(length (car jc)))
416 det-org (length (cdr ret))
417 freq (+ (cdr ic)(cdr jc)))
418 (cond ((< max-sim sim)
425 dest (cons (cdr ret) freq))
428 (cond ((> min-det-ret det-ret)
429 (setq min-det-ret det-ret
434 dest (cons (cdr ret) freq))
436 ((= min-det-ret det-ret)
437 (cond ((> min-det-org det-org)
438 (setq min-det-org det-org
442 dest (cons (cdr ret) freq))
444 ((= min-det-org det-org)
445 (cond ((> min-freq freq)
449 dest (cons (cdr ret) freq))
463 (setq jr (nthcdr (1- d-j) situation-examples))
464 (setcdr jr (cddr jr))
466 (setq situation-examples
467 (cdr situation-examples))
468 (setq ir (nthcdr (1- d-i) situation-examples))
469 (setcdr ir (cddr ir))
471 (if (setq ir (assoc (car dest) situation-examples))
473 (setcdr ir (+ (cdr ir)(cdr dest)))
475 (cons dest situation-examples)
476 ;; situation-examples may be modified.
480 ;;; @ presentation of preview
486 ;;; @@@ predicate function
489 ;; (defun mime-view-entity-button-visible-p (entity)
490 ;; "Return non-nil if header of ENTITY is visible.
491 ;; Please redefine this function if you want to change default setting."
492 ;; (let ((media-type (mime-entity-media-type entity))
493 ;; (media-subtype (mime-entity-media-subtype entity)))
494 ;; (or (not (eq media-type 'application))
495 ;; (and (not (eq media-subtype 'x-selection))
496 ;; (or (not (eq media-subtype 'octet-stream))
497 ;; (let ((mother-entity (mime-entity-parent entity)))
498 ;; (or (not (eq (mime-entity-media-type mother-entity)
500 ;; (not (eq (mime-entity-media-subtype mother-entity)
505 ;;; @@@ entity button generator
508 (defun mime-view-insert-entity-button (entity)
509 "Insert entity-button of ENTITY."
510 (let ((entity-node-id (mime-entity-node-id entity))
511 (params (mime-entity-parameters entity))
512 (subject (mime-view-entity-title entity)))
514 (let ((access-type (assoc "access-type" params))
515 (num (or (cdr (assoc "x-part-number" params))
516 (if (consp entity-node-id)
519 (format "%s" (1+ num))
521 (reverse entity-node-id) ".")
525 (let ((server (assoc "server" params)))
526 (setq access-type (cdr access-type))
528 (format "%s %s ([%s] %s)"
529 num subject access-type (cdr server))
530 (let ((site (cdr (assoc "site" params)))
531 (dir (cdr (assoc "directory" params)))
532 (url (cdr (assoc "url" params)))
535 (format "%s %s ([%s] %s)"
536 num subject access-type url)
537 (format "%s %s ([%s] %s:%s)"
538 num subject access-type site dir))
542 (let ((media-type (mime-entity-media-type entity))
543 (media-subtype (mime-entity-media-subtype entity))
544 (charset (cdr (assoc "charset" params)))
545 (encoding (mime-entity-encoding entity)))
549 (format " <%s/%s%s%s>"
550 media-type media-subtype
552 (concat "; " charset)
555 (concat " (" encoding ")")
557 (if (>= (+ (current-column)(length rest))(window-width))
561 (function mime-preview-play-current-entity))
568 (defvar mime-header-presentation-method-alist nil
569 "Alist of major mode vs. corresponding header-presentation-method functions.
570 Each element looks like (SYMBOL . FUNCTION).
571 SYMBOL must be major mode in raw-buffer or t. t means default.
572 Interface of FUNCTION must be (ENTITY SITUATION).")
574 (defvar mime-view-ignored-field-list
575 '(".*Received:" ".*Path:" ".*Id:" "^References:"
576 "^Replied:" "^Errors-To:"
577 "^Lines:" "^Sender:" ".*Host:" "^Xref:"
578 "^Content-Type:" "^Precedence:"
579 "^Status:" "^X-VM-.*:")
580 "All fields that match this list will be hidden in MIME preview buffer.
581 Each elements are regexp of field-name.")
583 (defvar mime-view-visible-field-list '("^Dnas.*:" "^Message-Id:")
584 "All fields that match this list will be displayed in MIME preview buffer.
585 Each elements are regexp of field-name.")
591 ;;; @@@ predicate function
594 (in-calist-package 'mime-view)
596 (defun mime-calist::field-match-method-as-default-rule (calist
597 field-type field-value)
598 (let ((s-field (assq field-type calist)))
599 (cond ((null s-field)
600 (cons (cons field-type field-value) calist)
604 (define-calist-field-match-method
605 'header #'mime-calist::field-match-method-as-default-rule)
607 (define-calist-field-match-method
608 'body #'mime-calist::field-match-method-as-default-rule)
611 (defvar mime-preview-condition nil
612 "Condition-tree about how to display entity.")
614 (ctree-set-calist-strictly
615 'mime-preview-condition '((type . application)(subtype . octet-stream)
618 (ctree-set-calist-strictly
619 'mime-preview-condition '((type . application)(subtype . octet-stream)
622 (ctree-set-calist-strictly
623 'mime-preview-condition '((type . application)(subtype . octet-stream)
627 (ctree-set-calist-strictly
628 'mime-preview-condition '((type . application)(subtype . pgp)
631 (ctree-set-calist-strictly
632 'mime-preview-condition '((type . application)(subtype . x-latex)
635 (ctree-set-calist-strictly
636 'mime-preview-condition '((type . application)(subtype . x-selection)
639 (ctree-set-calist-strictly
640 'mime-preview-condition '((type . application)(subtype . x-comment)
643 (ctree-set-calist-strictly
644 'mime-preview-condition '((type . message)(subtype . delivery-status)
647 (ctree-set-calist-strictly
648 'mime-preview-condition
650 (body-presentation-method . mime-display-text/plain)))
652 (defvar mime-preview-fill-flowed-text
653 (module-installed-p 'flow-fill)
654 "If non-nil, fill RFC2646 \"flowed\" text.")
656 (autoload 'fill-flowed "flow-fill")
658 (ctree-set-calist-strictly
659 'mime-preview-condition
662 (body-presentation-method . mime-display-text/plain)))
664 (ctree-set-calist-strictly
665 'mime-preview-condition
666 '((type . text)(subtype . enriched)
668 (body-presentation-method . mime-display-text/enriched)))
670 (ctree-set-calist-strictly
671 'mime-preview-condition
672 '((type . text)(subtype . richtext)
674 (body-presentation-method . mime-display-text/richtext)))
676 (autoload 'mime-display-application/x-postpet "postpet")
678 (ctree-set-calist-strictly
679 'mime-preview-condition
680 '((type . application)(subtype . x-postpet)
682 (body-presentation-method . mime-display-application/x-postpet)))
684 (ctree-set-calist-strictly
685 'mime-preview-condition
686 '((type . text)(subtype . t)
688 (body-presentation-method . mime-display-text/plain)))
690 (ctree-set-calist-strictly
691 'mime-preview-condition
692 '((type . multipart)(subtype . alternative)
694 (body-presentation-method . mime-display-multipart/alternative)))
696 (ctree-set-calist-strictly
697 'mime-preview-condition
698 '((type . multipart)(subtype . t)
700 (body-presentation-method . mime-display-multipart/mixed)))
702 (ctree-set-calist-strictly
703 'mime-preview-condition
704 '((type . message)(subtype . partial)
706 (body-presentation-method . mime-display-message/partial-button)))
708 (ctree-set-calist-strictly
709 'mime-preview-condition
710 '((type . message)(subtype . rfc822)
712 (body-presentation-method . mime-display-multipart/mixed)
713 (childrens-situation (header . visible)
714 (entity-button . invisible))))
716 (ctree-set-calist-strictly
717 'mime-preview-condition
718 '((type . message)(subtype . news)
720 (body-presentation-method . mime-display-multipart/mixed)
721 (childrens-situation (header . visible)
722 (entity-button . invisible))))
725 ;;; @@@ entity presentation
728 (defun mime-display-text/plain (entity situation)
730 (narrow-to-region (point-max)(point-max))
732 (mime-insert-text-content entity)
734 (message "Can't decode current entity.")
736 (run-hooks 'mime-text-decode-hook)
737 (goto-char (point-max))
738 (if (not (eq (char-after (1- (point))) ?\n))
741 (if (and mime-preview-fill-flowed-text
742 (equal (cdr (assoc "format" situation)) "flowed"))
744 (mime-add-url-buttons)
745 (run-hooks 'mime-display-text/plain-hook)
748 (defun mime-display-text/richtext (entity situation)
750 (narrow-to-region (point-max)(point-max))
751 (mime-insert-text-content entity)
752 (run-hooks 'mime-text-decode-hook)
753 (let ((beg (point-min)))
754 (remove-text-properties beg (point-max) '(face nil))
755 (richtext-decode beg (point-max))
758 (defun mime-display-text/enriched (entity situation)
760 (narrow-to-region (point-max)(point-max))
761 (mime-insert-text-content entity)
762 (run-hooks 'mime-text-decode-hook)
763 (let ((beg (point-min)))
764 (remove-text-properties beg (point-max) '(face nil))
765 (enriched-decode beg (point-max))
768 (defvar mime-view-announcement-for-message/partial
769 (if (and (>= emacs-major-version 19) window-system)
771 \[[ This is message/partial style split message. ]]
772 \[[ Please press `v' key in this buffer ]]
773 \[[ or click here by mouse button-2. ]]"
775 \[[ This is message/partial style split message. ]]
776 \[[ Please press `v' key in this buffer. ]]"
779 (defun mime-display-message/partial-button (&optional entity situation)
781 (goto-char (point-max))
782 (if (not (search-backward "\n\n" nil t))
785 (goto-char (point-max))
786 (narrow-to-region (point-max)(point-max))
787 (insert mime-view-announcement-for-message/partial)
788 (mime-add-button (point-min)(point-max)
789 #'mime-preview-play-current-entity)
792 (defun mime-display-multipart/mixed (entity situation)
793 (let ((children (mime-entity-children entity))
794 (original-major-mode-cell (assq 'major-mode situation))
796 (cdr (assq 'childrens-situation situation))))
797 (if original-major-mode-cell
798 (setq default-situation
799 (cons original-major-mode-cell default-situation)))
801 (mime-display-entity (car children) nil default-situation)
802 (setq children (cdr children))
805 (defcustom mime-view-type-subtype-score-alist
806 '(((text . enriched) . 3)
807 ((text . richtext) . 2)
810 "Alist MEDIA-TYPE vs corresponding score.
811 MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t. t means default."
813 :type '(repeat (cons (choice :tag "Media-Type"
814 (cons :tag "Type/Subtype"
815 (symbol :tag "Primary-type")
816 (symbol :tag "Subtype"))
818 (const :tag "Default" t))
821 (defun mime-display-multipart/alternative (entity situation)
822 (let* ((children (mime-entity-children entity))
823 (original-major-mode-cell (assq 'major-mode situation))
825 (cdr (assq 'childrens-situation situation)))
830 (if original-major-mode-cell
831 (setq default-situation
832 (cons original-major-mode-cell default-situation)))
837 (mime-find-entity-preview-situation
838 child default-situation)))
839 (if (cdr (assq 'body-presentation-method situation))
844 (cdr (assq 'type situation))
845 (cdr (assq 'subtype situation)))
846 mime-view-type-subtype-score-alist)
848 (cdr (assq 'type situation))
849 mime-view-type-subtype-score-alist)
852 mime-view-type-subtype-score-alist)
854 (if (> score max-score)
864 (let ((child (car children))
865 (situation (car situations)))
866 (mime-display-entity child (if (= i p)
868 (put-alist 'body 'invisible
869 (copy-alist situation)))))
870 (setq children (cdr children)
871 situations (cdr situations)
875 ;;; @ acting-condition
878 (defvar mime-acting-condition nil
879 "Condition-tree about how to process entity.")
881 (if (file-readable-p mailcap-file)
882 (let ((entries (mailcap-parse-file)))
884 (let ((entry (car entries))
887 (let* ((field (car entry))
888 (field-type (car field)))
889 (cond ((eq field-type 'view) (setq view field))
890 ((eq field-type 'print) (setq print field))
891 ((memq field-type '(compose composetyped edit)))
892 (t (setq shared (cons field shared))))
894 (setq entry (cdr entry))
896 (setq shared (nreverse shared))
897 (ctree-set-calist-with-default
898 'mime-acting-condition
899 (append shared (list '(mode . "play")(cons 'method (cdr view)))))
901 (ctree-set-calist-with-default
902 'mime-acting-condition
904 (list '(mode . "print")(cons 'method (cdr view))))
907 (setq entries (cdr entries))
910 (ctree-set-calist-strictly
911 'mime-acting-condition
912 '((type . application)(subtype . octet-stream)
914 (method . mime-detect-content)
917 (ctree-set-calist-with-default
918 'mime-acting-condition
920 (method . mime-save-content)))
922 (ctree-set-calist-strictly
923 'mime-acting-condition
924 '((type . text)(subtype . x-rot13-47)(mode . "play")
925 (method . mime-view-caesar)
927 (ctree-set-calist-strictly
928 'mime-acting-condition
929 '((type . text)(subtype . x-rot13-47-48)(mode . "play")
930 (method . mime-view-caesar)
933 (ctree-set-calist-strictly
934 'mime-acting-condition
935 '((type . message)(subtype . rfc822)(mode . "play")
936 (method . mime-view-message/rfc822)
938 (ctree-set-calist-strictly
939 'mime-acting-condition
940 '((type . message)(subtype . partial)(mode . "play")
941 (method . mime-store-message/partial-piece)
944 (ctree-set-calist-strictly
945 'mime-acting-condition
946 '((type . message)(subtype . external-body)
947 ("access-type" . "anon-ftp")
948 (method . mime-view-message/external-anon-ftp)
951 (ctree-set-calist-strictly
952 'mime-acting-condition
953 '((type . message)(subtype . external-body)
954 ("access-type" . "url")
955 (method . mime-view-message/external-url)
958 (ctree-set-calist-strictly
959 'mime-acting-condition
960 '((type . application)(subtype . octet-stream)
961 (method . mime-save-content)
965 ;;; @ quitting method
968 (defvar mime-preview-quitting-method-alist
969 '((mime-show-message-mode
970 . mime-preview-quitting-method-for-mime-show-message-mode))
971 "Alist of major-mode vs. quitting-method of mime-view.")
973 (defvar mime-preview-over-to-previous-method-alist nil
974 "Alist of major-mode vs. over-to-previous-method of mime-view.")
976 (defvar mime-preview-over-to-next-method-alist nil
977 "Alist of major-mode vs. over-to-next-method of mime-view.")
980 ;;; @ following method
983 (defvar mime-preview-following-method-alist nil
984 "Alist of major-mode vs. following-method of mime-view.")
986 (defvar mime-view-following-required-fields-list
993 (defun mime-display-entity (entity &optional situation
994 default-situation preview-buffer)
996 (setq preview-buffer (current-buffer)))
997 (let* (e nb ne nhb nbb)
998 (in-calist-package 'mime-view)
1001 (mime-find-entity-preview-situation entity default-situation)))
1002 (let ((button-is-invisible
1003 (eq (cdr (or (assq '*entity-button situation)
1004 (assq 'entity-button situation)))
1007 (eq (cdr (or (assq '*header situation)
1008 (assq 'header situation)))
1011 (eq (cdr (or (assq '*body situation)
1012 (assq 'body situation)))
1014 (children (mime-entity-children entity)))
1015 (set-buffer preview-buffer)
1017 (narrow-to-region nb nb)
1018 (or button-is-invisible
1019 ;; (if (mime-view-entity-button-visible-p entity)
1020 (mime-view-insert-entity-button entity)
1023 (if header-is-visible
1024 (let ((header-presentation-method
1025 (or (cdr (assq 'header-presentation-method situation))
1026 (cdr (assq (cdr (assq 'major-mode situation))
1027 mime-header-presentation-method-alist)))))
1029 (if header-presentation-method
1030 (funcall header-presentation-method entity situation)
1031 (mime-insert-header entity
1032 mime-view-ignored-field-list
1033 mime-view-visible-field-list))
1034 (run-hooks 'mime-display-header-hook)
1035 (put-text-property nhb (point-max) 'mime-view-entity-header entity)
1036 (goto-char (point-max))
1041 (let ((body-presentation-method
1042 (cdr (assq 'body-presentation-method situation))))
1043 (if (functionp body-presentation-method)
1044 (funcall body-presentation-method entity situation)
1045 (mime-display-text/plain entity situation)))
1046 (when button-is-invisible
1047 (goto-char (point-max))
1048 (mime-view-insert-entity-button entity)
1050 (unless header-is-visible
1051 (goto-char (point-max))
1054 (setq ne (point-max))
1056 (put-text-property nb ne 'mime-view-entity entity)
1057 (put-text-property nb ne 'mime-view-situation situation)
1058 (put-text-property nbb ne 'mime-view-entity-body entity)
1060 (if (and children body-is-visible)
1061 (let ((body-presentation-method
1062 (cdr (assq 'body-presentation-method situation))))
1063 (if (functionp body-presentation-method)
1064 (funcall body-presentation-method entity situation)
1065 (mime-display-multipart/mixed entity situation))))
1069 ;;; @ MIME viewer mode
1072 (defconst mime-view-menu-title "MIME-View")
1073 (defconst mime-view-menu-list
1074 '((up "Move to upper entity" mime-preview-move-to-upper)
1075 (previous "Move to previous entity" mime-preview-move-to-previous)
1076 (next "Move to next entity" mime-preview-move-to-next)
1077 (scroll-down "Scroll-down" mime-preview-scroll-down-entity)
1078 (scroll-up "Scroll-up" mime-preview-scroll-up-entity)
1079 (play "Play current entity" mime-preview-play-current-entity)
1080 (extract "Extract current entity" mime-preview-extract-current-entity)
1081 (print "Print current entity" mime-preview-print-current-entity)
1083 "Menu for MIME Viewer")
1085 (cond ((featurep 'xemacs)
1086 (defvar mime-view-xemacs-popup-menu
1087 (cons mime-view-menu-title
1090 (vector (nth 1 item)(nth 2 item) t)
1092 mime-view-menu-list)))
1093 (defun mime-view-xemacs-popup-menu (event)
1094 "Popup the menu in the MIME Viewer buffer"
1096 (select-window (event-window event))
1097 (set-buffer (event-buffer event))
1098 (popup-menu 'mime-view-xemacs-popup-menu))
1099 (defvar mouse-button-2 'button2)
1102 (defvar mime-view-popup-menu
1103 (let ((menu (make-sparse-keymap mime-view-menu-title)))
1107 (list (intern (nth 1 item)) 'menu-item
1108 (nth 1 item)(nth 2 item))
1110 mime-view-menu-list))))
1111 (defun mime-view-popup-menu (event)
1112 "Popup the menu in the MIME Viewer buffer"
1114 (let ((menu mime-view-popup-menu) events func)
1115 (setq events (x-popup-menu t menu))
1117 (setq func (lookup-key menu (apply #'vector events)))
1120 (defvar mouse-button-2 [mouse-2])
1123 (defun mime-view-define-keymap (&optional default)
1124 (let ((mime-view-mode-map (if (keymapp default)
1125 (copy-keymap default)
1126 (make-sparse-keymap)
1128 (define-key mime-view-mode-map
1129 "u" (function mime-preview-move-to-upper))
1130 (define-key mime-view-mode-map
1131 "p" (function mime-preview-move-to-previous))
1132 (define-key mime-view-mode-map
1133 "n" (function mime-preview-move-to-next))
1134 (define-key mime-view-mode-map
1135 "\e\t" (function mime-preview-move-to-previous))
1136 (define-key mime-view-mode-map
1137 "\t" (function mime-preview-move-to-next))
1138 (define-key mime-view-mode-map
1139 " " (function mime-preview-scroll-up-entity))
1140 (define-key mime-view-mode-map
1141 "\M- " (function mime-preview-scroll-down-entity))
1142 (define-key mime-view-mode-map
1143 "\177" (function mime-preview-scroll-down-entity))
1144 (define-key mime-view-mode-map
1145 "\C-m" (function mime-preview-next-line-entity))
1146 (define-key mime-view-mode-map
1147 "\C-\M-m" (function mime-preview-previous-line-entity))
1148 (define-key mime-view-mode-map
1149 "v" (function mime-preview-play-current-entity))
1150 (define-key mime-view-mode-map
1151 "e" (function mime-preview-extract-current-entity))
1152 (define-key mime-view-mode-map
1153 "\C-c\C-p" (function mime-preview-print-current-entity))
1155 (define-key mime-view-mode-map
1156 "\C-c\C-t\C-f" (function mime-preview-toggle-header))
1157 (define-key mime-view-mode-map
1158 "\C-c\C-th" (function mime-preview-toggle-header))
1159 (define-key mime-view-mode-map
1160 "\C-c\C-t\C-c" (function mime-preview-toggle-content))
1162 (define-key mime-view-mode-map
1163 "\C-c\C-v\C-f" (function mime-preview-show-header))
1164 (define-key mime-view-mode-map
1165 "\C-c\C-vh" (function mime-preview-show-header))
1166 (define-key mime-view-mode-map
1167 "\C-c\C-v\C-c" (function mime-preview-show-content))
1169 (define-key mime-view-mode-map
1170 "\C-c\C-d\C-f" (function mime-preview-hide-header))
1171 (define-key mime-view-mode-map
1172 "\C-c\C-dh" (function mime-preview-hide-header))
1173 (define-key mime-view-mode-map
1174 "\C-c\C-d\C-c" (function mime-preview-hide-content))
1176 (define-key mime-view-mode-map
1177 "a" (function mime-preview-follow-current-entity))
1178 (define-key mime-view-mode-map
1179 "q" (function mime-preview-quit))
1180 (define-key mime-view-mode-map
1181 "\C-c\C-x" (function mime-preview-kill-buffer))
1182 ;; (define-key mime-view-mode-map
1183 ;; "<" (function beginning-of-buffer))
1184 ;; (define-key mime-view-mode-map
1185 ;; ">" (function end-of-buffer))
1186 (define-key mime-view-mode-map
1187 "?" (function describe-mode))
1188 (define-key mime-view-mode-map
1189 [tab] (function mime-preview-move-to-next))
1190 (define-key mime-view-mode-map
1191 [delete] (function mime-preview-scroll-down-entity))
1192 (define-key mime-view-mode-map
1193 [backspace] (function mime-preview-scroll-down-entity))
1194 (if (functionp default)
1195 (cond ((featurep 'xemacs)
1196 (set-keymap-default-binding mime-view-mode-map default)
1199 (setq mime-view-mode-map
1200 (append mime-view-mode-map (list (cons t default))))
1203 (define-key mime-view-mode-map
1204 mouse-button-2 (function mime-button-dispatcher))
1206 (cond ((featurep 'xemacs)
1207 (define-key mime-view-mode-map
1208 mouse-button-3 (function mime-view-xemacs-popup-menu))
1210 ((>= emacs-major-version 19)
1211 (define-key mime-view-mode-map
1212 mouse-button-3 (function mime-view-popup-menu))
1213 (define-key mime-view-mode-map [menu-bar mime-view]
1214 (cons mime-view-menu-title
1215 (make-sparse-keymap mime-view-menu-title)))
1218 (define-key mime-view-mode-map
1219 (vector 'menu-bar 'mime-view (car item))
1220 (cons (nth 1 item)(nth 2 item))
1223 (reverse mime-view-menu-list)
1226 (use-local-map mime-view-mode-map)
1227 (run-hooks 'mime-view-define-keymap-hook)
1230 (defsubst mime-maybe-hide-echo-buffer ()
1231 "Clear mime-echo buffer and delete window for it."
1232 (let ((buf (get-buffer mime-echo-buffer-name)))
1237 (let ((win (get-buffer-window buf)))
1244 (defvar mime-view-redisplay nil)
1247 (defun mime-display-message (message &optional preview-buffer
1248 mother default-keymap-or-function
1249 original-major-mode)
1250 "View MESSAGE in MIME-View mode.
1252 Optional argument PREVIEW-BUFFER specifies the buffer of the
1253 presentation. It must be either nil or a name of preview buffer.
1255 Optional argument MOTHER specifies mother-buffer of the preview-buffer.
1257 Optional argument DEFAULT-KEYMAP-OR-FUNCTION is nil, keymap or
1258 function. If it is a keymap, keymap of MIME-View mode will be added
1259 to it. If it is a function, it will be bound as default binding of
1260 keymap of MIME-View mode."
1261 (mime-maybe-hide-echo-buffer)
1262 (let ((win-conf (current-window-configuration)))
1264 (setq preview-buffer
1265 (concat "*Preview-" (mime-entity-name message) "*")))
1266 (or original-major-mode
1267 (setq original-major-mode major-mode))
1268 (let ((inhibit-read-only t))
1269 (set-buffer (get-buffer-create preview-buffer))
1273 (setq mime-mother-buffer mother)
1275 (setq mime-preview-original-window-configuration win-conf)
1276 (setq major-mode 'mime-view-mode)
1277 (setq mode-name "MIME-View")
1278 (mime-display-entity message nil
1279 `((entity-button . invisible)
1281 (major-mode . ,original-major-mode))
1283 (mime-view-define-keymap default-keymap-or-function)
1285 (next-single-property-change (point-min) 'mime-view-entity)))
1288 (goto-char (point-min))
1289 (search-forward "\n\n" nil t)
1291 (run-hooks 'mime-view-mode-hook)
1292 (set-buffer-modified-p nil)
1293 (setq buffer-read-only t)
1297 (defun mime-view-buffer (&optional raw-buffer preview-buffer mother
1298 default-keymap-or-function
1299 representation-type)
1300 "View RAW-BUFFER in MIME-View mode.
1301 Optional argument PREVIEW-BUFFER is either nil or a name of preview
1303 Optional argument DEFAULT-KEYMAP-OR-FUNCTION is nil, keymap or
1304 function. If it is a keymap, keymap of MIME-View mode will be added
1305 to it. If it is a function, it will be bound as default binding of
1306 keymap of MIME-View mode.
1307 Optional argument REPRESENTATION-TYPE is representation-type of
1308 message. It must be nil, `binary' or `cooked'. If it is nil,
1309 `cooked' is used as default."
1312 (setq raw-buffer (current-buffer)))
1313 (or representation-type
1314 (setq representation-type
1316 (set-buffer raw-buffer)
1317 (cdr (or (assq major-mode mime-raw-representation-type-alist)
1318 (assq t mime-raw-representation-type-alist)))
1320 (if (eq representation-type 'binary)
1321 (setq representation-type 'buffer)
1323 (setq preview-buffer (mime-display-message
1324 (mime-open-entity representation-type raw-buffer)
1325 preview-buffer mother default-keymap-or-function))
1326 (or (get-buffer-window preview-buffer)
1327 (let ((r-win (get-buffer-window raw-buffer)))
1329 (set-window-buffer r-win preview-buffer)
1330 (let ((m-win (and mother (get-buffer-window mother))))
1332 (set-window-buffer m-win preview-buffer)
1333 (switch-to-buffer preview-buffer)
1336 (defun mime-view-mode (&optional mother ctl encoding
1337 raw-buffer preview-buffer
1338 default-keymap-or-function)
1339 "Major mode for viewing MIME message.
1341 Here is a list of the standard keys for mime-view-mode.
1346 u Move to upper content
1347 p or M-TAB Move to previous content
1348 n or TAB Move to next content
1349 SPC Scroll up or move to next content
1350 M-SPC or DEL Scroll down or move to previous content
1351 RET Move to next line
1352 M-RET Move to previous line
1353 v Decode current content as `play mode'
1354 e Decode current content as `extract mode'
1355 C-c C-p Decode current content as `print mode'
1356 a Followup to current content.
1358 button-2 Move to point under the mouse cursor
1359 and decode current content as `play mode'
1362 (unless mime-view-redisplay
1364 (if raw-buffer (set-buffer raw-buffer))
1367 (or (assq major-mode mime-raw-representation-type-alist)
1368 (assq t mime-raw-representation-type-alist)))))
1369 (if (eq type 'binary)
1372 (setq mime-message-structure (mime-open-entity type raw-buffer))
1373 (or (mime-entity-content-type mime-message-structure)
1374 (mime-entity-set-content-type mime-message-structure ctl))
1376 (or (mime-entity-encoding mime-message-structure)
1377 (mime-entity-set-encoding mime-message-structure encoding))
1379 (mime-display-message mime-message-structure preview-buffer
1380 mother default-keymap-or-function)
1387 (defun mime-preview-find-boundary-info (&optional get-mother)
1391 (while (null (setq entity
1392 (get-text-property (point) 'mime-view-entity)))
1394 (setq p-beg (previous-single-property-change (point) 'mime-view-entity))
1395 (setq entity-node-id (mime-entity-node-id entity))
1396 (setq len (length entity-node-id))
1399 (if (eq (next-single-property-change (point-min)
1405 ((eq (next-single-property-change p-beg 'mime-view-entity)
1407 (setq p-beg (point))
1409 (setq p-end (next-single-property-change p-beg 'mime-view-entity))
1411 (setq p-end (point-max))
1413 ((null entity-node-id)
1414 (setq p-end (point-max))
1422 (next-single-property-change
1423 (point) 'mime-view-entity))
1425 (let ((rc (mime-entity-node-id
1426 (get-text-property (1- (point))
1427 'mime-view-entity))))
1428 (or (and (>= (setq i (- (length rc) len)) 0)
1429 (equal entity-node-id (nthcdr i rc)))
1432 (setq p-end (point-max))))
1434 (vector p-beg p-end entity)))
1440 (autoload 'mime-preview-play-current-entity "mime-play"
1441 "Play current entity." t)
1443 (defun mime-preview-extract-current-entity (&optional ignore-examples)
1444 "Extract current entity into file (maybe).
1445 It decodes current entity to call internal or external method as
1446 \"extract\" mode. The method is selected from variable
1447 `mime-acting-condition'."
1449 (mime-preview-play-current-entity ignore-examples "extract")
1452 (defun mime-preview-print-current-entity (&optional ignore-examples)
1453 "Print current entity (maybe).
1454 It decodes current entity to call internal or external method as
1455 \"print\" mode. The method is selected from variable
1456 `mime-acting-condition'."
1458 (mime-preview-play-current-entity ignore-examples "print")
1465 (defun mime-preview-follow-current-entity ()
1466 "Write follow message to current entity.
1467 It calls following-method selected from variable
1468 `mime-preview-following-method-alist'."
1470 (let ((entity (mime-preview-find-boundary-info t))
1473 (setq p-beg (aref entity 0)
1474 p-end (aref entity 1)
1475 entity (aref entity 2))
1476 (if (get-text-property p-beg 'mime-view-entity-body)
1479 (next-single-property-change
1480 p-beg 'mime-view-entity-body nil
1481 (or (next-single-property-change p-beg 'mime-view-entity)
1483 (let* ((mode (mime-preview-original-major-mode 'recursive))
1484 (entity-node-id (mime-entity-node-id entity))
1486 (format "%s-%s" (buffer-name) (reverse entity-node-id)))
1488 (the-buf (current-buffer))
1491 (set-buffer (setq new-buf (get-buffer-create new-name)))
1494 (insert-buffer-substring the-buf pb-beg p-end)
1495 (goto-char (point-min))
1496 (let ((current-entity
1497 (if (and (eq (mime-entity-media-type entity) 'message)
1498 (eq (mime-entity-media-subtype entity) 'rfc822))
1499 (car (mime-entity-children entity))
1501 (while (and current-entity
1502 (if (and (eq (mime-entity-media-type
1503 current-entity) 'message)
1504 (eq (mime-entity-media-subtype
1505 current-entity) 'rfc822))
1507 (mime-insert-header current-entity fields)
1509 (setq fields (std11-collect-field-names)
1510 current-entity (mime-entity-parent current-entity))
1512 (let ((rest mime-view-following-required-fields-list)
1515 (setq field-name (car rest))
1516 (or (std11-field-body field-name)
1519 (set-buffer the-buf)
1520 (let ((entity (when mime-mother-buffer
1521 (set-buffer mime-mother-buffer)
1522 (get-text-property (point)
1523 'mime-view-entity))))
1525 (null (setq ret (mime-entity-fetch-field
1526 entity field-name))))
1527 (setq entity (mime-entity-parent entity)))))
1529 (insert (concat field-name ": " ret "\n"))
1531 (setq rest (cdr rest))
1534 (let ((f (cdr (assq mode mime-preview-following-method-alist))))
1539 "Sorry, following method for %s is not implemented yet."
1548 (defun mime-preview-move-to-upper ()
1549 "Move to upper entity.
1550 If there is no upper entity, call function `mime-preview-quit'."
1553 (while (null (setq cinfo
1554 (get-text-property (point) 'mime-view-entity)))
1557 (let ((r (mime-entity-parent cinfo))
1560 (while (setq point (previous-single-property-change
1561 (point) 'mime-view-entity))
1563 (when (eq r (get-text-property (point) 'mime-view-entity))
1564 (if (or (eq mime-preview-move-scroll t)
1565 (and mime-preview-move-scroll
1568 (move-to-window-line -1)
1569 (forward-line (* -1 next-screen-context-lines))
1572 (recenter next-screen-context-lines))
1579 (defun mime-preview-move-to-previous ()
1580 "Move to previous entity.
1581 If there is no previous entity, it calls function registered in
1582 variable `mime-preview-over-to-previous-method-alist'."
1584 (while (and (not (bobp))
1585 (null (get-text-property (point) 'mime-view-entity)))
1588 (let ((point (previous-single-property-change (point) 'mime-view-entity)))
1590 (>= point (point-min)))
1591 (if (get-text-property (1- point) 'mime-view-entity)
1592 (progn (goto-char point)
1594 (or (eq mime-preview-move-scroll t)
1595 (and mime-preview-move-scroll
1598 (move-to-window-line 0)
1599 (forward-line next-screen-context-lines)
1602 (recenter (* -1 next-screen-context-lines))))
1603 (goto-char (1- point))
1604 (mime-preview-move-to-previous)
1606 (let ((f (assq (mime-preview-original-major-mode)
1607 mime-preview-over-to-previous-method-alist)))
1613 (defun mime-preview-move-to-next ()
1614 "Move to next entity.
1615 If there is no previous entity, it calls function registered in
1616 variable `mime-preview-over-to-next-method-alist'."
1618 (while (and (not (eobp))
1619 (null (get-text-property (point) 'mime-view-entity)))
1622 (let ((point (next-single-property-change (point) 'mime-view-entity)))
1624 (<= point (point-max)))
1627 (if (null (get-text-property point 'mime-view-entity))
1628 (mime-preview-move-to-next)
1630 (or (eq mime-preview-move-scroll t)
1631 (and mime-preview-move-scroll
1634 (move-to-window-line -1)
1636 (* -1 next-screen-context-lines))
1639 (recenter next-screen-context-lines))
1641 (let ((f (assq (mime-preview-original-major-mode)
1642 mime-preview-over-to-next-method-alist)))
1648 (defun mime-preview-scroll-up-entity (&optional h)
1649 "Scroll up current entity.
1650 If reached to (point-max), it calls function registered in variable
1651 `mime-preview-over-to-next-method-alist'."
1654 (let ((f (assq (mime-preview-original-major-mode)
1655 mime-preview-over-to-next-method-alist)))
1660 (or (next-single-property-change (point) 'mime-view-entity)
1662 (bottom (window-end (selected-window))))
1665 (progn (goto-char point)
1666 (recenter next-screen-context-lines))
1670 (goto-char (point-max)))))
1673 (defun mime-preview-scroll-down-entity (&optional h)
1674 "Scroll down current entity.
1675 If reached to (point-min), it calls function registered in variable
1676 `mime-preview-over-to-previous-method-alist'."
1679 (let ((f (assq (mime-preview-original-major-mode)
1680 mime-preview-over-to-previous-method-alist)))
1685 (or (previous-single-property-change (point) 'mime-view-entity)
1687 (top (window-start (selected-window))))
1690 (progn (goto-char point)
1691 (recenter (* -1 next-screen-context-lines)))
1694 (beginning-of-buffer
1695 (goto-char (point-min)))))
1698 (defun mime-preview-next-line-entity (&optional lines)
1699 "Scroll up one line (or prefix LINES lines).
1700 If LINES is negative, scroll down LINES lines."
1702 (mime-preview-scroll-up-entity (or lines 1))
1705 (defun mime-preview-previous-line-entity (&optional lines)
1706 "Scrroll down one line (or prefix LINES lines).
1707 If LINES is negative, scroll up LINES lines."
1709 (mime-preview-scroll-down-entity (or lines 1))
1716 (defun mime-preview-toggle-display (type &optional display)
1717 (let ((situation (mime-preview-find-boundary-info))
1718 (sym (intern (concat "*" (symbol-name type))))
1720 (setq p-beg (aref situation 0)
1721 p-end (aref situation 1)
1722 entity (aref situation 2)
1723 situation (get-text-property p-beg 'mime-view-situation))
1724 (cond ((eq display 'invisible)
1729 (eq (cdr (or (assq sym situation)
1730 (assq type situation)))
1732 (setq situation (put-alist sym (if display
1737 (let ((inhibit-read-only t))
1738 (delete-region p-beg p-end)
1739 (mime-display-entity entity situation)))
1740 (let ((ret (assoc situation mime-preview-situation-example-list)))
1742 (setcdr ret (1+ (cdr ret)))
1743 (add-to-list 'mime-preview-situation-example-list
1744 (cons situation 0))))))
1746 (defun mime-preview-toggle-header (&optional force-visible)
1748 (mime-preview-toggle-display 'header force-visible))
1750 (defun mime-preview-toggle-content (&optional force-visible)
1752 (mime-preview-toggle-display 'body force-visible))
1754 (defun mime-preview-show-header ()
1756 (mime-preview-toggle-display 'header 'visible))
1758 (defun mime-preview-show-content ()
1760 (mime-preview-toggle-display 'body 'visible))
1762 (defun mime-preview-hide-header ()
1764 (mime-preview-toggle-display 'header 'invisible))
1766 (defun mime-preview-hide-content ()
1768 (mime-preview-toggle-display 'body 'invisible))
1774 (defun mime-preview-quit ()
1775 "Quit from MIME-preview buffer.
1776 It calls function registered in variable
1777 `mime-preview-quitting-method-alist'."
1779 (let ((r (assq (mime-preview-original-major-mode)
1780 mime-preview-quitting-method-alist)))
1785 (defun mime-preview-kill-buffer ()
1787 (kill-buffer (current-buffer))
1794 (provide 'mime-view)
1796 (let ((file mime-situation-examples-file))
1797 (if (file-readable-p file)
1799 (insert-file-contents file)
1800 (setq mime-situation-examples-file-coding-system
1802 ((boundp 'buffer-file-coding-system)
1803 (symbol-value 'buffer-file-coding-system))
1804 ((boundp 'file-coding-system)
1805 (symbol-value 'file-coding-system))
1811 (while (and (> (length mime-preview-situation-example-list)
1812 mime-preview-situation-example-list-max-size)
1814 (setq mime-preview-situation-example-list
1815 (mime-reduce-situation-examples
1816 mime-preview-situation-example-list))
1818 (error (setq mime-preview-situation-example-list nil)))
1819 ;; (let ((rest mime-preview-situation-example-list))
1821 ;; (ctree-set-calist-strictly 'mime-preview-condition
1823 ;; (setq rest (cdr rest))))
1826 (while (and (> (length mime-acting-situation-example-list)
1827 mime-acting-situation-example-list-max-size)
1829 (setq mime-acting-situation-example-list
1830 (mime-reduce-situation-examples
1831 mime-acting-situation-example-list))
1833 (error (setq mime-acting-situation-example-list nil))))))
1835 ;;; mime-view.el ends here