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.
40 (defconst mime-view-version
41 (concat (mime-product-name mime-user-interface-product) " MIME-View "
42 (mapconcat #'number-to-string
43 (mime-product-version mime-user-interface-product) ".")
44 " (" (mime-product-code-name mime-user-interface-product) ")"))
50 (defgroup mime-view nil
54 (defcustom mime-situation-examples-file "~/.mime-example"
55 "*File name of situation-examples demonstrated by user."
59 (defcustom mime-preview-move-scroll nil
60 "*Decides whether to scroll when moving to next entity.
61 When t, scroll the buffer. Non-nil but not t means scroll when
62 the next entity is within next-screen-context-lines from top or
63 buttom. Nil means don't scroll at all."
65 :type '(choice (const :tag "Off" nil)
67 (sexp :tag "Situation" 1)))
70 ;;; @ in raw-buffer (representation space)
73 (defvar mime-preview-buffer nil
74 "MIME-preview buffer corresponding with the (raw) buffer.")
75 (make-variable-buffer-local 'mime-preview-buffer)
78 (defvar mime-raw-representation-type-alist
79 '((mime-show-message-mode . binary)
80 (mime-temp-message-mode . binary)
82 "Alist of major-mode vs. representation-type of mime-raw-buffer.
83 Each element looks like (SYMBOL . REPRESENTATION-TYPE). SYMBOL is
84 major-mode or t. t means default. REPRESENTATION-TYPE must be
85 `binary' or `cooked'.")
88 ;;; @ in preview-buffer (presentation space)
91 (defvar mime-mother-buffer nil
92 "Mother buffer corresponding with the (MIME-preview) buffer.
93 If current MIME-preview buffer is generated by other buffer, such as
94 message/partial, it is called `mother-buffer'.")
95 (make-variable-buffer-local 'mime-mother-buffer)
97 ;; (defvar mime-raw-buffer nil
98 ;; "Raw buffer corresponding with the (MIME-preview) buffer.")
99 ;; (make-variable-buffer-local 'mime-raw-buffer)
101 (defvar mime-preview-original-window-configuration nil
102 "Window-configuration before mime-view-mode is called.")
103 (make-variable-buffer-local 'mime-preview-original-window-configuration)
105 (defun mime-preview-original-major-mode (&optional recursive point)
106 "Return major-mode of original buffer.
107 If optional argument RECURSIVE is non-nil and current buffer has
108 mime-mother-buffer, it returns original major-mode of the
110 (if (and recursive mime-mother-buffer)
112 (set-buffer mime-mother-buffer)
113 (mime-preview-original-major-mode recursive))
114 (cdr (assq 'major-mode
115 (get-text-property (or point
116 (if (> (point) (buffer-size))
117 (max (1- (point-max)) (point-min))
119 'mime-view-situation)))))
122 ;;; @ entity information
125 (defun mime-entity-situation (entity &optional situation)
126 "Return situation of ENTITY."
127 (let (rest param name)
129 (unless (assq 'type situation)
130 (setq rest (or (mime-entity-content-type entity)
131 (make-mime-content-type 'text 'plain))
132 situation (cons (car rest) situation)
134 (unless (assq 'subtype situation)
136 (setq rest (or (cdr (mime-entity-content-type entity))
137 '((subtype . plain)))))
138 (setq situation (cons (car rest) situation)
141 (setq param (car rest))
142 (or (assoc (car param) situation)
143 (setq situation (cons param situation)))
144 (setq rest (cdr rest)))
146 ;; Content-Disposition
148 (unless (assq 'disposition-type situation)
149 (setq rest (mime-entity-content-disposition entity))
151 (setq situation (cons (cons 'disposition-type
152 (mime-content-disposition-type rest))
154 rest (mime-content-disposition-parameters rest))))
156 (setq param (car rest)
158 (if (cond ((string= name "filename")
159 (if (assq 'filename situation)
161 (setq name 'filename)))
162 ((string= name "creation-date")
163 (if (assq 'creation-date situation)
165 (setq name 'creation-date)))
166 ((string= name "modification-date")
167 (if (assq 'modification-date situation)
169 (setq name 'modification-date)))
170 ((string= name "read-date")
171 (if (assq 'read-date situation)
173 (setq name 'read-date)))
174 ((string= name "size")
175 (if (assq 'size situation)
178 (t (setq name (cons 'disposition name))
179 (if (assoc name situation)
183 (cons (cons name (cdr param))
185 (setq rest (cdr rest)))
187 ;; Content-Transfer-Encoding
188 (or (assq 'encoding situation)
190 (cons (cons 'encoding (or (mime-entity-encoding entity)
196 (defsubst mime-delq-null-situation (situations field
197 &rest ignored-values)
200 (let* ((situation (car situations))
201 (cell (assq field situation)))
203 (or (memq (cdr cell) ignored-values)
204 (setq dest (cons situation dest)))))
205 (setq situations (cdr situations)))
208 (defun mime-compare-situation-with-example (situation example)
209 (let ((example (copy-alist example))
212 (let* ((cell (car situation))
214 (ecell (assoc key example)))
216 (if (equal cell ecell)
217 (setq match (1+ match))
218 (setq example (delq ecell example)))))
219 (setq situation (cdr situation)))
220 (cons match example)))
222 (defun mime-sort-situation (situation)
232 (disposition-type . 6)))
235 (let ((ret (assq a-t order)))
237 (setq a-order (cdr ret))
241 (let ((ret (assq b-t order)))
243 (setq b-order (cdr ret))
246 (if (= a-order b-order)
247 (string< (format "%s" a-t)(format "%s" b-t))
248 (< a-order b-order))))))
250 (defun mime-unify-situations (entity-situation
251 condition situation-examples
252 &optional required-name ignored-value
255 (in-calist-package 'mime-view)
257 (ctree-find-calist condition entity-situation
260 (setq ret (mime-delq-null-situation ret required-name
262 (or (assq 'ignore-examples entity-situation)
270 (let ((situation (car rest))
271 (examples situation-examples))
274 (mime-compare-situation-with-example
275 situation (caar examples)))
276 (ret-score (car ret)))
277 (cond ((> ret-score max-score)
278 (setq max-score ret-score
279 max-escore (cdar examples)
280 max-examples (list (cdr ret))
281 max-situations (list situation)))
282 ((= ret-score max-score)
283 (cond ((> (cdar examples) max-escore)
284 (setq max-escore (cdar examples)
285 max-examples (list (cdr ret))
286 max-situations (list situation)))
287 ((= (cdar examples) max-escore)
289 (cons (cdr ret) max-examples))
290 (or (member situation max-situations)
292 (cons situation max-situations))))))))
293 (setq examples (cdr examples))))
294 (setq rest (cdr rest)))
296 (setq ret max-situations)
298 (let* ((example (car max-examples))
300 (assoc example situation-examples)))
302 (setcdr cell (1+ (cdr cell)))
303 (setq situation-examples
304 (cons (cons example 0)
305 situation-examples))))
306 (setq max-examples (cdr max-examples)))))))
307 (cons ret situation-examples)
308 ;; ret: list of situations
309 ;; situation-examples: new examples (notoce that contents of
310 ;; argument `situation-examples' has bees modified)
313 (defun mime-view-entity-title (entity)
314 (or (mime-entity-read-field entity 'Content-Description)
315 (mime-entity-read-field entity 'Subject)
316 (mime-entity-filename entity)
319 (defvar mime-preview-situation-example-list nil)
320 (defvar mime-preview-situation-example-list-max-size 16)
321 ;; (defvar mime-preview-situation-example-condition nil)
323 (defun mime-find-entity-preview-situation (entity
324 &optional default-situation)
326 (mime-unify-situations
327 (append (mime-entity-situation entity)
329 mime-preview-condition
330 mime-preview-situation-example-list)))
331 (setq mime-preview-situation-example-list
337 (defvar mime-acting-situation-example-list nil)
338 (defvar mime-acting-situation-example-list-max-size 16)
339 (defvar mime-situation-examples-file-coding-system nil)
341 (defun mime-save-situation-examples ()
342 (if (or mime-preview-situation-example-list
343 mime-acting-situation-example-list)
344 (let ((file mime-situation-examples-file))
346 (insert ";;; " (file-name-nondirectory file) "\n")
347 (insert "\n;; This file is generated automatically by "
348 mime-view-version "\n\n")
349 (insert ";;; Code:\n\n")
350 (if mime-preview-situation-example-list
351 (pp `(setq mime-preview-situation-example-list
352 ',mime-preview-situation-example-list)
354 (if mime-acting-situation-example-list
355 (pp `(setq mime-acting-situation-example-list
356 ',mime-acting-situation-example-list)
359 (file-name-nondirectory file)
361 (setq buffer-file-coding-system
362 mime-situation-examples-file-coding-system)
364 ;; ((boundp 'buffer-file-coding-system)
365 ;; (setq buffer-file-coding-system
366 ;; mime-situation-examples-file-coding-system))
367 ;; ((boundp 'file-coding-system)
368 ;; (setq file-coding-system
369 ;; mime-situation-examples-file-coding-system)))
370 (setq buffer-file-name file)
373 (add-hook 'kill-emacs-hook 'mime-save-situation-examples)
375 (defun mime-reduce-situation-examples (situation-examples)
376 (let ((len (length situation-examples))
384 ir situation-examples)
388 jr situation-examples)
392 (setq ret (mime-compare-situation-with-example (car ic)(car jc))
394 det-ret (+ (length (car ic))(length (car jc)))
395 det-org (length (cdr ret))
396 freq (+ (cdr ic)(cdr jc)))
397 (cond ((< max-sim sim)
404 dest (cons (cdr ret) freq)))
406 (cond ((> min-det-ret det-ret)
407 (setq min-det-ret det-ret
412 dest (cons (cdr ret) freq)))
413 ((= min-det-ret det-ret)
414 (cond ((> min-det-org det-org)
415 (setq min-det-org det-org
419 dest (cons (cdr ret) freq)))
420 ((= min-det-org det-org)
421 (cond ((> min-freq freq)
425 dest (cons (cdr ret) freq)))))))))))
434 (setq jr (nthcdr (1- d-j) situation-examples))
435 (setcdr jr (cddr jr))
437 (setq situation-examples
438 (cdr situation-examples))
439 (setq ir (nthcdr (1- d-i) situation-examples))
440 (setcdr ir (cddr ir)))
441 (if (setq ir (assoc (car dest) situation-examples))
443 (setcdr ir (+ (cdr ir)(cdr dest)))
445 (cons dest situation-examples)
446 ;; situation-examples may be modified.
450 ;;; @ presentation of preview
456 ;;; @@@ predicate function
459 ;; (defun mime-view-entity-button-visible-p (entity)
460 ;; "Return non-nil if header of ENTITY is visible.
461 ;; Please redefine this function if you want to change default setting."
462 ;; (let ((media-type (mime-entity-media-type entity))
463 ;; (media-subtype (mime-entity-media-subtype entity)))
464 ;; (or (not (eq media-type 'application))
465 ;; (and (not (eq media-subtype 'x-selection))
466 ;; (or (not (eq media-subtype 'octet-stream))
467 ;; (let ((mother-entity (mime-entity-parent entity)))
468 ;; (or (not (eq (mime-entity-media-type mother-entity)
470 ;; (not (eq (mime-entity-media-subtype mother-entity)
475 ;;; @@@ entity button generator
478 (defun mime-view-insert-entity-button (entity)
479 "Insert entity-button of ENTITY."
480 (let ((entity-node-id (mime-entity-node-id entity))
481 (params (mime-entity-parameters entity))
482 (subject (mime-view-entity-title entity)))
484 (let ((access-type (assoc "access-type" params))
485 (num (or (cdr (assoc "x-part-number" params))
486 (if (consp entity-node-id)
489 (format "%s" (1+ num))))
490 (reverse entity-node-id) ".")
493 (let ((server (assoc "server" params)))
494 (setq access-type (cdr access-type))
496 (format "%s %s ([%s] %s)"
497 num subject access-type (cdr server))
498 (let ((site (cdr (assoc "site" params)))
499 (dir (cdr (assoc "directory" params)))
500 (url (cdr (assoc "url" params))))
502 (format "%s %s ([%s] %s)"
503 num subject access-type url)
504 (format "%s %s ([%s] %s:%s)"
505 num subject access-type site dir))))))
507 (let ((media-type (mime-entity-media-type entity))
508 (media-subtype (mime-entity-media-subtype entity))
509 (charset (cdr (assoc "charset" params)))
510 (encoding (mime-entity-encoding entity)))
514 (format " <%s/%s%s%s>"
515 media-type media-subtype
517 (concat "; " charset)
520 (concat " (" encoding ")")
522 (if (>= (+ (current-column)(length rest))(window-width))
525 (function mime-preview-play-current-entity))))
531 (defvar mime-header-presentation-method-alist nil
532 "Alist of major mode vs. corresponding header-presentation-method functions.
533 Each element looks like (SYMBOL . FUNCTION).
534 SYMBOL must be major mode in raw-buffer or t. t means default.
535 Interface of FUNCTION must be (ENTITY SITUATION).")
537 (defvar mime-view-ignored-field-list
538 '(".*Received:" ".*Path:" ".*Id:" "^References:"
539 "^Replied:" "^Errors-To:"
540 "^Lines:" "^Sender:" ".*Host:" "^Xref:"
541 "^Content-Type:" "^Precedence:"
542 "^Status:" "^X-VM-.*:")
543 "All fields that match this list will be hidden in MIME preview buffer.
544 Each elements are regexp of field-name.")
546 (defvar mime-view-visible-field-list '("^Dnas.*:" "^Message-Id:")
547 "All fields that match this list will be displayed in MIME preview buffer.
548 Each elements are regexp of field-name.")
554 ;;; @@@ predicate function
557 (in-calist-package 'mime-view)
559 (defun mime-calist::field-match-method-as-default-rule (calist
560 field-type field-value)
561 (let ((s-field (assq field-type calist)))
562 (cond ((null s-field)
563 (cons (cons field-type field-value) calist))
566 (define-calist-field-match-method
567 'header #'mime-calist::field-match-method-as-default-rule)
569 (define-calist-field-match-method
570 'body #'mime-calist::field-match-method-as-default-rule)
573 (defvar mime-preview-condition nil
574 "Condition-tree about how to display entity.")
576 (ctree-set-calist-strictly
577 'mime-preview-condition '((type . application)(subtype . octet-stream)
580 (ctree-set-calist-strictly
581 'mime-preview-condition '((type . application)(subtype . octet-stream)
584 (ctree-set-calist-strictly
585 'mime-preview-condition '((type . application)(subtype . octet-stream)
589 (ctree-set-calist-strictly
590 'mime-preview-condition '((type . application)(subtype . pgp)
593 (ctree-set-calist-strictly
594 'mime-preview-condition '((type . application)(subtype . x-latex)
597 (ctree-set-calist-strictly
598 'mime-preview-condition '((type . application)(subtype . x-selection)
601 (ctree-set-calist-strictly
602 'mime-preview-condition '((type . application)(subtype . x-comment)
605 (ctree-set-calist-strictly
606 'mime-preview-condition '((type . message)(subtype . delivery-status)
609 (ctree-set-calist-strictly
610 'mime-preview-condition
612 (body-presentation-method . mime-display-text/plain)))
614 (defvar mime-preview-fill-flowed-text
615 (module-installed-p 'flow-fill)
616 "If non-nil, fill RFC2646 \"flowed\" text.")
618 (autoload 'fill-flowed "flow-fill")
620 (ctree-set-calist-strictly
621 'mime-preview-condition
624 (body-presentation-method . mime-display-text/plain)))
626 (ctree-set-calist-strictly
627 'mime-preview-condition
628 '((type . text)(subtype . enriched)
630 (body-presentation-method . mime-display-text/enriched)))
632 (ctree-set-calist-strictly
633 'mime-preview-condition
634 '((type . text)(subtype . richtext)
636 (body-presentation-method . mime-display-text/richtext)))
638 (autoload 'mime-display-application/x-postpet "postpet")
640 (ctree-set-calist-strictly
641 'mime-preview-condition
642 '((type . application)(subtype . x-postpet)
644 (body-presentation-method . mime-display-application/x-postpet)))
646 (ctree-set-calist-strictly
647 'mime-preview-condition
648 '((type . text)(subtype . t)
650 (body-presentation-method . mime-display-text/plain)))
652 (ctree-set-calist-strictly
653 'mime-preview-condition
654 '((type . multipart)(subtype . alternative)
656 (body-presentation-method . mime-display-multipart/alternative)))
658 (ctree-set-calist-strictly
659 'mime-preview-condition
660 '((type . multipart)(subtype . t)
662 (body-presentation-method . mime-display-multipart/mixed)))
664 (ctree-set-calist-strictly
665 'mime-preview-condition
666 '((type . message)(subtype . partial)
668 (body-presentation-method . mime-display-message/partial-button)))
670 (ctree-set-calist-strictly
671 'mime-preview-condition
672 '((type . message)(subtype . rfc822)
674 (body-presentation-method . mime-display-multipart/mixed)
675 (childrens-situation (header . visible)
676 (entity-button . invisible))))
678 (ctree-set-calist-strictly
679 'mime-preview-condition
680 '((type . message)(subtype . news)
682 (body-presentation-method . mime-display-multipart/mixed)
683 (childrens-situation (header . visible)
684 (entity-button . invisible))))
687 ;;; @@@ entity presentation
690 (defun mime-display-text/plain (entity situation)
692 (narrow-to-region (point-max)(point-max))
694 (mime-insert-text-content entity)
696 (message "Can't decode current entity.")
698 (run-hooks 'mime-text-decode-hook)
699 (goto-char (point-max))
700 (if (not (eq (char-after (1- (point))) ?\n))
702 (if (and mime-preview-fill-flowed-text
703 (equal (cdr (assoc "format" situation)) "flowed"))
705 (mime-add-url-buttons)
706 (run-hooks 'mime-display-text/plain-hook)))
708 (defun mime-display-text/richtext (entity situation)
710 (narrow-to-region (point-max)(point-max))
711 (mime-insert-text-content entity)
712 (run-hooks 'mime-text-decode-hook)
713 (let ((beg (point-min)))
714 (remove-text-properties beg (point-max) '(face nil))
715 (richtext-decode beg (point-max)))))
717 (defun mime-display-text/enriched (entity situation)
719 (narrow-to-region (point-max)(point-max))
720 (mime-insert-text-content entity)
721 (run-hooks 'mime-text-decode-hook)
722 (let ((beg (point-min)))
723 (remove-text-properties beg (point-max) '(face nil))
724 (enriched-decode beg (point-max)))))
726 (defvar mime-view-announcement-for-message/partial
727 (if (and (>= emacs-major-version 19) window-system)
729 \[[ This is message/partial style split message. ]]
730 \[[ Please press `v' key in this buffer ]]
731 \[[ or click here by mouse button-2. ]]"
733 \[[ This is message/partial style split message. ]]
734 \[[ Please press `v' key in this buffer. ]]"))
736 (defun mime-display-message/partial-button (&optional entity situation)
738 (goto-char (point-max))
739 (if (not (search-backward "\n\n" nil t))
741 (goto-char (point-max))
742 (narrow-to-region (point-max)(point-max))
743 (insert mime-view-announcement-for-message/partial)
744 (mime-add-button (point-min)(point-max)
745 #'mime-preview-play-current-entity)))
747 (defun mime-display-multipart/mixed (entity situation)
748 (let ((children (mime-entity-children entity))
749 (original-major-mode-cell (assq 'major-mode situation))
751 (cdr (assq 'childrens-situation situation))))
752 (if original-major-mode-cell
753 (setq default-situation
754 (cons original-major-mode-cell default-situation)))
756 (mime-display-entity (car children) nil default-situation)
757 (setq children (cdr children)))))
759 (defcustom mime-view-type-subtype-score-alist
760 '(((text . enriched) . 3)
761 ((text . richtext) . 2)
764 "Alist MEDIA-TYPE vs corresponding score.
765 MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t. t means default."
767 :type '(repeat (cons (choice :tag "Media-Type"
768 (cons :tag "Type/Subtype"
769 (symbol :tag "Primary-type")
770 (symbol :tag "Subtype"))
772 (const :tag "Default" t))
775 (defun mime-display-multipart/alternative (entity situation)
776 (let* ((children (mime-entity-children entity))
777 (original-major-mode-cell (assq 'major-mode situation))
779 (cdr (assq 'childrens-situation situation)))
784 (if original-major-mode-cell
785 (setq default-situation
786 (cons original-major-mode-cell default-situation)))
791 (mime-find-entity-preview-situation
792 child default-situation)))
793 (if (cdr (assq 'body-presentation-method situation))
798 (cdr (assq 'type situation))
799 (cdr (assq 'subtype situation)))
800 mime-view-type-subtype-score-alist)
802 (cdr (assq 'type situation))
803 mime-view-type-subtype-score-alist)
806 mime-view-type-subtype-score-alist)))))
807 (if (> score max-score)
815 (let ((child (car children))
816 (situation (car situations)))
817 (mime-display-entity child (if (= i p)
819 (put-alist 'body 'invisible
820 (copy-alist situation)))))
821 (setq children (cdr children)
822 situations (cdr situations)
826 ;;; @ acting-condition
829 (defvar mime-acting-condition nil
830 "Condition-tree about how to process entity.")
832 (if (file-readable-p mime-mailcap-file)
833 (let ((entries (mime-parse-mailcap-file)))
835 (let ((entry (car entries))
838 (let* ((field (car entry))
839 (field-type (car field)))
840 (cond ((eq field-type 'view) (setq view field))
841 ((eq field-type 'print) (setq print field))
842 ((memq field-type '(compose composetyped edit)))
843 (t (setq shared (cons field shared)))))
844 (setq entry (cdr entry)))
845 (setq shared (nreverse shared))
846 (ctree-set-calist-with-default
847 'mime-acting-condition
848 (append shared (list '(mode . "play")(cons 'method (cdr view)))))
850 (ctree-set-calist-with-default
851 'mime-acting-condition
853 (list '(mode . "print")(cons 'method (cdr view)))))))
854 (setq entries (cdr entries)))))
856 (ctree-set-calist-strictly
857 'mime-acting-condition
858 '((type . application)(subtype . octet-stream)
860 (method . mime-detect-content)))
862 (ctree-set-calist-with-default
863 'mime-acting-condition
865 (method . mime-save-content)))
867 (ctree-set-calist-strictly
868 'mime-acting-condition
869 '((type . text)(subtype . x-rot13-47)(mode . "play")
870 (method . mime-view-caesar)))
871 (ctree-set-calist-strictly
872 'mime-acting-condition
873 '((type . text)(subtype . x-rot13-47-48)(mode . "play")
874 (method . mime-view-caesar)))
876 (ctree-set-calist-strictly
877 'mime-acting-condition
878 '((type . message)(subtype . rfc822)(mode . "play")
879 (method . mime-view-message/rfc822)))
880 (ctree-set-calist-strictly
881 'mime-acting-condition
882 '((type . message)(subtype . partial)(mode . "play")
883 (method . mime-store-message/partial-piece)))
885 (ctree-set-calist-strictly
886 'mime-acting-condition
887 '((type . message)(subtype . external-body)
888 ("access-type" . "anon-ftp")
889 (method . mime-view-message/external-anon-ftp)))
891 (ctree-set-calist-strictly
892 'mime-acting-condition
893 '((type . message)(subtype . external-body)
894 ("access-type" . "url")
895 (method . mime-view-message/external-url)))
897 (ctree-set-calist-strictly
898 'mime-acting-condition
899 '((type . application)(subtype . octet-stream)
900 (method . mime-save-content)))
903 ;;; @ quitting method
906 (defvar mime-preview-quitting-method-alist
907 '((mime-show-message-mode
908 . mime-preview-quitting-method-for-mime-show-message-mode))
909 "Alist of major-mode vs. quitting-method of mime-view.")
911 (defvar mime-preview-over-to-previous-method-alist nil
912 "Alist of major-mode vs. over-to-previous-method of mime-view.")
914 (defvar mime-preview-over-to-next-method-alist nil
915 "Alist of major-mode vs. over-to-next-method of mime-view.")
918 ;;; @ following method
921 (defvar mime-preview-following-method-alist nil
922 "Alist of major-mode vs. following-method of mime-view.")
924 (defvar mime-view-following-required-fields-list
931 (defun mime-display-entity (entity &optional situation
932 default-situation preview-buffer)
934 (setq preview-buffer (current-buffer)))
935 (let* (e nb ne nhb nbb)
936 (in-calist-package 'mime-view)
939 (mime-find-entity-preview-situation entity default-situation)))
940 (let ((button-is-invisible
941 (eq (cdr (or (assq '*entity-button situation)
942 (assq 'entity-button situation)))
945 (eq (cdr (or (assq '*header situation)
946 (assq 'header situation)))
949 (eq (cdr (or (assq '*body situation)
950 (assq 'body situation)))
952 (children (mime-entity-children entity)))
953 (set-buffer preview-buffer)
955 (narrow-to-region nb nb)
956 (or button-is-invisible
957 ;; (if (mime-view-entity-button-visible-p entity)
958 (mime-view-insert-entity-button entity)
961 (if header-is-visible
962 (let ((header-presentation-method
963 (or (cdr (assq 'header-presentation-method situation))
964 (cdr (assq (cdr (assq 'major-mode situation))
965 mime-header-presentation-method-alist)))))
967 (if header-presentation-method
968 (funcall header-presentation-method entity situation)
969 (mime-insert-header entity
970 mime-view-ignored-field-list
971 mime-view-visible-field-list))
972 (mime-add-url-buttons)
973 (run-hooks 'mime-display-header-hook)
974 (put-text-property nhb (point-max) 'mime-view-entity-header entity)
975 (goto-char (point-max))
980 (let ((body-presentation-method
981 (cdr (assq 'body-presentation-method situation))))
982 (if (functionp body-presentation-method)
983 (funcall body-presentation-method entity situation)
984 (mime-display-text/plain entity situation)))
985 (when button-is-invisible
986 (goto-char (point-max))
987 (mime-view-insert-entity-button entity))
988 (unless header-is-visible
989 (goto-char (point-max))
991 (setq ne (point-max))
993 (put-text-property nb ne 'mime-view-entity entity)
994 (put-text-property nb ne 'mime-view-situation situation)
995 (put-text-property nbb ne 'mime-view-entity-body entity)
997 (if (and children body-is-visible)
998 (let ((body-presentation-method
999 (cdr (assq 'body-presentation-method situation))))
1000 (if (functionp body-presentation-method)
1001 (funcall body-presentation-method entity situation)
1002 (mime-display-multipart/mixed entity situation)))))))
1005 ;;; @ MIME viewer mode
1008 (defconst mime-view-popup-menu-list
1010 ["Move to upper entity" mime-preview-move-to-upper]
1011 ["Move to previous entity" mime-preview-move-to-previous]
1012 ["Move to next entity" mime-preview-move-to-next]
1013 ["Scroll-down" mime-preview-scroll-down-entity]
1014 ["Scroll-up" mime-preview-scroll-up-entity]
1015 ["Play current entity" mime-preview-play-current-entity]
1016 ["Extract current entity" mime-preview-extract-current-entity]
1017 ["Print current entity" mime-preview-print-current-entity])
1018 "Menu for MIME Viewer")
1020 (defun mime-view-popup-menu (event)
1021 "Popup the menu in the MIME Viewer buffer"
1023 (mime-popup-menu-popup mime-view-popup-menu-list event))
1025 ;;; The current local map is taken precendence over `widget-keymap',
1026 ;;; because GNU Emacs' widget implementation doesn't set `local-map' property.
1027 ;;; So we need to specify derivation.
1028 (defvar widget-keymap)
1029 (defun mime-view-maybe-inherit-widget-keymap ()
1030 (when (boundp 'widget-keymap)
1031 (set-keymap-parent (current-local-map) widget-keymap)))
1033 (add-hook 'mime-view-define-keymap-hook 'mime-view-maybe-inherit-widget-keymap)
1035 (defun mime-view-define-keymap (&optional default)
1036 (let ((mime-view-mode-map (if (keymapp default)
1037 (copy-keymap default)
1038 (make-sparse-keymap))))
1039 (define-key mime-view-mode-map
1040 "u" (function mime-preview-move-to-upper))
1041 (define-key mime-view-mode-map
1042 "p" (function mime-preview-move-to-previous))
1043 (define-key mime-view-mode-map
1044 "n" (function mime-preview-move-to-next))
1045 (define-key mime-view-mode-map
1046 "\e\t" (function mime-preview-move-to-previous))
1047 (define-key mime-view-mode-map
1048 "\t" (function mime-preview-move-to-next))
1049 (define-key mime-view-mode-map
1050 " " (function mime-preview-scroll-up-entity))
1051 (define-key mime-view-mode-map
1052 "\M- " (function mime-preview-scroll-down-entity))
1053 (define-key mime-view-mode-map
1054 "\177" (function mime-preview-scroll-down-entity))
1055 (define-key mime-view-mode-map
1056 "\C-m" (function mime-preview-next-line-entity))
1057 (define-key mime-view-mode-map
1058 "\C-\M-m" (function mime-preview-previous-line-entity))
1059 (define-key mime-view-mode-map
1060 "v" (function mime-preview-play-current-entity))
1061 (define-key mime-view-mode-map
1062 "e" (function mime-preview-extract-current-entity))
1063 (define-key mime-view-mode-map
1064 "\C-c\C-p" (function mime-preview-print-current-entity))
1066 (define-key mime-view-mode-map
1067 "\C-c\C-t\C-f" (function mime-preview-toggle-header))
1068 (define-key mime-view-mode-map
1069 "\C-c\C-th" (function mime-preview-toggle-header))
1070 (define-key mime-view-mode-map
1071 "\C-c\C-t\C-c" (function mime-preview-toggle-content))
1073 (define-key mime-view-mode-map
1074 "\C-c\C-v\C-f" (function mime-preview-show-header))
1075 (define-key mime-view-mode-map
1076 "\C-c\C-vh" (function mime-preview-show-header))
1077 (define-key mime-view-mode-map
1078 "\C-c\C-v\C-c" (function mime-preview-show-content))
1080 (define-key mime-view-mode-map
1081 "\C-c\C-d\C-f" (function mime-preview-hide-header))
1082 (define-key mime-view-mode-map
1083 "\C-c\C-dh" (function mime-preview-hide-header))
1084 (define-key mime-view-mode-map
1085 "\C-c\C-d\C-c" (function mime-preview-hide-content))
1087 (define-key mime-view-mode-map
1088 "a" (function mime-preview-follow-current-entity))
1089 (define-key mime-view-mode-map
1090 "q" (function mime-preview-quit))
1091 (define-key mime-view-mode-map
1092 "\C-c\C-x" (function mime-preview-kill-buffer))
1093 ;; (define-key mime-view-mode-map
1094 ;; "<" (function beginning-of-buffer))
1095 ;; (define-key mime-view-mode-map
1096 ;; ">" (function end-of-buffer))
1097 (define-key mime-view-mode-map
1098 "?" (function describe-mode))
1099 (define-key mime-view-mode-map
1100 [tab] (function mime-preview-move-to-next))
1101 (define-key mime-view-mode-map
1102 [delete] (function mime-preview-scroll-down-entity))
1103 (define-key mime-view-mode-map
1104 [backspace] (function mime-preview-scroll-down-entity))
1105 (if (functionp default)
1106 (if (featurep 'xemacs)
1107 (set-keymap-default-binding mime-view-mode-map default)
1108 (setq mime-view-mode-map
1109 (append mime-view-mode-map (list (cons t default))))))
1110 (define-key mime-view-mode-map
1111 [down-mouse-3] (function mime-view-popup-menu))
1112 ;; (run-hooks 'mime-view-define-keymap-hook)
1113 mime-view-mode-map))
1115 (defvar mime-view-mode-default-map (mime-view-define-keymap))
1118 (defsubst mime-maybe-hide-echo-buffer ()
1119 "Clear mime-echo buffer and delete window for it."
1120 (let ((buf (get-buffer mime-echo-buffer-name)))
1125 (let ((win (get-buffer-window buf)))
1127 (delete-window win)))
1128 (bury-buffer buf)))))
1130 (defvar mime-view-redisplay nil)
1133 (defun mime-display-message (message &optional preview-buffer
1134 mother default-keymap-or-function
1135 original-major-mode keymap)
1136 "View MESSAGE in MIME-View mode.
1138 Optional argument PREVIEW-BUFFER specifies the buffer of the
1139 presentation. It must be either nil or a name of preview buffer.
1141 Optional argument MOTHER specifies mother-buffer of the preview-buffer.
1143 Optional argument DEFAULT-KEYMAP-OR-FUNCTION is nil, keymap or
1144 function. If it is a keymap, keymap of MIME-View mode will be added
1145 to it. If it is a function, it will be bound as default binding of
1146 keymap of MIME-View mode.
1148 Optional argument ORIGINAL-MAJOR-MODE is major-mode of representation
1149 buffer of MESSAGE. If it is nil, current `major-mode' is used.
1151 Optional argument KEYMAP is keymap of MIME-View mode. If it is
1152 non-nil, DEFAULT-KEYMAP-OR-FUNCTION is ignored. If it is nil,
1153 `mime-view-mode-default-map' is used."
1154 (mime-maybe-hide-echo-buffer)
1155 (let ((win-conf (current-window-configuration)))
1157 (setq preview-buffer
1158 (concat "*Preview-" (mime-entity-name message) "*")))
1159 (or original-major-mode
1160 (setq original-major-mode major-mode))
1161 (let ((inhibit-read-only t))
1162 (set-buffer (get-buffer-create preview-buffer))
1166 (setq mime-mother-buffer mother))
1167 (setq mime-preview-original-window-configuration win-conf)
1168 (setq major-mode 'mime-view-mode)
1169 (setq mode-name "MIME-View")
1170 (mime-display-entity message nil
1171 `((entity-button . invisible)
1173 (major-mode . ,original-major-mode))
1177 (if default-keymap-or-function
1178 (mime-view-define-keymap default-keymap-or-function)
1179 mime-view-mode-default-map)))
1181 (next-single-property-change (point-min) 'mime-view-entity)))
1184 (goto-char (point-min))
1185 (search-forward "\n\n" nil t)))
1186 (run-hooks 'mime-view-mode-hook)
1187 (set-buffer-modified-p nil)
1188 (setq buffer-read-only t)
1192 (defun mime-view-buffer (&optional raw-buffer preview-buffer mother
1193 default-keymap-or-function
1194 representation-type)
1195 "View RAW-BUFFER in MIME-View mode.
1196 Optional argument PREVIEW-BUFFER is either nil or a name of preview
1198 Optional argument DEFAULT-KEYMAP-OR-FUNCTION is nil, keymap or
1199 function. If it is a keymap, keymap of MIME-View mode will be added
1200 to it. If it is a function, it will be bound as default binding of
1201 keymap of MIME-View mode.
1202 Optional argument REPRESENTATION-TYPE is representation-type of
1203 message. It must be nil, `binary' or `cooked'. If it is nil,
1204 `cooked' is used as default."
1207 (setq raw-buffer (current-buffer)))
1208 (or representation-type
1209 (setq representation-type
1211 (set-buffer raw-buffer)
1212 (cdr (or (assq major-mode mime-raw-representation-type-alist)
1213 (assq t mime-raw-representation-type-alist))))))
1214 (if (eq representation-type 'binary)
1215 (setq representation-type 'buffer))
1216 (setq preview-buffer (mime-display-message
1217 (mime-open-entity representation-type raw-buffer)
1218 preview-buffer mother default-keymap-or-function))
1219 (or (get-buffer-window preview-buffer)
1220 (let ((r-win (get-buffer-window raw-buffer)))
1222 (set-window-buffer r-win preview-buffer)
1223 (let ((m-win (and mother (get-buffer-window mother))))
1225 (set-window-buffer m-win preview-buffer)
1226 (switch-to-buffer preview-buffer)))))))
1228 (defun mime-view-mode (&optional mother ctl encoding
1229 raw-buffer preview-buffer
1230 default-keymap-or-function)
1231 "Major mode for viewing MIME message.
1233 Here is a list of the standard keys for mime-view-mode.
1238 u Move to upper content
1239 p or M-TAB Move to previous content
1240 n or TAB Move to next content
1241 SPC Scroll up or move to next content
1242 M-SPC or DEL Scroll down or move to previous content
1243 RET Move to next line
1244 M-RET Move to previous line
1245 v Decode current content as `play mode'
1246 e Decode current content as `extract mode'
1247 C-c C-p Decode current content as `print mode'
1248 a Followup to current content.
1250 button-2 Move to point under the mouse cursor
1251 and decode current content as `play mode'
1254 (unless mime-view-redisplay
1256 (if raw-buffer (set-buffer raw-buffer))
1259 (or (assq major-mode mime-raw-representation-type-alist)
1260 (assq t mime-raw-representation-type-alist)))))
1261 (if (eq type 'binary)
1262 (setq type 'buffer))
1263 (setq mime-message-structure (mime-open-entity type raw-buffer))
1264 (or (mime-entity-content-type mime-message-structure)
1265 (mime-entity-set-content-type mime-message-structure ctl)))
1266 (or (mime-entity-encoding mime-message-structure)
1267 (mime-entity-set-encoding mime-message-structure encoding))))
1268 (mime-display-message mime-message-structure preview-buffer
1269 mother default-keymap-or-function))
1275 (defun mime-preview-find-boundary-info (&optional get-mother)
1279 (while (null (setq entity
1280 (get-text-property (point) 'mime-view-entity)))
1282 (setq p-beg (previous-single-property-change (point) 'mime-view-entity))
1283 (setq entity-node-id (mime-entity-node-id entity))
1284 (setq len (length entity-node-id))
1287 (if (eq (next-single-property-change (point-min)
1292 ((eq (next-single-property-change p-beg 'mime-view-entity)
1294 (setq p-beg (point))))
1295 (setq p-end (next-single-property-change p-beg 'mime-view-entity))
1297 (setq p-end (point-max)))
1298 ((null entity-node-id)
1299 (setq p-end (point-max)))
1306 (next-single-property-change
1307 (point) 'mime-view-entity))
1309 (let ((rc (mime-entity-node-id
1310 (get-text-property (1- (point))
1311 'mime-view-entity))))
1312 (or (and (>= (setq i (- (length rc) len)) 0)
1313 (equal entity-node-id (nthcdr i rc)))
1316 (setq p-end (point-max))))))
1317 (vector p-beg p-end entity)))
1323 (autoload 'mime-preview-play-current-entity "mime-play"
1324 "Play current entity." t)
1326 (defun mime-preview-extract-current-entity (&optional ignore-examples)
1327 "Extract current entity into file (maybe).
1328 It decodes current entity to call internal or external method as
1329 \"extract\" mode. The method is selected from variable
1330 `mime-acting-condition'."
1332 (mime-preview-play-current-entity ignore-examples "extract"))
1334 (defun mime-preview-print-current-entity (&optional ignore-examples)
1335 "Print current entity (maybe).
1336 It decodes current entity to call internal or external method as
1337 \"print\" mode. The method is selected from variable
1338 `mime-acting-condition'."
1340 (mime-preview-play-current-entity ignore-examples "print"))
1346 (defun mime-preview-follow-current-entity ()
1347 "Write follow message to current entity.
1348 It calls following-method selected from variable
1349 `mime-preview-following-method-alist'."
1351 (let ((entity (mime-preview-find-boundary-info t))
1354 (setq p-beg (aref entity 0)
1355 p-end (aref entity 1)
1356 entity (aref entity 2))
1357 (if (get-text-property p-beg 'mime-view-entity-body)
1360 (next-single-property-change
1361 p-beg 'mime-view-entity-body nil
1362 (or (next-single-property-change p-beg 'mime-view-entity)
1364 (let* ((mode (mime-preview-original-major-mode 'recursive))
1365 (entity-node-id (mime-entity-node-id entity))
1367 (format "%s-%s" (buffer-name) (reverse entity-node-id)))
1369 (the-buf (current-buffer))
1372 (set-buffer (setq new-buf (get-buffer-create new-name)))
1375 (insert-buffer-substring the-buf pb-beg p-end)
1376 (goto-char (point-min))
1377 (let ((current-entity
1378 (if (and (eq (mime-entity-media-type entity) 'message)
1379 (eq (mime-entity-media-subtype entity) 'rfc822))
1380 (car (mime-entity-children entity))
1382 (while (and current-entity
1383 (if (and (eq (mime-entity-media-type
1384 current-entity) 'message)
1385 (eq (mime-entity-media-subtype
1386 current-entity) 'rfc822))
1388 (mime-insert-header current-entity fields)
1390 (setq fields (std11-collect-field-names)
1391 current-entity (mime-entity-parent current-entity))))
1392 (let ((rest mime-view-following-required-fields-list)
1395 (setq field-name (car rest))
1396 (or (std11-field-body field-name)
1399 (set-buffer the-buf)
1400 (let ((entity (when mime-mother-buffer
1401 (set-buffer mime-mother-buffer)
1402 (get-text-property (point)
1403 'mime-view-entity))))
1405 (null (setq ret (mime-entity-fetch-field
1406 entity field-name))))
1407 (setq entity (mime-entity-parent entity)))))
1409 (insert (concat field-name ": " ret "\n")))))
1410 (setq rest (cdr rest)))))
1411 (let ((f (cdr (assq mode mime-preview-following-method-alist))))
1416 "Sorry, following method for %s is not implemented yet."
1423 (defun mime-preview-move-to-upper ()
1424 "Move to upper entity.
1425 If there is no upper entity, call function `mime-preview-quit'."
1428 (while (null (setq cinfo
1429 (get-text-property (point) 'mime-view-entity)))
1431 (let ((r (mime-entity-parent cinfo))
1434 (while (setq point (previous-single-property-change
1435 (point) 'mime-view-entity))
1437 (when (eq r (get-text-property (point) 'mime-view-entity))
1438 (if (or (eq mime-preview-move-scroll t)
1439 (and mime-preview-move-scroll
1442 (move-to-window-line -1)
1443 (forward-line (* -1 next-screen-context-lines))
1446 (recenter next-screen-context-lines))
1448 (mime-preview-quit)))))
1450 (defun mime-preview-move-to-previous ()
1451 "Move to previous entity.
1452 If there is no previous entity, it calls function registered in
1453 variable `mime-preview-over-to-previous-method-alist'."
1455 (while (and (not (bobp))
1456 (null (get-text-property (point) 'mime-view-entity)))
1458 (let ((point (previous-single-property-change (point) 'mime-view-entity)))
1460 (>= point (point-min)))
1461 (if (get-text-property (1- point) 'mime-view-entity)
1462 (progn (goto-char point)
1464 (or (eq mime-preview-move-scroll t)
1465 (and mime-preview-move-scroll
1468 (move-to-window-line 0)
1469 (forward-line next-screen-context-lines)
1472 (recenter (* -1 next-screen-context-lines))))
1473 (goto-char (1- point))
1474 (mime-preview-move-to-previous))
1475 (let ((f (assq (mime-preview-original-major-mode)
1476 mime-preview-over-to-previous-method-alist)))
1478 (funcall (cdr f)))))))
1480 (defun mime-preview-move-to-next ()
1481 "Move to next entity.
1482 If there is no previous entity, it calls function registered in
1483 variable `mime-preview-over-to-next-method-alist'."
1485 (while (and (not (eobp))
1486 (null (get-text-property (point) 'mime-view-entity)))
1488 (let ((point (next-single-property-change (point) 'mime-view-entity)))
1490 (<= point (point-max)))
1493 (if (null (get-text-property point 'mime-view-entity))
1494 (mime-preview-move-to-next)
1496 (or (eq mime-preview-move-scroll t)
1497 (and mime-preview-move-scroll
1500 (move-to-window-line -1)
1502 (* -1 next-screen-context-lines))
1505 (recenter next-screen-context-lines))))
1506 (let ((f (assq (mime-preview-original-major-mode)
1507 mime-preview-over-to-next-method-alist)))
1509 (funcall (cdr f)))))))
1511 (defun mime-preview-scroll-up-entity (&optional h)
1512 "Scroll up current entity.
1513 If reached to (point-max), it calls function registered in variable
1514 `mime-preview-over-to-next-method-alist'."
1517 (let ((f (assq (mime-preview-original-major-mode)
1518 mime-preview-over-to-next-method-alist)))
1522 (or (next-single-property-change (point) 'mime-view-entity)
1524 (bottom (window-end (selected-window))))
1527 (progn (goto-char point)
1528 (recenter next-screen-context-lines))
1532 (goto-char (point-max))))))))
1534 (defun mime-preview-scroll-down-entity (&optional h)
1535 "Scroll down current entity.
1536 If reached to (point-min), it calls function registered in variable
1537 `mime-preview-over-to-previous-method-alist'."
1540 (let ((f (assq (mime-preview-original-major-mode)
1541 mime-preview-over-to-previous-method-alist)))
1545 (or (previous-single-property-change (point) 'mime-view-entity)
1547 (top (window-start (selected-window))))
1550 (progn (goto-char point)
1551 (recenter (* -1 next-screen-context-lines)))
1554 (beginning-of-buffer
1555 (goto-char (point-min))))))))
1557 (defun mime-preview-next-line-entity (&optional lines)
1558 "Scroll up one line (or prefix LINES lines).
1559 If LINES is negative, scroll down LINES lines."
1561 (mime-preview-scroll-up-entity (or lines 1)))
1563 (defun mime-preview-previous-line-entity (&optional lines)
1564 "Scrroll down one line (or prefix LINES lines).
1565 If LINES is negative, scroll up LINES lines."
1567 (mime-preview-scroll-down-entity (or lines 1)))
1573 (defun mime-preview-toggle-display (type &optional display)
1574 (let ((situation (mime-preview-find-boundary-info))
1575 (sym (intern (concat "*" (symbol-name type))))
1577 (setq p-beg (aref situation 0)
1578 p-end (aref situation 1)
1579 entity (aref situation 2)
1580 situation (get-text-property p-beg 'mime-view-situation))
1581 (cond ((eq display 'invisible)
1586 (eq (cdr (or (assq sym situation)
1587 (assq type situation)))
1589 (setq situation (put-alist sym (if display
1594 (let ((inhibit-read-only t))
1595 (delete-region p-beg p-end)
1596 (mime-display-entity entity situation)))
1597 (let ((ret (assoc situation mime-preview-situation-example-list)))
1599 (setcdr ret (1+ (cdr ret)))
1600 (add-to-list 'mime-preview-situation-example-list
1601 (cons situation 0))))))
1603 (defun mime-preview-toggle-header (&optional force-visible)
1605 (mime-preview-toggle-display 'header force-visible))
1607 (defun mime-preview-toggle-content (&optional force-visible)
1609 (mime-preview-toggle-display 'body force-visible))
1611 (defun mime-preview-show-header ()
1613 (mime-preview-toggle-display 'header 'visible))
1615 (defun mime-preview-show-content ()
1617 (mime-preview-toggle-display 'body 'visible))
1619 (defun mime-preview-hide-header ()
1621 (mime-preview-toggle-display 'header 'invisible))
1623 (defun mime-preview-hide-content ()
1625 (mime-preview-toggle-display 'body 'invisible))
1631 (defun mime-preview-quit ()
1632 "Quit from MIME-preview buffer.
1633 It calls function registered in variable
1634 `mime-preview-quitting-method-alist'."
1636 (let ((r (assq (mime-preview-original-major-mode)
1637 mime-preview-quitting-method-alist)))
1639 (funcall (cdr r)))))
1641 (defun mime-preview-kill-buffer ()
1643 (kill-buffer (current-buffer)))
1649 (provide 'mime-view)
1651 (let ((file mime-situation-examples-file))
1652 (if (file-readable-p file)
1654 (insert-file-contents file)
1655 (setq mime-situation-examples-file-coding-system
1657 ((boundp 'buffer-file-coding-system)
1658 (symbol-value 'buffer-file-coding-system))
1659 ((boundp 'file-coding-system)
1660 (symbol-value 'file-coding-system))
1666 (while (and (> (length mime-preview-situation-example-list)
1667 mime-preview-situation-example-list-max-size)
1669 (setq mime-preview-situation-example-list
1670 (mime-reduce-situation-examples
1671 mime-preview-situation-example-list))
1673 (error (setq mime-preview-situation-example-list nil)))
1674 ;; (let ((rest mime-preview-situation-example-list))
1676 ;; (ctree-set-calist-strictly 'mime-preview-condition
1678 ;; (setq rest (cdr rest))))
1681 (while (and (> (length mime-acting-situation-example-list)
1682 mime-acting-situation-example-list-max-size)
1684 (setq mime-acting-situation-example-list
1685 (mime-reduce-situation-examples
1686 mime-acting-situation-example-list))
1688 (error (setq mime-acting-situation-example-list nil))))))
1690 ;;; mime-view.el ends here