From: morioka Date: Thu, 4 Jun 1998 04:09:11 +0000 (+0000) Subject: Sync up with remi-1_5_0_9. X-Git-Tag: semi-1_5_0~4 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=d8bc2992c78ebbc2d668167c97b9505335828dd7;p=elisp%2Fsemi.git Sync up with remi-1_5_0_9. --- diff --git a/ChangeLog b/ChangeLog index 7f8d509..a8bd5e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,49 @@ +1998-06-03 MORIOKA Tomohiko + + * 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 + + * 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 + + * mime-parse.el (mime-parse-multipart): fixed. + + 1998-06-01 MORIOKA Tomohiko * SEMI: Version 1.4.6 (Ny-Dþzen)-A released. diff --git a/Makefile b/Makefile index e89f717..0c0e55b 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Makefile for SEMI kernel. # -VERSION = 1.4.6 +VERSION = 1.5.0 PACKAGE = semi SHELL = /bin/sh diff --git a/mime-pgp.el b/mime-pgp.el index c2c3f24..8aa0c40 100644 --- a/mime-pgp.el +++ b/mime-pgp.el @@ -61,7 +61,7 @@ (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) @@ -83,9 +83,9 @@ (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)) @@ -96,26 +96,14 @@ (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 ;;; @@ -131,11 +119,6 @@ (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 ;;; @@ -235,11 +218,6 @@ It should be ISO 639 2 letter language code such as en, ja, ...") (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 ;;; @@ -260,11 +238,6 @@ It should be ISO 639 2 letter language code such as en, ja, ...") (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 ;;; @@ -289,11 +262,6 @@ It should be ISO 639 2 letter language code such as en, ja, ...") (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 ;;; diff --git a/mime-play.el b/mime-play.el index a7326a0..cbcf623 100644 --- a/mime-play.el +++ b/mime-play.el @@ -420,9 +420,9 @@ It is registered to variable `mime-preview-quitting-method-alist'." (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) @@ -433,7 +433,7 @@ It is registered to variable `mime-preview-quitting-method-alist'." (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) )) @@ -445,15 +445,17 @@ It is registered to variable `mime-preview-quitting-method-alist'." "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) @@ -606,14 +608,14 @@ to write." (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)) @@ -624,16 +626,7 @@ to write." ) (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) diff --git a/mime-text.el b/mime-text.el index 8d3021f..c60b097 100644 --- a/mime-text.el +++ b/mime-text.el @@ -30,70 +30,49 @@ ;;; @ 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 @@ -138,7 +117,7 @@ local variable `mime-text-decoder' and variable (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") @@ -150,7 +129,7 @@ local variable `mime-text-decoder' and variable (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)) @@ -159,7 +138,7 @@ local variable `mime-text-decoder' and variable (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)) diff --git a/mime-view.el b/mime-view.el index 03bdcbf..24a5c70 100644 --- a/mime-view.el +++ b/mime-view.el @@ -459,20 +459,17 @@ Each elements are regexp of field-name.") (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 @@ -691,10 +688,6 @@ The compressed face will be piped to this command.") (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 ;;; diff --git a/semi-def.el b/semi-def.el index 3a6a2d6..fc6355c 100644 --- a/semi-def.el +++ b/semi-def.el @@ -29,7 +29,7 @@ (eval-when-compile (require 'cl)) -(defconst mime-module-version '("SEMI" "Ny,D~(Bzen" 1 4 6) +(defconst mime-module-version '("SEMI" "Nishi-Ny,D~(Bzen" 1 5 0) "Implementation name, version name and numbers of MIME-kernel package.") (autoload 'mule-caesar-region "mule-caesar"