From: morioka Date: Sat, 14 Mar 1998 17:57:10 +0000 (+0000) Subject: rearrangement. X-Git-Tag: semi-1_1_0~40 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0920680a9c9594b568844ebc316e21ea5de85afd;p=elisp%2Fsemi.git rearrangement. --- diff --git a/mime-view.el b/mime-view.el index 98773aa..311566b 100644 --- a/mime-view.el +++ b/mime-view.el @@ -43,102 +43,65 @@ " (" (car semi-version) ")")) -;;; @ variables or settings +;;; @ buffer local variables ;;; -(defvar mime-acting-condition - '(((type . text)(subtype . plain) - (method "tm-plain" nil 'file "" 'encoding 'mode 'name) - (mode "play" "print") - ) - ((type . text)(subtype . html) - (method "tm-html" nil 'file "" 'encoding 'mode 'name) - (mode . "play") - ) - ((type . text)(subtype . x-rot13-47) - (method . mime-method-to-display-caesar) - (mode . "play") - ) - ((type . text)(subtype . x-rot13-47-48) - (method . mime-method-to-display-caesar) - (mode . "play") - ) +;;; @@ in raw-buffer +;;; - ((type . audio)(subtype . basic) - (method "tm-au" nil 'file "" 'encoding 'mode 'name) - (mode . "play") - ) - - ((type . image) - (method "tm-image" nil 'file "" 'encoding 'mode 'name) - (mode "play" "print") - ) - - ((type . video)(subtype . mpeg) - (method "tm-mpeg" nil 'file "" 'encoding 'mode 'name) - (mode . "play") - ) - - ((type . application)(subtype . postscript) - (method "tm-ps" nil 'file "" 'encoding 'mode 'name) - (mode "play" "print") - ) - ((type . application)(subtype . octet-stream) - (method . mime-method-to-save)(mode "play" "print") - ) +(defvar mime-raw-message-info + "Information about structure of message. +Please use reference function `mime-entity-info-SLOT' to get value of +SLOT. - ((type . message)(subtype . external-body) - ("access-type" . "anon-ftp") - (method . mime-method-to-display-message/external-ftp) - ) - ((type . message)(subtype . rfc822) - (method . mime-method-to-display-message/rfc822) - (mode . "play") - ) - ((type . message)(subtype . partial) - (method . mime-method-to-store-message/partial) - (mode . "play") - ) - - ((method "metamail" t "-m" "tm" "-x" "-d" "-z" "-e" 'file) - (mode . "play") - ) - ((method . mime-method-to-save)(mode . "extract")) - )) +Following is a list of slots of the structure: -(defvar mime-view-visible-media-type-list - '("text/plain" nil "text/richtext" "text/enriched" - "text/rfc822-headers" - "text/x-latex" "application/x-latex" - "message/delivery-status" - "application/pgp" "text/x-pgp" - "application/octet-stream" - "application/x-selection" "application/x-comment") - "*List of media-types to be able to display in MIME-preview buffer. -Each elements are string of TYPE/SUBTYPE, e.g. \"text/plain\".") +node-id reversed entity-number (list of integers or t) +point-min beginning point of region in raw-buffer +point-max end point of region in raw-buffer +type media-type (symbol) +subtype media-subtype (symbol) +type/subtype media-type/subtype (string or nil) +parameters parameter of Content-Type field (association list) +encoding Content-Transfer-Encoding (string or nil) +children entities included in this entity (list of content-infos) -(defvar mime-view-content-button-visible-ctype-list - '("application/pgp")) +If an entity includes other entities in its body, such as multipart or +message/rfc822, entity-infos of other entities are included in +`children', so entity-info become a tree.") +(make-variable-buffer-local 'mime-raw-message-info) -(defvar mime-view-uuencode-encoding-name-list '("x-uue" "x-uuencode")) +(defvar mime-preview-buffer nil + "MIME-preview buffer corresponding with the (raw) buffer.") +(make-variable-buffer-local 'mime-preview-buffer) -(defvar mime-view-redisplay nil) -(defvar mime-view-announcement-for-message/partial - (if (and (>= emacs-major-version 19) window-system) - "\ -\[[ This is message/partial style split message. ]] -\[[ Please press `v' key in this buffer ]] -\[[ or click here by mouse button-2. ]]" - "\ -\[[ This is message/partial style split message. ]] -\[[ Please press `v' key in this buffer. ]]" - )) +;;; @@ in preview-buffer +;;; +(defvar mime-mother-buffer nil + "Mother buffer corresponding with the (MIME-preview) buffer. +If current MIME-preview buffer is generated by other buffer, such as +message/partial, it is called `mother-buffer'.") +(make-variable-buffer-local 'mime-mother-buffer) + +(defvar mime-raw-buffer nil + "Raw buffer corresponding with the (MIME-preview) buffer.") +(make-variable-buffer-local 'mime-raw-buffer) + +(defvar mime-preview-original-major-mode nil + "Major-mode of mime-raw-buffer.") +(make-variable-buffer-local 'mime-preview-original-major-mode) + +(make-variable-buffer-local 'mime-preview-original-window-configuration) -;;; @@ entity button + +;;; @ entity button ;;; +(defvar mime-view-content-button-visible-ctype-list + '("application/pgp")) + (defun mime-view-insert-entity-button (entity-node-id cinfo media-type media-subtype params @@ -189,7 +152,7 @@ Each elements are string of TYPE/SUBTYPE, e.g. \"text/plain\".") ) (defun mime-view-entity-button-function (entity-node-id - cinfo + message-info media-type media-subtype params subj encoding) "Insert entity button conditionally. @@ -200,18 +163,77 @@ Please redefine this function if you want to change default setting." (and (eq media-subtype 'octet-stream) (let ((entity-info (mime-raw-entity-node-id-to-entity-info - (cdr entity-node-id) cinfo))) + (cdr entity-node-id) message-info))) (and (eq (mime-entity-info-media-type entity-info) 'multipart) (eq (mime-entity-info-media-subtype entity-info) 'encrypted) ))))) - (mime-view-insert-entity-button - entity-node-id cinfo media-type media-subtype params subj encoding) + (mime-view-insert-entity-button entity-node-id message-info + media-type media-subtype params + subj encoding) )) -;;; @@ content header filter +;;; @ entity header +;;; + +;;; @@ predicate functions +;;; + +(defvar mime-view-childrens-header-showing-Content-Type-list + '("message/rfc822" "message/news")) + +(defun mime-view-header-visible-p (entity-node-id cinfo) + "Return non-nil if header of current entity is visible." + (or (null entity-node-id) + (member (mime-entity-info-type/subtype + (mime-raw-entity-node-id-to-entity-info + (cdr entity-node-id) cinfo)) + mime-view-childrens-header-showing-Content-Type-list) + )) + +(defvar mime-view-visible-media-type-list + '("text/plain" nil "text/richtext" "text/enriched" + "text/rfc822-headers" + "text/x-latex" "application/x-latex" + "message/delivery-status" + "application/pgp" "text/x-pgp" + "application/octet-stream" + "application/x-selection" "application/x-comment") + "*List of media-types to be able to display in MIME-preview buffer. +Each elements are string of TYPE/SUBTYPE, e.g. \"text/plain\".") + +(defun mime-view-body-visible-p (entity-node-id cinfo + media-type media-subtype) + (let ((ctype (if media-type + (if media-subtype + (format "%s/%s" media-type media-subtype) + (symbol-name media-type) + )))) + (and (member ctype mime-view-visible-media-type-list) + (if (and (eq media-type 'application) + (eq media-subtype 'octet-stream)) + (let ((ccinfo + (mime-raw-entity-node-id-to-entity-info + entity-node-id cinfo))) + (member (mime-entity-info-encoding ccinfo) + '(nil "7bit" "8bit")) + ) + t)) + )) + +;;; @@ entity header filter +;;; + +(defvar mime-view-content-header-filter-alist nil) + +(defun mime-view-default-content-header-filter () + (mime-view-cut-header) + (eword-decode-header) + ) + +;;; @@ entity field cutter ;;; (defvar mime-view-ignored-field-list @@ -253,15 +275,8 @@ Each elements are regexp of field-name.") (point-max)))) )))) -(defun mime-view-default-content-header-filter () - (mime-view-cut-header) - (eword-decode-header) - ) - -(defvar mime-view-content-header-filter-alist nil) - -;;; @@ content filter +;;; @ entity filter ;;; (defvar mime-view-content-filter-alist @@ -274,8 +289,19 @@ Each element looks like (TYPE/SUBTYPE . FUNCTION) or (t . FUNCTION). TYPE/SUBTYPE is a string of media-type and FUNCTION is a filter function. t means default media-type.") +(defvar mime-view-announcement-for-message/partial + (if (and (>= emacs-major-version 19) window-system) + "\ +\[[ This is message/partial style split message. ]] +\[[ Please press `v' key in this buffer ]] +\[[ or click here by mouse button-2. ]]" + "\ +\[[ This is message/partial style split message. ]] +\[[ Please press `v' key in this buffer. ]]" + )) -;;; @@ entity separator + +;;; @ entity separator ;;; (defun mime-view-entity-separator-function (entity-node-id @@ -292,60 +318,71 @@ Please redefine this function if you want to change default setting." ))) -;;; @@ buffer local variables -;;; - -;;; @@@ in raw-buffer -;;; - -(defvar mime-raw-message-info - "Information about structure of message. -Please use reference function `mime-entity-info-SLOT' to get value of -SLOT. - -Following is a list of slots of the structure: - -node-id reversed entity-number (list of integers or t) -point-min beginning point of region in raw-buffer -point-max end point of region in raw-buffer -type media-type (symbol) -subtype media-subtype (symbol) -type/subtype media-type/subtype (string or nil) -parameters parameter of Content-Type field (association list) -encoding Content-Transfer-Encoding (string or nil) -children entities included in this entity (list of content-infos) - -If an entity includes other entities in its body, such as multipart or -message/rfc822, entity-infos of other entities are included in -`children', so entity-info become a tree.") -(make-variable-buffer-local 'mime-raw-message-info) - -(defvar mime-preview-buffer nil - "MIME-preview buffer corresponding with the (raw) buffer.") -(make-variable-buffer-local 'mime-preview-buffer) - - -;;; @@@ in preview-buffer +;;; @ acting-condition ;;; -(defvar mime-mother-buffer nil - "Mother buffer corresponding with the (MIME-preview) buffer. -If current MIME-preview buffer is generated by other buffer, such as -message/partial, it is called `mother-buffer'.") -(make-variable-buffer-local 'mime-mother-buffer) - -(defvar mime-raw-buffer nil - "Raw buffer corresponding with the (MIME-preview) buffer.") -(make-variable-buffer-local 'mime-raw-buffer) +(defvar mime-acting-condition + '(((type . text)(subtype . plain) + (method "tm-plain" nil 'file "" 'encoding 'mode 'name) + (mode "play" "print") + ) + ((type . text)(subtype . html) + (method "tm-html" nil 'file "" 'encoding 'mode 'name) + (mode . "play") + ) + ((type . text)(subtype . x-rot13-47) + (method . mime-method-to-display-caesar) + (mode . "play") + ) + ((type . text)(subtype . x-rot13-47-48) + (method . mime-method-to-display-caesar) + (mode . "play") + ) -(defvar mime-preview-original-major-mode nil - "Major-mode of mime-raw-buffer.") -(make-variable-buffer-local 'mime-preview-original-major-mode) + ((type . audio)(subtype . basic) + (method "tm-au" nil 'file "" 'encoding 'mode 'name) + (mode . "play") + ) + + ((type . image) + (method "tm-image" nil 'file "" 'encoding 'mode 'name) + (mode "play" "print") + ) + + ((type . video)(subtype . mpeg) + (method "tm-mpeg" nil 'file "" 'encoding 'mode 'name) + (mode . "play") + ) + + ((type . application)(subtype . postscript) + (method "tm-ps" nil 'file "" 'encoding 'mode 'name) + (mode "play" "print") + ) + ((type . application)(subtype . octet-stream) + (method . mime-method-to-save)(mode "play" "print") + ) -(make-variable-buffer-local 'mime-preview-original-window-configuration) + ((type . message)(subtype . external-body) + ("access-type" . "anon-ftp") + (method . mime-method-to-display-message/external-ftp) + ) + ((type . message)(subtype . rfc822) + (method . mime-method-to-display-message/rfc822) + (mode . "play") + ) + ((type . message)(subtype . partial) + (method . mime-method-to-store-message/partial) + (mode . "play") + ) + + ((method "metamail" t "-m" "tm" "-x" "-d" "-z" "-e" 'file) + (mode . "play") + ) + ((method . mime-method-to-save)(mode . "extract")) + )) -;;; @@ quitting method +;;; @ quitting method ;;; (defvar mime-preview-quitting-method-alist @@ -360,7 +397,7 @@ message/partial, it is called `mother-buffer'.") "Alist of major-mode vs. show-summary-method.") -;;; @@ following method +;;; @ following method ;;; (defvar mime-view-following-method-alist nil @@ -370,7 +407,7 @@ message/partial, it is called `mother-buffer'.") '("From")) -;;; @@ X-Face +;;; @ X-Face ;;; ;; hack from Gnus 5.0.4. @@ -402,9 +439,18 @@ The compressed face will be piped to this command.") )))) +;;; @ miscellaneous +;;; + +(defvar mime-view-uuencode-encoding-name-list '("x-uue" "x-uuencode")) + + + ;;; @ buffer setup ;;; +(defvar mime-view-redisplay nil) + (defun mime-view-setup-buffers (&optional ctl encoding ibuf obuf) (if ibuf (progn @@ -652,41 +698,6 @@ If optional argument MESSAGE-INFO is not specified, dest)) -;;; @@ predicate functions -;;; - -(defvar mime-view-childrens-header-showing-Content-Type-list - '("message/rfc822" "message/news")) - -(defun mime-view-header-visible-p (entity-node-id cinfo) - "Return non-nil if header of current entity is visible." - (or (null entity-node-id) - (member (mime-entity-info-type/subtype - (mime-raw-entity-node-id-to-entity-info - (cdr entity-node-id) cinfo)) - mime-view-childrens-header-showing-Content-Type-list) - )) - -(defun mime-view-body-visible-p (entity-node-id cinfo - media-type media-subtype) - (let ((ctype (if media-type - (if media-subtype - (format "%s/%s" media-type media-subtype) - (symbol-name media-type) - )))) - (and (member ctype mime-view-visible-media-type-list) - (if (and (eq media-type 'application) - (eq media-subtype 'octet-stream)) - (let ((ccinfo - (mime-raw-entity-node-id-to-entity-info - entity-node-id cinfo))) - (member (mime-entity-info-encoding ccinfo) - '(nil "7bit" "8bit")) - ) - t)) - )) - - ;;; @ MIME viewer mode ;;;