From e9dbf507f42b515dc37e1d34d362605fc7433f8c Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 4 Jun 1998 05:59:22 +0000 Subject: [PATCH] Sync up with SEMI 1.5.0. --- ChangeLog | 50 +++++++++++++++++++++++++++++++++ Makefile | 2 +- README.en | 2 +- VERSION | 8 +++--- mime-pgp.el | 44 ++++------------------------- mime-play.el | 45 +++++++++++++---------------- mime-text.el | 89 ++++++++++++++++++++++------------------------------------ mime-view.el | 27 +++++++----------- semi-def.el | 2 +- 9 files changed, 126 insertions(+), 143 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90ae913..d0936cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,53 @@ +1998-06-04 MORIOKA Tomohiko + + * README.en (Required environment): Modify for FLIM 1.3.0. + +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-03 MORIOKA Tomohiko * WEMI: Version 1.4.6 (K-Dòzu)-A released. diff --git a/Makefile b/Makefile index 86ba501..437d693 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Makefile for WEMI. # -VERSION = 1.4.6 +VERSION = 1.5.0 PACKAGE = wemi SHELL = /bin/sh diff --git a/README.en b/README.en index 5ee3aa7..a491786 100644 --- a/README.en +++ b/README.en @@ -48,7 +48,7 @@ Required environment nil. (Maybe non mule setting requires to modify emu. In addition, it is better to use terminal-coding-system feature) - SEMI requires APEL (8.7 or later) and FLIM (1.2.0 or later) package. + SEMI requires APEL (8.7 or later) and FLIM (1.3.0 or later) package. Please install them before installing it. APEL package is available at: diff --git a/VERSION b/VERSION index 00f1edb..fa006b1 100644 --- a/VERSION +++ b/VERSION @@ -50,7 +50,7 @@ 1.4.4 Ecch-Dþ-Miyazaki-A $(B1[Cf5\:j(B 1.4.5 Tomari $(BGq(B 1.4.6 Ny-Dþzen-A $(BF~A1(B ------ Nishi-Ny-Dþzen-A $(B@>F~A1(B +1.5.0 Nishi-Ny-Dþzen-A $(B@>F~A1(B ----- Ikuji $(B@8CO(B ----- Kurobe $(B9uIt(B ----- Uozu $(B5{DE(B ; <=> $(BIY;3COJ}E4F;(B @@ -100,7 +100,7 @@ 1.4.4 -DÒiso-A $(BBg0k(B 1.4.5 Ninomiya $BFs5\(B 1.4.6 K-Dòzu-A $(B9qI\DE(B ; = JR $(B8fEB>l@~(B ------ Kamonomiya $B3{5\(B +1.5.0 Kamonomiya $B3{5\(B ----- Odawara $(B>.ED86(B ; <=> $(B>.ED5^!"H":,EP;3E4F;!"0KF&H":,E4F;(B : : : ----- Atami $(BG.3$(B ; = JR $(B0KEl@~(B @@ -140,8 +140,8 @@ ;; Himi Line $(BI98+@~(B ;;------------------------------------------------------------------------- 1.4.0 Himi $(BI98+(B -1.4.1 Shimao $(BEgHx(B -------- Amaharashi $(B1+@2(B +1.5.0 Shimao $(BEgHx(B +1.5.1 Amaharashi $(B1+@2(B ------- Ecch-Dþ-Kokubu-A $(B1[Cf9qJ,(B ------- Fushiki $(BIzLZ(B ------- Noumachi $(BG=D.(B 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 7543940..a7aed39 100644 --- a/mime-text.el +++ b/mime-text.el @@ -31,70 +31,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 bf164ab..637b148 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 @@ -692,10 +689,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 bc294ea..8e5c412 100644 --- a/semi-def.el +++ b/semi-def.el @@ -29,7 +29,7 @@ (eval-when-compile (require 'cl)) -(defconst mime-module-version '("WEMI" "K-Dòzu-A" 1 4 6) +(defconst mime-module-version '("WEMI" "Kamonomiya" 1 5 0) "Implementation name, version name and numbers of MIME-kernel package.") (autoload 'mule-caesar-region "mule-caesar" -- 1.7.10.4