X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mime-view.el;h=64a4d109c9f7e90b26f88b698bdb0c6b97ee0f58;hb=829bd01d607b4c46751f912e31c75e1e6d4be179;hp=a5f2ba63333a1b21f509f61adb947775813f4672;hpb=2e003aa8a9dc040b4992d5acf19952bd3339b655;p=elisp%2Fsemi.git diff --git a/mime-view.el b/mime-view.el index a5f2ba6..64a4d10 100644 --- a/mime-view.el +++ b/mime-view.el @@ -33,6 +33,8 @@ (require 'alist) (require 'mime-conf) +(eval-when-compile (require 'static)) + ;;; @ version ;;; @@ -372,18 +374,19 @@ mother-buffer." (defun mime-view-read-situation-examples-file (&optional file) (or file (setq file mime-situation-examples-file)) - (if (file-readable-p file) + (if (and file + (file-readable-p file)) (with-temp-buffer (insert-file-contents file) (setq mime-situation-examples-file-coding-system - (and (boundp 'buffer-file-coding-system) - buffer-file-coding-system) - ;; (static-cond - ;; ((boundp 'buffer-file-coding-system) - ;; (symbol-value 'buffer-file-coding-system)) - ;; ((boundp 'file-coding-system) - ;; (symbol-value 'file-coding-system)) - ;; (t nil)) + (static-cond + ((boundp 'buffer-file-coding-system) + (symbol-value 'buffer-file-coding-system)) + ((boundp 'file-coding-system) + (symbol-value 'file-coding-system)) + (t nil)) + ;; (and (boundp 'buffer-file-coding-system) + ;; buffer-file-coding-system) ) (condition-case error (eval-buffer) @@ -435,15 +438,15 @@ mother-buffer." (insert "\n;;; " (file-name-nondirectory file) " ends here.\n") - (setq buffer-file-coding-system - mime-situation-examples-file-coding-system) - ;; (static-cond - ;; ((boundp 'buffer-file-coding-system) - ;; (setq buffer-file-coding-system - ;; mime-situation-examples-file-coding-system)) - ;; ((boundp 'file-coding-system) - ;; (setq file-coding-system - ;; mime-situation-examples-file-coding-system))) + (static-cond + ((boundp 'buffer-file-coding-system) + (setq buffer-file-coding-system + mime-situation-examples-file-coding-system)) + ((boundp 'file-coding-system) + (setq file-coding-system + mime-situation-examples-file-coding-system))) + ;; (setq buffer-file-coding-system + ;; mime-situation-examples-file-coding-system) (setq buffer-file-name file) (save-buffer))))) @@ -745,6 +748,12 @@ Each elements are regexp of field-name.") (ctree-set-calist-strictly 'mime-preview-condition + '((type . multipart)(subtype . related) + (body . visible) + (body-presentation-method . mime-display-multipart/related))) + +(ctree-set-calist-strictly + 'mime-preview-condition '((type . multipart)(subtype . t) (body . visible) (body-presentation-method . mime-display-multipart/mixed))) @@ -919,6 +928,22 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t. t means default." situations (cdr situations) i (1+ i))))) +(defun mime-display-multipart/related (entity situation) + (let* ((param-start (mime-parse-msg-id + (std11-lexical-analyze + (cdr (assoc "start" + (mime-content-type-parameters + (mime-entity-content-type entity))))))) + (start (or (and param-start (mime-find-entity-from-content-id + param-start + entity)) + (car (mime-entity-children entity)))) + (original-major-mode-cell (assq 'major-mode situation)) + (default-situation (cdr (assq 'childrens-situation situation)))) + (if original-major-mode-cell + (setq default-situation + (cons original-major-mode-cell default-situation))) + (mime-display-entity start nil default-situation))) ;;; @ acting-condition ;;; @@ -1856,6 +1881,11 @@ It calls function registered in variable (provide 'mime-view) +(eval-when-compile + (setq mime-situation-examples-file nil) + ;; to avoid to read situation-examples-file at compile time. + ) + (mime-view-read-situation-examples-file) ;;; mime-view.el ends here