+1998-06-03 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-play.el (mime-raw-write-region): New implementation; refer
+ `mime-raw-representation-type' or
+ `mime-raw-representation-type-alist' instead of
+ `mime-raw-buffer-coding-system-alist'.
+
+ * mime-view.el: Abolish variable
+ `mime-raw-buffer-coding-system-alist'.
+
+1998-06-02 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-pgp.el (mime-method-for-application/pgp): Use
+ `mime-raw-representation-type-alist' instead of
+ `mime-text-decoder-alist'; set up to
+ `mime-raw-representation-type' instead of `mime-text-decoder'.
+
+ * mime-play.el (mime-method-to-display-message/rfc822): Use
+ `mime-raw-representation-type-alist' instead of
+ `mime-text-decoder-alist'; set up to
+ `mime-raw-representation-type' instead of `mime-text-decoder'.
+ (mime-method-to-display-caesar): Use
+ `mime-text-insert-decoded-body'.
+
+ * mime-text.el (mime-raw-representation-type): New variable;
+ abolish `mime-text-decoder'.
+ (mime-text-insert-decoded-body): Change interface; refer
+ `mime-raw-representation-type' or
+ `mime-raw-representation-type-alist' instead of
+ `mime-text-decoder' or `mime-text-decoder-alist'; abolish function
+ `mime-text-decode-buffer' and `mime-text-decode-buffer-maybe'.
+ (mime-preview-text/plain): Modify for new interface of
+ `mime-text-insert-decoded-body'.
+ (mime-preview-text/richtext): Modify for new interface of
+ `mime-text-insert-decoded-body'.
+ (mime-preview-text/enriched): Modify for new interface of
+ `mime-text-insert-decoded-body'.
+
+ * mime-view.el (mime-raw-representation-type-alist): New variable;
+ abolish `mime-text-decoder-alist'.
+
+1998-05-31 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-parse.el (mime-parse-multipart): fixed.
+
+\f
1998-06-01 MORIOKA Tomohiko <morioka@jaist.ac.jp>
* SEMI: Version 1.4.6 (Ny\e-Dþzen)\e-A released.
# Makefile for SEMI kernel.
#
-VERSION = 1.4.6
+VERSION = 1.5.0
PACKAGE = semi
SHELL = /bin/sh
(the-buf (current-buffer))
(mother mime-preview-buffer)
(mode major-mode)
- text-decoder)
+ representation-type)
(set-buffer (get-buffer-create new-name))
(erase-buffer)
(insert-buffer-substring the-buf start end)
(while (re-search-forward "^- -" nil t)
(replace-match "-")
)
- (setq text-decoder
- (cdr (or (assq mode mime-text-decoder-alist)
- (assq t mime-text-decoder-alist))))
+ (setq representation-type
+ (cdr (or (assq mode mime-raw-representation-type-alist)
+ (assq t mime-raw-representation-type-alist))))
)
((progn
(goto-char (point-min))
(and
(search-forward "\n\n")
(match-end 0)))
- (setq text-decoder (function mime-text-decode-buffer))
+ (setq representation-type (function mime-text-decode-buffer))
))
(setq major-mode 'mime-show-message-mode)
- (setq mime-text-decoder text-decoder)
+ (setq mime-raw-representation-type representation-type)
(save-window-excursion (mime-view-mode mother))
(set-window-buffer p-win mime-preview-buffer)
))
-;; (ctree-set-calist-strictly
-;; 'mime-preview-condition '((type . application)(subtype . pgp)
-;; (message-button . visible)))
-
-;; (ctree-set-calist-strictly
-;; 'mime-acting-condition '((type . application)(subtype . pgp)
-;; (method . mime-method-for-application/pgp)))
-
-;; (ctree-set-calist-strictly
-;; 'mime-acting-condition '((type . text)(subtype . x-pgp)
-;; (method . mime-method-for-application/pgp)))
-
;;; @ Internal method for multipart/signed
;;;
(cdr (assq 'mode cal)) ; play-mode
))
-;; (ctree-set-calist-strictly
-;; 'mime-acting-condition
-;; '((type . multipart)(subtype . signed)
-;; (method . mime-method-to-verify-multipart/signed)))
-
;;; @ Internal method for application/pgp-signature
;;;
(delete-file sig-file)
))
-;; (ctree-set-calist-strictly
-;; 'mime-acting-condition
-;; '((type . application)(subtype . pgp-signature)
-;; (method . mime-method-to-verify-application/pgp-signature)))
-
;;; @ Internal method for application/pgp-encrypted
;;;
(mime-method-for-application/pgp obeg oend cal)
))
-;; (ctree-set-calist-strictly
-;; 'mime-acting-condition
-;; '((type . application)(subtype . pgp-encrypted)
-;; (method . mime-method-to-decrypt-application/pgp-encrypted)))
-
;;; @ Internal method for application/pgp-keys
;;;
(kill-buffer (current-buffer))
))
-;; (ctree-set-calist-strictly
-;; 'mime-acting-condition
-;; '((type . application)(subtype . pgp-keys)
-;; (method . mime-method-to-add-application/pgp-keys)))
-
;;; @ end
;;;
(let* ((cnum (mime-raw-point-to-entity-number beg))
(new-name (format "%s-%s" (buffer-name) cnum))
(mother mime-preview-buffer)
- (text-decoder
- (cdr (or (assq major-mode mime-text-decoder-alist)
- (assq t mime-text-decoder-alist))))
+ (representation-type
+ (cdr (or (assq major-mode mime-raw-representation-type-alist)
+ (assq t mime-raw-representation-type-alist))))
str)
(setq str (buffer-substring beg end))
(switch-to-buffer new-name)
(delete-region (point-min) (match-end 0))
)
(setq major-mode 'mime-show-message-mode)
- (setq mime-text-decoder text-decoder)
+ (setq mime-raw-representation-type representation-type)
(mime-view-mode mother)
))
"Write current region into specified file.
When called from a program, takes three arguments:
START, END and FILENAME. START and END are buffer positions.
-It refer `mime-raw-buffer-coding-system-alist' to choose coding-system
-to write."
- (let ((coding-system-for-write
- (cdr
- (or (assq major-mode mime-raw-buffer-coding-system-alist)
- (assq t mime-raw-buffer-coding-system-alist)
- ))))
- (write-region start end filename)
- ))
+It refer `mime-raw-representation-type' or `major-mode
+mime-raw-representation-type-alist'. If it is `binary', region is
+saved as binary. Otherwise the region is saved by `write-region'."
+ (let ((presentation-type
+ (or mime-raw-representation-type
+ (cdr (or (assq major-mode mime-raw-representation-type-alist)
+ (assq t mime-raw-representation-type-alist))))))
+ (if (eq presentation-type 'binary)
+ (write-region-as-binary start end filename)
+ (write-region start end filename)
+ )))
(defun mime-method-to-store-message/partial (beg end cal)
(goto-char beg)
(defun mime-method-to-display-caesar (start end cal)
"Internal method for mime-view to display ROT13-47-48 message."
- (let* ((cnum (mime-raw-point-to-entity-number start))
+ (let* ((entity (mime-raw-find-entity-from-point start))
+ (cnum (reverse (mime-entity-node-id entity)))
(new-name (format "%s-%s" (buffer-name) cnum))
(the-buf (current-buffer))
(mother mime-preview-buffer)
(charset (cdr (assoc "charset" cal)))
(encoding (cdr (assq 'encoding cal)))
- (mode major-mode)
- )
+ (mode major-mode))
(let ((pwin (or (get-buffer-window mother)
(get-largest-window)))
(buf (get-buffer-create new-name))
)
(setq buffer-read-only nil)
(erase-buffer)
- (insert-buffer-substring the-buf start end)
- (goto-char (point-min))
- (if (re-search-forward "^\n" nil t)
- (delete-region (point-min) (match-end 0))
- )
- (let ((m (cdr (or (assq mode mime-text-decoder-alist)
- (assq t mime-text-decoder-alist)))))
- (and (functionp m)
- (funcall m charset encoding)
- ))
+ (mime-text-insert-decoded-body entity)
(mule-caesar-region (point-min) (point-max))
(set-buffer-modified-p nil)
(set-buffer mother)
;;; @ buffer local variables in raw-buffer
;;;
-(defvar mime-text-decoder nil
- "Function to decode text in current buffer.
-Interface of the function is (CHARSET &optional ENCODING).
-CHARSET is symbol of MIME charset and ENCODING is value of
-Content-Transfer-Encoding.
-
+(defvar mime-raw-representation-type nil
+ "Representation-type of mime-raw-buffer.
+It must be nil, `binary' or `cooked'.
+If it is nil, `mime-raw-representation-type-alist' is used as default
+value.
Notice that this variable is usually used as buffer local variable in
raw-buffer.")
-(make-variable-buffer-local 'mime-text-decoder)
+(make-variable-buffer-local 'mime-raw-representation-type)
;;; @ code conversion
;;;
-(defun mime-text-decode-buffer (charset &optional encoding)
- "Decode text of current buffer as CHARSET.
-It code-converts current buffer from network representation specified
-by MIME CHARSET to internal code. CHARSET is symbol of MIME charset.
-See also variable `mime-charset-coding-system-alist'."
- (decode-mime-charset-region (point-min)(point-max)
- (or charset default-mime-charset))
- )
-
-(defun mime-text-decode-buffer-maybe (charset &optional encoding)
- "Decode text of current buffer as CHARSET if ENCODING is actual encoding.
-It code-converts current buffer from network representation specified
-by MIME CHARSET to internal code if ENCODING is not nil, \"7bit\",
-\"8bit\" or \"binary\". CHARSET is symbol of MIME charset.
-See also variable `mime-charset-coding-system-alist'."
- (or (member encoding '(nil "7bit" "8bit" "binary"))
- (mime-text-decode-buffer charset)
- ))
-
-(defun mime-text-insert-decoded-body (entity situation)
+(defun mime-text-insert-decoded-body (entity)
"Insert text body of ENTITY in SITUATION.
It decodes MIME-encoding then code-converts as MIME-charset.
MIME-encoding is value of field 'encoding of SITUATION. It must be
'nil or string. MIME-charset is value of field \"charset\" of
-SITUATION. It must be symbol.
-This function calls text-decoder for MIME-charset specified by buffer
-local variable `mime-text-decoder' and variable
-`mime-text-decoder-alist'."
- (insert-buffer-substring mime-raw-buffer
- (mime-entity-body-start entity)
- (mime-entity-body-end entity))
- (let ((encoding (cdr (assq 'encoding situation))))
- (mime-decode-region (point-min) (point-max) encoding)
- (goto-char (point-min))
- (while (search-forward "\r\n" nil t)
- (replace-match "\n")
- )
- (let ((text-decoder
- (save-excursion
- (set-buffer mime-raw-buffer)
- (or mime-text-decoder
- (cdr (or (assq major-mode mime-text-decoder-alist)
- (assq t mime-text-decoder-alist)))
- ))))
- (and (functionp text-decoder)
- (funcall text-decoder (cdr (assoc "charset" situation)) encoding)
- ))
- (run-hooks 'mime-text-decode-hook)
- ))
+SITUATION. It must be symbol."
+ (let ((presentation-type
+ (save-excursion
+ (set-buffer mime-raw-buffer)
+ (or mime-raw-representation-type
+ (cdr (or (assq major-mode mime-raw-representation-type-alist)
+ (assq t mime-raw-representation-type-alist)))
+ ))))
+ (save-restriction
+ (insert-buffer-substring mime-raw-buffer
+ (mime-entity-body-start entity)
+ (mime-entity-body-end entity))
+ (let ((encoding (mime-entity-encoding entity)))
+ (mime-decode-region (point-min) (point-max) encoding)
+ (if (or (eq presentation-type 'binary)
+ (not (member encoding '(nil "7bit" "8bit" "binary"))))
+ (decode-mime-charset-region (point-min)(point-max)
+ (or (mime-content-type-parameter
+ (mime-entity-content-type entity)
+ "charset")
+ default-mime-charset))
+ ))))
+ (run-hooks 'mime-text-decode-hook)
+ )
;;; @ for URL
(defun mime-preview-text/plain (entity situation)
(save-restriction
(narrow-to-region (point-max)(point-max))
- (mime-text-insert-decoded-body entity situation)
+ (mime-text-insert-decoded-body entity)
(goto-char (point-max))
(if (not (eq (char-after (1- (point))) ?\n))
(insert "\n")
(defun mime-preview-text/richtext (entity situation)
(save-restriction
(narrow-to-region (point-max)(point-max))
- (mime-text-insert-decoded-body entity situation)
+ (mime-text-insert-decoded-body entity)
(let ((beg (point-min)))
(remove-text-properties beg (point-max) '(face nil))
(richtext-decode beg (point-max))
(defun mime-preview-text/enriched (entity situation)
(save-restriction
(narrow-to-region (point-max)(point-max))
- (mime-text-insert-decoded-body entity situation)
+ (mime-text-insert-decoded-body entity)
(let ((beg (point-min)))
(remove-text-properties beg (point-max) '(face nil))
(enriched-decode beg (point-max))
(autoload 'mime-preview-text/enriched "mime-text")
(autoload 'mime-preview-text/richtext "mime-text")
-(defvar mime-text-decoder-alist
- '((mime-show-message-mode . mime-text-decode-buffer)
- (mime-temp-message-mode . mime-text-decode-buffer)
- (t . mime-text-decode-buffer-maybe)
+(defvar mime-raw-representation-type-alist
+ '((mime-show-message-mode . binary)
+ (mime-temp-message-mode . binary)
+ (t . cooked)
)
- "Alist of major-mode vs. mime-text-decoder.
-Each element looks like (SYMBOL . FUNCTION). SYMBOL is major-mode or
-t. t means default.
-
-Specification of FUNCTION is described in DOC-string of variable
-`mime-text-decoder'.
-
-This value is overridden by buffer local variable `mime-text-decoder'
-if it is not nil.")
+ "Alist of major-mode vs. representation-type of mime-raw-buffer.
+Each element looks like (SYMBOL . REPRESENTATION-TYPE). SYMBOL is
+major-mode or t. t means default. REPRESENTATION-TYPE must be
+`binary' or `cooked'.
+This value is overridden by buffer local variable
+`mime-raw-representation-type' if it is not nil.")
(defvar mime-view-announcement-for-message/partial
(defvar mime-view-uuencode-encoding-name-list '("x-uue" "x-uuencode"))
-(defvar mime-raw-buffer-coding-system-alist
- `((t . ,(mime-charset-to-coding-system default-mime-charset)))
- "Alist of major-mode vs. corresponding coding-system of `mime-raw-buffer'.")
-
;;; @ buffer setup
;;;
(eval-when-compile (require 'cl))
-(defconst mime-module-version '("SEMI" "Ny\e,D~\e(Bzen" 1 4 6)
+(defconst mime-module-version '("SEMI" "Nishi-Ny\e,D~\e(Bzen" 1 5 0)
"Implementation name, version name and numbers of MIME-kernel package.")
(autoload 'mule-caesar-region "mule-caesar"