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 (autoload 'fill-flowed "flow-fill")
654 (ctree-set-calist-strictly
655 'mime-preview-condition
658 (body-presentation-method . mime-display-text/plain)))
660 (ctree-set-calist-strictly
661 'mime-preview-condition
662 '((type . text)(subtype . enriched)
664 (body-presentation-method . mime-display-text/enriched)))
666 (ctree-set-calist-strictly
667 'mime-preview-condition
668 '((type . text)(subtype . richtext)
670 (body-presentation-method . mime-display-text/richtext)))
672 (autoload 'mime-display-application/x-postpet "postpet")
674 (ctree-set-calist-strictly
675 'mime-preview-condition
676 '((type . application)(subtype . x-postpet)
678 (body-presentation-method . mime-display-application/x-postpet)))
680 (ctree-set-calist-strictly
681 'mime-preview-condition
682 '((type . text)(subtype . t)
684 (body-presentation-method . mime-display-text/plain)))
686 (ctree-set-calist-strictly
687 'mime-preview-condition
688 '((type . multipart)(subtype . alternative)
690 (body-presentation-method . mime-display-multipart/alternative)))
692 (ctree-set-calist-strictly
693 'mime-preview-condition
694 '((type . multipart)(subtype . t)
696 (body-presentation-method . mime-display-multipart/mixed)))
698 (ctree-set-calist-strictly
699 'mime-preview-condition
700 '((type . message)(subtype . partial)
702 (body-presentation-method . mime-display-message/partial-button)))
704 (ctree-set-calist-strictly
705 'mime-preview-condition
706 '((type . message)(subtype . rfc822)
708 (body-presentation-method . mime-display-multipart/mixed)
709 (childrens-situation (header . visible)
710 (entity-button . invisible))))
712 (ctree-set-calist-strictly
713 'mime-preview-condition
714 '((type . message)(subtype . news)
716 (body-presentation-method . mime-display-multipart/mixed)
717 (childrens-situation (header . visible)
718 (entity-button . invisible))))
721 ;;; @@@ entity presentation
724 (defun mime-display-text/plain (entity situation)
726 (narrow-to-region (point-max)(point-max))
728 (mime-insert-text-content entity)
730 (message "Can't decode current entity.")
732 (run-hooks 'mime-text-decode-hook)
733 (goto-char (point-max))
734 (if (not (eq (char-after (1- (point))) ?\n))
737 (if (equal (cdr (assoc "format" situation)) "flowed")
739 (mime-add-url-buttons)
740 (run-hooks 'mime-display-text/plain-hook)
743 (defun mime-display-text/richtext (entity situation)
745 (narrow-to-region (point-max)(point-max))
746 (mime-insert-text-content entity)
747 (run-hooks 'mime-text-decode-hook)
748 (let ((beg (point-min)))
749 (remove-text-properties beg (point-max) '(face nil))
750 (richtext-decode beg (point-max))
753 (defun mime-display-text/enriched (entity situation)
755 (narrow-to-region (point-max)(point-max))
756 (mime-insert-text-content entity)
757 (run-hooks 'mime-text-decode-hook)
758 (let ((beg (point-min)))
759 (remove-text-properties beg (point-max) '(face nil))
760 (enriched-decode beg (point-max))
763 (defvar mime-view-announcement-for-message/partial
764 (if (and (>= emacs-major-version 19) window-system)
766 \[[ This is message/partial style split message. ]]
767 \[[ Please press `v' key in this buffer ]]
768 \[[ or click here by mouse button-2. ]]"
770 \[[ This is message/partial style split message. ]]
771 \[[ Please press `v' key in this buffer. ]]"
774 (defun mime-display-message/partial-button (&optional entity situation)
776 (goto-char (point-max))
777 (if (not (search-backward "\n\n" nil t))
780 (goto-char (point-max))
781 (narrow-to-region (point-max)(point-max))
782 (insert mime-view-announcement-for-message/partial)
783 (mime-add-button (point-min)(point-max)
784 #'mime-preview-play-current-entity)
787 (defun mime-display-multipart/mixed (entity situation)
788 (let ((children (mime-entity-children entity))
789 (original-major-mode-cell (assq 'major-mode situation))
791 (cdr (assq 'childrens-situation situation))))
792 (if original-major-mode-cell
793 (setq default-situation
794 (cons original-major-mode-cell default-situation)))
796 (mime-display-entity (car children) nil default-situation)
797 (setq children (cdr children))
800 (defcustom mime-view-type-subtype-score-alist
801 '(((text . enriched) . 3)
802 ((text . richtext) . 2)
805 "Alist MEDIA-TYPE vs corresponding score.
806 MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t. t means default."
808 :type '(repeat (cons (choice :tag "Media-Type"
809 (cons :tag "Type/Subtype"
810 (symbol :tag "Primary-type")
811 (symbol :tag "Subtype"))
813 (const :tag "Default" t))
816 (defun mime-display-multipart/alternative (entity situation)
817 (let* ((children (mime-entity-children entity))
818 (original-major-mode-cell (assq 'major-mode situation))
820 (cdr (assq 'childrens-situation situation)))
825 (if original-major-mode-cell
826 (setq default-situation
827 (cons original-major-mode-cell default-situation)))
832 (mime-find-entity-preview-situation
833 child default-situation)))
834 (if (cdr (assq 'body-presentation-method situation))
839 (cdr (assq 'type situation))
840 (cdr (assq 'subtype situation)))
841 mime-view-type-subtype-score-alist)
843 (cdr (assq 'type situation))
844 mime-view-type-subtype-score-alist)
847 mime-view-type-subtype-score-alist)
849 (if (> score max-score)
859 (let ((child (car children))
860 (situation (car situations)))
861 (mime-display-entity child (if (= i p)
863 (put-alist 'body 'invisible
864 (copy-alist situation)))))
865 (setq children (cdr children)
866 situations (cdr situations)
870 ;;; @ acting-condition
873 (defvar mime-acting-condition nil
874 "Condition-tree about how to process entity.")
876 (if (file-readable-p mailcap-file)
877 (let ((entries (mailcap-parse-file)))
879 (let ((entry (car entries))
882 (let* ((field (car entry))
883 (field-type (car field)))
884 (cond ((eq field-type 'view) (setq view field))
885 ((eq field-type 'print) (setq print field))
886 ((memq field-type '(compose composetyped edit)))
887 (t (setq shared (cons field shared))))
889 (setq entry (cdr entry))
891 (setq shared (nreverse shared))
892 (ctree-set-calist-with-default
893 'mime-acting-condition
894 (append shared (list '(mode . "play")(cons 'method (cdr view)))))
896 (ctree-set-calist-with-default
897 'mime-acting-condition
899 (list '(mode . "print")(cons 'method (cdr view))))
902 (setq entries (cdr entries))
905 (ctree-set-calist-strictly
906 'mime-acting-condition
907 '((type . application)(subtype . octet-stream)
909 (method . mime-detect-content)
912 (ctree-set-calist-with-default
913 'mime-acting-condition
915 (method . mime-save-content)))
917 (ctree-set-calist-strictly
918 'mime-acting-condition
919 '((type . text)(subtype . x-rot13-47)(mode . "play")
920 (method . mime-view-caesar)
922 (ctree-set-calist-strictly
923 'mime-acting-condition
924 '((type . text)(subtype . x-rot13-47-48)(mode . "play")
925 (method . mime-view-caesar)
928 (ctree-set-calist-strictly
929 'mime-acting-condition
930 '((type . message)(subtype . rfc822)(mode . "play")
931 (method . mime-view-message/rfc822)
933 (ctree-set-calist-strictly
934 'mime-acting-condition
935 '((type . message)(subtype . partial)(mode . "play")
936 (method . mime-store-message/partial-piece)
939 (ctree-set-calist-strictly
940 'mime-acting-condition
941 '((type . message)(subtype . external-body)
942 ("access-type" . "anon-ftp")
943 (method . mime-view-message/external-anon-ftp)
946 (ctree-set-calist-strictly
947 'mime-acting-condition
948 '((type . message)(subtype . external-body)
949 ("access-type" . "url")
950 (method . mime-view-message/external-url)
953 (ctree-set-calist-strictly
954 'mime-acting-condition
955 '((type . application)(subtype . octet-stream)
956 (method . mime-save-content)
960 ;;; @ quitting method
963 (defvar mime-preview-quitting-method-alist
964 '((mime-show-message-mode
965 . mime-preview-quitting-method-for-mime-show-message-mode))
966 "Alist of major-mode vs. quitting-method of mime-view.")
968 (defvar mime-preview-over-to-previous-method-alist nil
969 "Alist of major-mode vs. over-to-previous-method of mime-view.")
971 (defvar mime-preview-over-to-next-method-alist nil
972 "Alist of major-mode vs. over-to-next-method of mime-view.")
975 ;;; @ following method
978 (defvar mime-preview-following-method-alist nil
979 "Alist of major-mode vs. following-method of mime-view.")
981 (defvar mime-view-following-required-fields-list
988 (defun mime-display-entity (entity &optional situation
989 default-situation preview-buffer)
991 (setq preview-buffer (current-buffer)))
992 (let* (e nb ne nhb nbb)
993 (in-calist-package 'mime-view)
996 (mime-find-entity-preview-situation entity default-situation)))
997 (let ((button-is-invisible
998 (eq (cdr (or (assq '*entity-button situation)
999 (assq 'entity-button situation)))
1002 (eq (cdr (or (assq '*header situation)
1003 (assq 'header situation)))
1006 (eq (cdr (or (assq '*body situation)
1007 (assq 'body situation)))
1009 (children (mime-entity-children entity)))
1010 (set-buffer preview-buffer)
1012 (narrow-to-region nb nb)
1013 (or button-is-invisible
1014 ;; (if (mime-view-entity-button-visible-p entity)
1015 (mime-view-insert-entity-button entity)
1018 (if header-is-visible
1019 (let ((header-presentation-method
1020 (or (cdr (assq 'header-presentation-method situation))
1021 (cdr (assq (cdr (assq 'major-mode situation))
1022 mime-header-presentation-method-alist)))))
1024 (if header-presentation-method
1025 (funcall header-presentation-method entity situation)
1026 (mime-insert-header entity
1027 mime-view-ignored-field-list
1028 mime-view-visible-field-list))
1029 (run-hooks 'mime-display-header-hook)
1030 (put-text-property nhb (point-max) 'mime-view-entity-header entity)
1031 (goto-char (point-max))
1036 (let ((body-presentation-method
1037 (cdr (assq 'body-presentation-method situation))))
1038 (if (functionp body-presentation-method)
1039 (funcall body-presentation-method entity situation)
1040 (mime-display-text/plain entity situation)))
1041 (when button-is-invisible
1042 (goto-char (point-max))
1043 (mime-view-insert-entity-button entity)
1045 (unless header-is-visible
1046 (goto-char (point-max))
1049 (setq ne (point-max))
1051 (put-text-property nb ne 'mime-view-entity entity)
1052 (put-text-property nb ne 'mime-view-situation situation)
1053 (put-text-property nbb ne 'mime-view-entity-body entity)
1055 (if (and children body-is-visible)
1056 (let ((body-presentation-method
1057 (cdr (assq 'body-presentation-method situation))))
1058 (if (functionp body-presentation-method)
1059 (funcall body-presentation-method entity situation)
1060 (mime-display-multipart/mixed entity situation))))
1064 ;;; @ MIME viewer mode
1067 (defconst mime-view-menu-title "MIME-View")
1068 (defconst mime-view-menu-list
1069 '((up "Move to upper entity" mime-preview-move-to-upper)
1070 (previous "Move to previous entity" mime-preview-move-to-previous)
1071 (next "Move to next entity" mime-preview-move-to-next)
1072 (scroll-down "Scroll-down" mime-preview-scroll-down-entity)
1073 (scroll-up "Scroll-up" mime-preview-scroll-up-entity)
1074 (play "Play current entity" mime-preview-play-current-entity)
1075 (extract "Extract current entity" mime-preview-extract-current-entity)
1076 (print "Print current entity" mime-preview-print-current-entity)
1078 "Menu for MIME Viewer")
1080 (cond ((featurep 'xemacs)
1081 (defvar mime-view-xemacs-popup-menu
1082 (cons mime-view-menu-title
1085 (vector (nth 1 item)(nth 2 item) t)
1087 mime-view-menu-list)))
1088 (defun mime-view-xemacs-popup-menu (event)
1089 "Popup the menu in the MIME Viewer buffer"
1091 (select-window (event-window event))
1092 (set-buffer (event-buffer event))
1093 (popup-menu 'mime-view-xemacs-popup-menu))
1094 (defvar mouse-button-2 'button2)
1097 (defvar mime-view-popup-menu
1098 (let ((menu (make-sparse-keymap mime-view-menu-title)))
1102 (list (intern (nth 1 item)) 'menu-item
1103 (nth 1 item)(nth 2 item))
1105 mime-view-menu-list))))
1106 (defun mime-view-popup-menu (event)
1107 "Popup the menu in the MIME Viewer buffer"
1109 (let ((menu mime-view-popup-menu) events func)
1110 (setq events (x-popup-menu t menu))
1112 (setq func (lookup-key menu (apply #'vector events)))
1115 (defvar mouse-button-2 [mouse-2])
1118 (defun mime-view-define-keymap (&optional default)
1119 (let ((mime-view-mode-map (if (keymapp default)
1120 (copy-keymap default)
1121 (make-sparse-keymap)
1123 (define-key mime-view-mode-map
1124 "u" (function mime-preview-move-to-upper))
1125 (define-key mime-view-mode-map
1126 "p" (function mime-preview-move-to-previous))
1127 (define-key mime-view-mode-map
1128 "n" (function mime-preview-move-to-next))
1129 (define-key mime-view-mode-map
1130 "\e\t" (function mime-preview-move-to-previous))
1131 (define-key mime-view-mode-map
1132 "\t" (function mime-preview-move-to-next))
1133 (define-key mime-view-mode-map
1134 " " (function mime-preview-scroll-up-entity))
1135 (define-key mime-view-mode-map
1136 "\M- " (function mime-preview-scroll-down-entity))
1137 (define-key mime-view-mode-map
1138 "\177" (function mime-preview-scroll-down-entity))
1139 (define-key mime-view-mode-map
1140 "\C-m" (function mime-preview-next-line-entity))
1141 (define-key mime-view-mode-map
1142 "\C-\M-m" (function mime-preview-previous-line-entity))
1143 (define-key mime-view-mode-map
1144 "v" (function mime-preview-play-current-entity))
1145 (define-key mime-view-mode-map
1146 "e" (function mime-preview-extract-current-entity))
1147 (define-key mime-view-mode-map
1148 "\C-c\C-p" (function mime-preview-print-current-entity))
1150 (define-key mime-view-mode-map
1151 "\C-c\C-t\C-f" (function mime-preview-toggle-header))
1152 (define-key mime-view-mode-map
1153 "\C-c\C-th" (function mime-preview-toggle-header))
1154 (define-key mime-view-mode-map
1155 "\C-c\C-t\C-c" (function mime-preview-toggle-content))
1157 (define-key mime-view-mode-map
1158 "\C-c\C-v\C-f" (function mime-preview-show-header))
1159 (define-key mime-view-mode-map
1160 "\C-c\C-vh" (function mime-preview-show-header))
1161 (define-key mime-view-mode-map
1162 "\C-c\C-v\C-c" (function mime-preview-show-content))
1164 (define-key mime-view-mode-map
1165 "\C-c\C-d\C-f" (function mime-preview-hide-header))
1166 (define-key mime-view-mode-map
1167 "\C-c\C-dh" (function mime-preview-hide-header))
1168 (define-key mime-view-mode-map
1169 "\C-c\C-d\C-c" (function mime-preview-hide-content))
1171 (define-key mime-view-mode-map
1172 "a" (function mime-preview-follow-current-entity))
1173 (define-key mime-view-mode-map
1174 "q" (function mime-preview-quit))
1175 (define-key mime-view-mode-map
1176 "\C-c\C-x" (function mime-preview-kill-buffer))
1177 ;; (define-key mime-view-mode-map
1178 ;; "<" (function beginning-of-buffer))
1179 ;; (define-key mime-view-mode-map
1180 ;; ">" (function end-of-buffer))
1181 (define-key mime-view-mode-map
1182 "?" (function describe-mode))
1183 (define-key mime-view-mode-map
1184 [tab] (function mime-preview-move-to-next))
1185 (define-key mime-view-mode-map
1186 [delete] (function mime-preview-scroll-down-entity))
1187 (define-key mime-view-mode-map
1188 [backspace] (function mime-preview-scroll-down-entity))
1189 (if (functionp default)
1190 (cond ((featurep 'xemacs)
1191 (set-keymap-default-binding mime-view-mode-map default)
1194 (setq mime-view-mode-map
1195 (append mime-view-mode-map (list (cons t default))))
1198 (define-key mime-view-mode-map
1199 mouse-button-2 (function mime-button-dispatcher))
1201 (cond ((featurep 'xemacs)
1202 (define-key mime-view-mode-map
1203 mouse-button-3 (function mime-view-xemacs-popup-menu))
1205 ((>= emacs-major-version 19)
1206 (define-key mime-view-mode-map
1207 mouse-button-3 (function mime-view-popup-menu))
1208 (define-key mime-view-mode-map [menu-bar mime-view]
1209 (cons mime-view-menu-title
1210 (make-sparse-keymap mime-view-menu-title)))
1213 (define-key mime-view-mode-map
1214 (vector 'menu-bar 'mime-view (car item))
1215 (cons (nth 1 item)(nth 2 item))
1218 (reverse mime-view-menu-list)
1221 (use-local-map mime-view-mode-map)
1222 (run-hooks 'mime-view-define-keymap-hook)
1225 (defsubst mime-maybe-hide-echo-buffer ()
1226 "Clear mime-echo buffer and delete window for it."
1227 (let ((buf (get-buffer mime-echo-buffer-name)))
1232 (let ((win (get-buffer-window buf)))
1239 (defvar mime-view-redisplay nil)
1242 (defun mime-display-message (message &optional preview-buffer
1243 mother default-keymap-or-function
1244 original-major-mode)
1245 "View MESSAGE in MIME-View mode.
1247 Optional argument PREVIEW-BUFFER specifies the buffer of the
1248 presentation. It must be either nil or a name of preview buffer.
1250 Optional argument MOTHER specifies mother-buffer of the preview-buffer.
1252 Optional argument DEFAULT-KEYMAP-OR-FUNCTION is nil, keymap or
1253 function. If it is a keymap, keymap of MIME-View mode will be added
1254 to it. If it is a function, it will be bound as default binding of
1255 keymap of MIME-View mode."
1256 (mime-maybe-hide-echo-buffer)
1257 (let ((win-conf (current-window-configuration)))
1259 (setq preview-buffer
1260 (concat "*Preview-" (mime-entity-name message) "*")))
1261 (or original-major-mode
1262 (setq original-major-mode major-mode))
1263 (let ((inhibit-read-only t))
1264 (set-buffer (get-buffer-create preview-buffer))
1268 (setq mime-mother-buffer mother)
1270 (setq mime-preview-original-window-configuration win-conf)
1271 (setq major-mode 'mime-view-mode)
1272 (setq mode-name "MIME-View")
1273 (mime-display-entity message nil
1274 `((entity-button . invisible)
1276 (major-mode . ,original-major-mode))
1278 (mime-view-define-keymap default-keymap-or-function)
1280 (next-single-property-change (point-min) 'mime-view-entity)))
1283 (goto-char (point-min))
1284 (search-forward "\n\n" nil t)
1286 (run-hooks 'mime-view-mode-hook)
1287 (set-buffer-modified-p nil)
1288 (setq buffer-read-only t)
1292 (defun mime-view-buffer (&optional raw-buffer preview-buffer mother
1293 default-keymap-or-function
1294 representation-type)
1295 "View RAW-BUFFER in MIME-View mode.
1296 Optional argument PREVIEW-BUFFER is either nil or a name of preview
1298 Optional argument DEFAULT-KEYMAP-OR-FUNCTION is nil, keymap or
1299 function. If it is a keymap, keymap of MIME-View mode will be added
1300 to it. If it is a function, it will be bound as default binding of
1301 keymap of MIME-View mode.
1302 Optional argument REPRESENTATION-TYPE is representation-type of
1303 message. It must be nil, `binary' or `cooked'. If it is nil,
1304 `cooked' is used as default."
1307 (setq raw-buffer (current-buffer)))
1308 (or representation-type
1309 (setq representation-type
1311 (set-buffer raw-buffer)
1312 (cdr (or (assq major-mode mime-raw-representation-type-alist)
1313 (assq t mime-raw-representation-type-alist)))
1315 (if (eq representation-type 'binary)
1316 (setq representation-type 'buffer)
1318 (setq preview-buffer (mime-display-message
1319 (mime-open-entity representation-type raw-buffer)
1320 preview-buffer mother default-keymap-or-function))
1321 (or (get-buffer-window preview-buffer)
1322 (let ((r-win (get-buffer-window raw-buffer)))
1324 (set-window-buffer r-win preview-buffer)
1325 (let ((m-win (and mother (get-buffer-window mother))))
1327 (set-window-buffer m-win preview-buffer)
1328 (switch-to-buffer preview-buffer)
1331 (defun mime-view-mode (&optional mother ctl encoding
1332 raw-buffer preview-buffer
1333 default-keymap-or-function)
1334 "Major mode for viewing MIME message.
1336 Here is a list of the standard keys for mime-view-mode.
1341 u Move to upper content
1342 p or M-TAB Move to previous content
1343 n or TAB Move to next content
1344 SPC Scroll up or move to next content
1345 M-SPC or DEL Scroll down or move to previous content
1346 RET Move to next line
1347 M-RET Move to previous line
1348 v Decode current content as `play mode'
1349 e Decode current content as `extract mode'
1350 C-c C-p Decode current content as `print mode'
1351 a Followup to current content.
1353 button-2 Move to point under the mouse cursor
1354 and decode current content as `play mode'
1357 (unless mime-view-redisplay
1359 (if raw-buffer (set-buffer raw-buffer))
1362 (or (assq major-mode mime-raw-representation-type-alist)
1363 (assq t mime-raw-representation-type-alist)))))
1364 (if (eq type 'binary)
1367 (setq mime-message-structure (mime-open-entity type raw-buffer))
1368 (or (mime-entity-content-type mime-message-structure)
1369 (mime-entity-set-content-type mime-message-structure ctl))
1371 (or (mime-entity-encoding mime-message-structure)
1372 (mime-entity-set-encoding mime-message-structure encoding))
1374 (mime-display-message mime-message-structure preview-buffer
1375 mother default-keymap-or-function)
1382 (defun mime-preview-find-boundary-info (&optional get-mother)
1386 (while (null (setq entity
1387 (get-text-property (point) 'mime-view-entity)))
1389 (setq p-beg (previous-single-property-change (point) 'mime-view-entity))
1390 (setq entity-node-id (mime-entity-node-id entity))
1391 (setq len (length entity-node-id))
1394 (if (eq (next-single-property-change (point-min)
1400 ((eq (next-single-property-change p-beg 'mime-view-entity)
1402 (setq p-beg (point))
1404 (setq p-end (next-single-property-change p-beg 'mime-view-entity))
1406 (setq p-end (point-max))
1408 ((null entity-node-id)
1409 (setq p-end (point-max))
1417 (next-single-property-change
1418 (point) 'mime-view-entity))
1420 (let ((rc (mime-entity-node-id
1421 (get-text-property (1- (point))
1422 'mime-view-entity))))
1423 (or (and (>= (setq i (- (length rc) len)) 0)
1424 (equal entity-node-id (nthcdr i rc)))
1427 (setq p-end (point-max))))
1429 (vector p-beg p-end entity)))
1435 (autoload 'mime-preview-play-current-entity "mime-play"
1436 "Play current entity." t)
1438 (defun mime-preview-extract-current-entity (&optional ignore-examples)
1439 "Extract current entity into file (maybe).
1440 It decodes current entity to call internal or external method as
1441 \"extract\" mode. The method is selected from variable
1442 `mime-acting-condition'."
1444 (mime-preview-play-current-entity ignore-examples "extract")
1447 (defun mime-preview-print-current-entity (&optional ignore-examples)
1448 "Print current entity (maybe).
1449 It decodes current entity to call internal or external method as
1450 \"print\" mode. The method is selected from variable
1451 `mime-acting-condition'."
1453 (mime-preview-play-current-entity ignore-examples "print")
1460 (defun mime-preview-follow-current-entity ()
1461 "Write follow message to current entity.
1462 It calls following-method selected from variable
1463 `mime-preview-following-method-alist'."
1465 (let ((entity (mime-preview-find-boundary-info t))
1468 (setq p-beg (aref entity 0)
1469 p-end (aref entity 1)
1470 entity (aref entity 2))
1471 (if (get-text-property p-beg 'mime-view-entity-body)
1474 (next-single-property-change
1475 p-beg 'mime-view-entity-body nil
1476 (or (next-single-property-change p-beg 'mime-view-entity)
1478 (let* ((mode (mime-preview-original-major-mode 'recursive))
1479 (entity-node-id (mime-entity-node-id entity))
1481 (format "%s-%s" (buffer-name) (reverse entity-node-id)))
1483 (the-buf (current-buffer))
1486 (set-buffer (setq new-buf (get-buffer-create new-name)))
1489 (insert-buffer-substring the-buf pb-beg p-end)
1490 (goto-char (point-min))
1491 (let ((current-entity
1492 (if (and (eq (mime-entity-media-type entity) 'message)
1493 (eq (mime-entity-media-subtype entity) 'rfc822))
1494 (car (mime-entity-children entity))
1496 (while (and current-entity
1497 (if (and (eq (mime-entity-media-type
1498 current-entity) 'message)
1499 (eq (mime-entity-media-subtype
1500 current-entity) 'rfc822))
1502 (mime-insert-header current-entity fields)
1504 (setq fields (std11-collect-field-names)
1505 current-entity (mime-entity-parent current-entity))
1507 (let ((rest mime-view-following-required-fields-list)
1510 (setq field-name (car rest))
1511 (or (std11-field-body field-name)
1514 (set-buffer the-buf)
1515 (let ((entity (when mime-mother-buffer
1516 (set-buffer mime-mother-buffer)
1517 (get-text-property (point)
1518 'mime-view-entity))))
1520 (null (setq ret (mime-entity-fetch-field
1521 entity field-name))))
1522 (setq entity (mime-entity-parent entity)))))
1524 (insert (concat field-name ": " ret "\n"))
1526 (setq rest (cdr rest))
1529 (let ((f (cdr (assq mode mime-preview-following-method-alist))))
1534 "Sorry, following method for %s is not implemented yet."
1543 (defun mime-preview-move-to-upper ()
1544 "Move to upper entity.
1545 If there is no upper entity, call function `mime-preview-quit'."
1548 (while (null (setq cinfo
1549 (get-text-property (point) 'mime-view-entity)))
1552 (let ((r (mime-entity-parent cinfo))
1555 (while (setq point (previous-single-property-change
1556 (point) 'mime-view-entity))
1558 (when (eq r (get-text-property (point) 'mime-view-entity))
1559 (if (or (eq mime-preview-move-scroll t)
1560 (and mime-preview-move-scroll
1563 (move-to-window-line -1)
1564 (forward-line (* -1 next-screen-context-lines))
1567 (recenter next-screen-context-lines))
1574 (defun mime-preview-move-to-previous ()
1575 "Move to previous entity.
1576 If there is no previous entity, it calls function registered in
1577 variable `mime-preview-over-to-previous-method-alist'."
1579 (while (and (not (bobp))
1580 (null (get-text-property (point) 'mime-view-entity)))
1583 (let ((point (previous-single-property-change (point) 'mime-view-entity)))
1585 (>= point (point-min)))
1586 (if (get-text-property (1- point) 'mime-view-entity)
1587 (progn (goto-char point)
1589 (or (eq mime-preview-move-scroll t)
1590 (and mime-preview-move-scroll
1593 (move-to-window-line 0)
1594 (forward-line next-screen-context-lines)
1597 (recenter (* -1 next-screen-context-lines))))
1598 (goto-char (1- point))
1599 (mime-preview-move-to-previous)
1601 (let ((f (assq (mime-preview-original-major-mode)
1602 mime-preview-over-to-previous-method-alist)))
1608 (defun mime-preview-move-to-next ()
1609 "Move to next entity.
1610 If there is no previous entity, it calls function registered in
1611 variable `mime-preview-over-to-next-method-alist'."
1613 (while (and (not (eobp))
1614 (null (get-text-property (point) 'mime-view-entity)))
1617 (let ((point (next-single-property-change (point) 'mime-view-entity)))
1619 (<= point (point-max)))
1622 (if (null (get-text-property point 'mime-view-entity))
1623 (mime-preview-move-to-next)
1625 (or (eq mime-preview-move-scroll t)
1626 (and mime-preview-move-scroll
1629 (move-to-window-line -1)
1631 (* -1 next-screen-context-lines))
1634 (recenter next-screen-context-lines))
1636 (let ((f (assq (mime-preview-original-major-mode)
1637 mime-preview-over-to-next-method-alist)))
1643 (defun mime-preview-scroll-up-entity (&optional h)
1644 "Scroll up current entity.
1645 If reached to (point-max), it calls function registered in variable
1646 `mime-preview-over-to-next-method-alist'."
1649 (let ((f (assq (mime-preview-original-major-mode)
1650 mime-preview-over-to-next-method-alist)))
1655 (or (next-single-property-change (point) 'mime-view-entity)
1657 (bottom (window-end (selected-window))))
1660 (progn (goto-char point)
1661 (recenter next-screen-context-lines))
1665 (goto-char (point-max)))))
1668 (defun mime-preview-scroll-down-entity (&optional h)
1669 "Scroll down current entity.
1670 If reached to (point-min), it calls function registered in variable
1671 `mime-preview-over-to-previous-method-alist'."
1674 (let ((f (assq (mime-preview-original-major-mode)
1675 mime-preview-over-to-previous-method-alist)))
1680 (or (previous-single-property-change (point) 'mime-view-entity)
1682 (top (window-start (selected-window))))
1685 (progn (goto-char point)
1686 (recenter (* -1 next-screen-context-lines)))
1689 (beginning-of-buffer
1690 (goto-char (point-min)))))
1693 (defun mime-preview-next-line-entity (&optional lines)
1694 "Scroll up one line (or prefix LINES lines).
1695 If LINES is negative, scroll down LINES lines."
1697 (mime-preview-scroll-up-entity (or lines 1))
1700 (defun mime-preview-previous-line-entity (&optional lines)
1701 "Scrroll down one line (or prefix LINES lines).
1702 If LINES is negative, scroll up LINES lines."
1704 (mime-preview-scroll-down-entity (or lines 1))
1711 (defun mime-preview-toggle-display (type &optional display)
1712 (let ((situation (mime-preview-find-boundary-info))
1713 (sym (intern (concat "*" (symbol-name type))))
1715 (setq p-beg (aref situation 0)
1716 p-end (aref situation 1)
1717 entity (aref situation 2)
1718 situation (get-text-property p-beg 'mime-view-situation))
1719 (cond ((eq display 'invisible)
1724 (eq (cdr (or (assq sym situation)
1725 (assq type situation)))
1727 (setq situation (put-alist sym (if display
1732 (let ((inhibit-read-only t))
1733 (delete-region p-beg p-end)
1734 (mime-display-entity entity situation)))
1735 (let ((ret (assoc situation mime-preview-situation-example-list)))
1737 (setcdr ret (1+ (cdr ret)))
1738 (add-to-list 'mime-preview-situation-example-list
1739 (cons situation 0))))))
1741 (defun mime-preview-toggle-header (&optional force-visible)
1743 (mime-preview-toggle-display 'header force-visible))
1745 (defun mime-preview-toggle-content (&optional force-visible)
1747 (mime-preview-toggle-display 'body force-visible))
1749 (defun mime-preview-show-header ()
1751 (mime-preview-toggle-display 'header 'visible))
1753 (defun mime-preview-show-content ()
1755 (mime-preview-toggle-display 'body 'visible))
1757 (defun mime-preview-hide-header ()
1759 (mime-preview-toggle-display 'header 'invisible))
1761 (defun mime-preview-hide-content ()
1763 (mime-preview-toggle-display 'body 'invisible))
1769 (defun mime-preview-quit ()
1770 "Quit from MIME-preview buffer.
1771 It calls function registered in variable
1772 `mime-preview-quitting-method-alist'."
1774 (let ((r (assq (mime-preview-original-major-mode)
1775 mime-preview-quitting-method-alist)))
1780 (defun mime-preview-kill-buffer ()
1782 (kill-buffer (current-buffer))
1789 (provide 'mime-view)
1791 (let ((file mime-situation-examples-file))
1792 (if (file-readable-p file)
1794 (insert-file-contents file)
1795 (setq mime-situation-examples-file-coding-system
1797 ((boundp 'buffer-file-coding-system)
1798 (symbol-value 'buffer-file-coding-system))
1799 ((boundp 'file-coding-system)
1800 (symbol-value 'file-coding-system))
1806 (while (and (> (length mime-preview-situation-example-list)
1807 mime-preview-situation-example-list-max-size)
1809 (setq mime-preview-situation-example-list
1810 (mime-reduce-situation-examples
1811 mime-preview-situation-example-list))
1813 (error (setq mime-preview-situation-example-list nil)))
1814 ;; (let ((rest mime-preview-situation-example-list))
1816 ;; (ctree-set-calist-strictly 'mime-preview-condition
1818 ;; (setq rest (cdr rest))))
1821 (while (and (> (length mime-acting-situation-example-list)
1822 mime-acting-situation-example-list-max-size)
1824 (setq mime-acting-situation-example-list
1825 (mime-reduce-situation-examples
1826 mime-acting-situation-example-list))
1828 (error (setq mime-acting-situation-example-list nil))))))
1830 ;;; mime-view.el ends here