Sync up with remi-1_6_0.
authormorioka <morioka>
Fri, 12 Jun 1998 07:20:50 +0000 (07:20 +0000)
committermorioka <morioka>
Fri, 12 Jun 1998 07:20:50 +0000 (07:20 +0000)
ChangeLog
Makefile
mime-edit.el
mime-mc.el
mime-partial.el
mime-pgp.el
mime-play.el
mime-view.el
mime-w3.el
semi-def.el

index 058cf25..6ce9c4b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,139 @@
+1998-06-12  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * REMI: Version 1.6.0 (Amaharashi) released.
+
+       * mime-w3.el (mime-save-background-color): New macro.
+       (mime-preview-text/html): Use `mime-save-background-color'.
+
+1998-06-11  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-edit.el: Abolish variable `mime-edit-signing-type' and
+       `mime-edit-encrypting-type'.
+       (mime-edit-process-multipart-1): Separate "signed" to "pgp-signed"
+       and "kazu-signed"; separate "encrypted" to "pgp-encrypted" and
+       "kazu-encrypted".
+       (mime-edit-enclose-signed-region): Renamed from
+       `mime-edit-enclose-pgp-signed-region'.
+       (mime-edit-enclose-pgp-encrypted-region): Renamed from
+       `mime-edit-enclose-encrypted-region'.
+       (mime-edit-enclose-kazu-signed-region): New function.
+       (mime-edit-enclose-kazu-encrypted-region): New function.
+       (mime-edit-set-sign): Don't refer `mime-edit-signing-type'.
+       (mime-edit-set-encrypt): Don't refer `mime-edit-encrypting-type'.
+
+1998-06-11  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-edit.el (mime-edit-sign-pgp-kazu): Abolish unused local
+       variable.
+       (mime-edit-encrypt-pgp-kazu): Abolish unused local variables.
+
+1998-06-11  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-pgp.el (mime-method-for-application/pgp): Change interface.
+       (mime-method-to-verify-multipart/signed): Change interface.
+       (mime-method-to-verify-application/pgp-signature): Change
+       interface.
+       (mime-method-to-decrypt-application/pgp-encrypted): Change
+       interface.
+       (mime-method-to-add-application/pgp-keys): Change interface.
+
+       * mime-partial.el (mime-method-to-combine-message/partial-pieces):
+       Change interface.
+
+       * mime-play.el (mime-raw-play-entity): Change interface of
+       internal-method.
+       (mime-method-to-save): Change interface.
+       (mime-method-to-display-message/rfc822): Change interface.
+       (mime-method-to-store-message/partial): Change interface.
+       (mime-method-to-display-message/external-ftp): Change interface.
+       (mime-method-to-display-caesar): Change interface.
+
+1998-06-11  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-edit.el (mime-edit-normalize-body): Use
+       `mime-charset-type-list' directly; abolish local variable
+       `mime-edit-charset-default-encoding-alist' and function
+       `mime-make-charset-default-encoding-alist'.
+       (mime-edit-toggle-transfer-level): Don't set up
+       `mime-edit-charset-default-encoding-alist'.
+
+1998-06-11  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-view.el (mime-view-display-message): Set up
+       `mime-raw-message-info'.
+       (mime-view-buffer): New function.
+       (mime-view-mode): Don't set up `mime-raw-message-info'.
+
+1998-06-11  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-edit.el (mime-charset-type-list): Use base64 for cn-gb2312
+       and gb2312.
+       (mime-edit-normalize-body): If encoding is not specified for
+       charset, use quoted-printable or 8bit for mime-transfer-level is 7
+       or 8.
+
+       * mime-edit.el (mime-charset-type-list): Add `shift_jis'.
+
+1998-06-10  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-view.el (mime-view-display-message): Use
+       `mime-maybe-hide-echo-buffer'.
+       (mime-view-mode): Don't use `mime-maybe-hide-echo-buffer'.
+
+       * mime-view.el (mime-view-display-message): Move point to top of
+       body; run `mime-view-mode-hook'.
+       (mime-view-mode): Don't move point; don't run
+       `mime-view-mode-hook'.
+
+       * mime-view.el (mime-view-display-message): Add new optional
+       argument `default-keymap-or-function'.
+       (mime-view-mode): Modify for `mime-view-display-message'.
+
+       * mime-view.el (mime-view-display-message): Add new optional
+       argument `mother'; set to `mime-mother-buffer'.
+       (mime-view-mode): Modify for `mime-view-display-message'.
+
+1998-06-10  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-mc.el: Use `eval-and-compile' to load "mc-pgp".
+
+       * mime-view.el (mime-preview-multipart/mixed): Modify for
+       `mime-view-display-entity'; don't refer `mime-raw-buffer'.
+       (mime-preview-multipart/alternative): Modify for
+       `mime-view-display-entity'; don't refer `mime-raw-buffer'.
+       (mime-view-display-entity): Change interface to abolish argument
+       for raw-buffer; don't refer `mime-raw-buffer'.
+       (mime-view-display-message): Abolish variable
+       `mime-preview-original-major-mode'; modify for
+       `mime-view-display-entity'.
+       (mime-preview-original-major-mode): New implementation; add
+       optional argument `recursive'.
+       (mime-preview-follow-current-entity): Modify for
+       `mime-preview-original-major-mode'.
+       (mime-preview-move-to-next): Use function
+       `mime-preview-original-major-mode'.
+       (mime-preview-scroll-up-entity): Use function
+       `mime-preview-original-major-mode'.
+       (mime-preview-scroll-down-entity): Use function
+       `mime-preview-original-major-mode'.
+       (mime-preview-quit): Use function
+       `mime-preview-original-major-mode'.
+       (mime-preview-show-summary): Use function
+       `mime-preview-original-major-mode'.
+
+       * mime-view.el (mime-view-display-message): New function; abolish
+       function `mime-view-setup-buffers'.
+       (mime-view-mode): Use `mime-view-display-message'.
+
+1998-06-10  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-play.el (mime-raw-play-entity): Use
+       `mime-entity-situation'.
+
+       * mime-view.el (mime-entity-situation): New function.
+       (mime-preview-multipart/alternative): Use `mime-entity-situation'.
+       (mime-view-display-entity): Use `mime-entity-situation'.
+
 1998-06-10  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
 
        * mime-edit.el (mime-edit-enclose-region-internal): Abolish unused
index 94db836..4f48a5e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,8 @@
 # Makefile for SEMI kernel.
 #
 
-VERSION = 1.5.4
 PACKAGE = semi
+VERSION = 1.6.0
 
 SHELL  = /bin/sh
 MAKE   = make
index bb48d9c..4924c8d 100644 (file)
@@ -441,10 +441,11 @@ If encoding is nil, it is determined from its contents."
     (iso-2022-jp       7 "base64")
     (iso-2022-kr       7 "base64")
     (euc-kr            8 "base64")
-    (cn-gb2312         8 "quoted-printable")
+    (cn-gb2312         8 "base64")
+    (gb2312            8 "base64")
     (cn-big5           8 "base64")
-    (gb2312            8 "quoted-printable")
     (big5              8 "base64")
+    (shift_jis         8 "base64")
     (iso-2022-jp-2     7 "base64")
     (iso-2022-int-1    7 "base64")
     ))
@@ -464,23 +465,6 @@ If encoding is nil, it is determined from its contents."
   "A string formatted version of mime-transfer-level")
 (make-variable-buffer-local 'mime-transfer-level-string)
 
-(defun mime-make-charset-default-encoding-alist (transfer-level)
-  (mapcar (function
-          (lambda (charset-type)
-            (let ((charset  (car charset-type))
-                  (type     (nth 1 charset-type))
-                  (encoding (nth 2 charset-type))
-                  )
-              (if (<= type transfer-level)
-                  (cons charset (mime-encoding-name type))
-                (cons charset encoding)
-                ))))
-         mime-charset-type-list))
-
-(defvar mime-edit-charset-default-encoding-alist
-  (mime-make-charset-default-encoding-alist mime-transfer-level))
-(make-variable-buffer-local 'mime-edit-charset-default-encoding-alist)
-
 
 ;;; @@ about message inserting
 ;;;
@@ -533,16 +517,6 @@ If it is not specified for a major-mode,
 (defvar mime-edit-news-reply-mode-server-running nil)
 
 
-;;; @@ about PGP
-;;;
-
-(defvar mime-edit-signing-type 'pgp-mime
-  "*PGP signing type (pgp-mime, pgp-kazu or nil).")
-
-(defvar mime-edit-encrypting-type 'pgp-mime
-  "*PGP encrypting type (pgp-mime, pgp-kazu or nil).")
-
-
 ;;; @@ about tag
 ;;;
 
@@ -677,9 +651,9 @@ Tspecials means any character that matches with it in header must be quoted.")
 (define-key mime-edit-mode-enclosure-map
   "\C-d" 'mime-edit-enclose-digest-region)
 (define-key mime-edit-mode-enclosure-map
-  "\C-s" 'mime-edit-enclose-signed-region)
+  "\C-s" 'mime-edit-enclose-pgp-signed-region)
 (define-key mime-edit-mode-enclosure-map
-  "\C-e" 'mime-edit-enclose-encrypted-region)
+  "\C-e" 'mime-edit-enclose-pgp-encrypted-region)
 (define-key mime-edit-mode-enclosure-map
   "\C-q" 'mime-edit-enclose-quote-region)
 
@@ -707,8 +681,8 @@ Tspecials means any character that matches with it in header must be quoted.")
     (parallel  "Enclose as parallel"   mime-edit-enclose-parallel-region)
     (mixed     "Enclose as serial"     mime-edit-enclose-mixed-region)
     (digest    "Enclose as digest"     mime-edit-enclose-digest-region)
-    (signed    "Enclose as signed"     mime-edit-enclose-signed-region)
-    (encrypted "Enclose as encrypted"  mime-edit-enclose-encrypted-region)
+    (signed    "Enclose as signed"     mime-edit-enclose-pgp-signed-region)
+    (encrypted "Enclose as encrypted"  mime-edit-enclose-pgp-encrypted-region)
     (quote     "Verbatim region"       mime-edit-enclose-quote-region)
     (key       "Insert Public Key"     mime-edit-insert-key)
     (split     "About split"           mime-edit-set-split)
@@ -826,24 +800,27 @@ Following commands are available in addition to major mode commands:
 \\[mime-edit-insert-tag]       insert a new MIME tag.
 
 \[make enclosure (maybe multipart)\]
-\\[mime-edit-enclose-alternative-region]       enclose as multipart/alternative.
-\\[mime-edit-enclose-parallel-region]  enclose as multipart/parallel.
-\\[mime-edit-enclose-mixed-region]     enclose as multipart/mixed.
-\\[mime-edit-enclose-digest-region]    enclose as multipart/digest.
-\\[mime-edit-enclose-signed-region]    enclose as PGP signed.
-\\[mime-edit-enclose-encrypted-region] enclose as PGP encrypted.
-\\[mime-edit-enclose-quote-region]     enclose as verbose mode (to avoid to expand tags)
+\\[mime-edit-enclose-alternative-region]   enclose as multipart/alternative.
+\\[mime-edit-enclose-parallel-region]     enclose as multipart/parallel.
+\\[mime-edit-enclose-mixed-region]        enclose as multipart/mixed.
+\\[mime-edit-enclose-digest-region]       enclose as multipart/digest.
+\\[mime-edit-enclose-pgp-signed-region]           enclose as PGP signed.
+\\[mime-edit-enclose-pgp-encrypted-region] enclose as PGP encrypted.
+\\[mime-edit-enclose-quote-region]        enclose as verbose mode
+                                          (to avoid to expand tags)
 
 \[other commands\]
 \\[mime-edit-set-transfer-level-7bit]  set transfer-level as 7.
 \\[mime-edit-set-transfer-level-8bit]  set transfer-level as 8.
-\\[mime-edit-set-split]        set message splitting mode.
-\\[mime-edit-set-sign] set PGP-sign mode.
-\\[mime-edit-set-encrypt]      set PGP-encryption mode.
-\\[mime-edit-preview-message]  preview editing MIME message.
-\\[mime-edit-exit]     exit and translate into a MIME compliant message.
-\\[mime-edit-help]     show this help.
-\\[mime-edit-maybe-translate]  exit and translate if in MIME mode, then split.
+\\[mime-edit-set-split]                        set message splitting mode.
+\\[mime-edit-set-sign]                 set PGP-sign mode.
+\\[mime-edit-set-encrypt]              set PGP-encryption mode.
+\\[mime-edit-preview-message]          preview editing MIME message.
+\\[mime-edit-exit]                     exit and translate into a MIME
+                                       compliant message.
+\\[mime-edit-help]                     show this help.
+\\[mime-edit-maybe-translate]          exit and translate if in MIME mode,
+                                       then split.
 
 Additional commands are available in some major modes:
 C-c C-c                exit, translate and run the original command.
@@ -1620,21 +1597,18 @@ Parameter must be '(PROMPT CHOICE1 (CHOISE2 ...))."
          (cond ((string-equal type "quote")
                 (mime-edit-enquote-region bb eb)
                 )
-               ((string-equal type "signed")
-                (cond ((eq mime-edit-signing-type 'pgp-mime)
-                       (mime-edit-sign-pgp-mime bb eb boundary)
-                       )
-                      ((eq mime-edit-signing-type 'pgp-kazu)
-                       (mime-edit-sign-pgp-kazu bb eb boundary)
-                       ))
+               ((string-equal type "pgp-signed")
+                (mime-edit-sign-pgp-mime bb eb boundary)
+                )
+               ((string-equal type "pgp-encrypted")
+                (mime-edit-encrypt-pgp-mime bb eb boundary)
+                )
+               ((string-equal type "kazu-signed")
+                (mime-edit-sign-pgp-kazu bb eb boundary)
+                )
+               ((string-equal type "kazu-encrypted")
+                (mime-edit-encrypt-pgp-kazu bb eb boundary)
                 )
-               ((string-equal type "encrypted")
-                (cond ((eq mime-edit-encrypting-type 'pgp-mime)
-                       (mime-edit-encrypt-pgp-mime bb eb boundary)
-                       )
-                      ((eq mime-edit-encrypting-type 'pgp-kazu)
-                       (mime-edit-encrypt-pgp-kazu bb eb boundary)
-                       )))
                (t
                 (setq boundary
                       (nth 2 (mime-edit-translate-region bb eb
@@ -1773,9 +1747,7 @@ Content-Transfer-Encoding: 7bit
       (let* ((ret
              (mime-edit-translate-region beg end boundary))
             (ctype    (car ret))
-            (encoding (nth 1 ret))
-            (parts    (nth 3 ret))
-            )
+            (encoding (nth 1 ret)))
        (goto-char beg)
        (insert (format "Content-Type: %s\n" ctype))
        (if encoding
@@ -1795,10 +1767,9 @@ Content-Transfer-Encoding: 7bit
 
 (defun mime-edit-encrypt-pgp-kazu (beg end boundary)
   (save-excursion
-    (let (from recipients header)
+    (let (recipients header)
       (let ((ret (mime-edit-make-encrypt-recipient-header)))
-       (setq from (aref ret 0)
-             recipients (aref ret 1)
+       (setq recipients (aref ret 1)
              header (aref ret 2))
        )
       (save-restriction
@@ -1806,9 +1777,7 @@ Content-Transfer-Encoding: 7bit
        (let* ((ret
                (mime-edit-translate-region beg end boundary))
               (ctype    (car ret))
-              (encoding (nth 1 ret))
-              (parts    (nth 3 ret))
-              )
+              (encoding (nth 1 ret)))
          (goto-char beg)
          (insert header)
          (insert (format "Content-Type: %s\n" ctype))
@@ -2043,12 +2012,17 @@ Content-Transfer-Encoding: 7bit
        ;; Define encoding and encode text if necessary.
        (or encoding    ;Encoding is not specified.
            (let* ((encoding
-                   (cdr
-                    (assq charset
-                          mime-edit-charset-default-encoding-alist)
-                    ))
-                  (beg (mime-edit-content-beginning))
-                  )
+                   (let (bits conv)
+                     (let ((ret (cdr (assq charset mime-charset-type-list))))
+                       (if ret
+                           (setq bits (car ret)
+                                 conv (nth 1 ret))
+                         (setq bits 8
+                               conv "quoted-printable")))
+                     (if (<= bits mime-transfer-level)
+                         (mime-encoding-name bits)
+                       conv)))
+                  (beg (mime-edit-content-beginning)))
              (encode-mime-charset-region beg (mime-edit-content-end)
                                          charset)
              ;; Protect "From " in beginning of line
@@ -2215,19 +2189,25 @@ and insert data encoded as ENCODING."
   (mime-edit-enclose-region-internal 'alternative beg end)
   )
 
-(defun mime-edit-enclose-signed-region (beg end)
+(defun mime-edit-enclose-pgp-signed-region (beg end)
   (interactive "*r")
-  (if mime-edit-signing-type
-      (mime-edit-enclose-region-internal 'signed beg end)
-    (message "Please specify signing type.")
-    ))
+  (mime-edit-enclose-region-internal 'pgp-signed beg end)
+  )
 
-(defun mime-edit-enclose-encrypted-region (beg end)
+(defun mime-edit-enclose-pgp-encrypted-region (beg end)
   (interactive "*r")
-  (if mime-edit-signing-type
-      (mime-edit-enclose-region-internal 'encrypted beg end)
-    (message "Please specify encrypting type.")
-    ))
+  (mime-edit-enclose-region-internal 'pgp-encrypted beg end)
+  )
+
+(defun mime-edit-enclose-kazu-signed-region (beg end)
+  (interactive "*r")
+  (mime-edit-enclose-region-internal 'kazu-signed beg end)
+  )
+
+(defun mime-edit-enclose-kazu-encrypted-region (beg end)
+  (interactive "*r")
+  (mime-edit-enclose-region-internal 'kazu-encrypted beg end)
+  )
 
 (defun mime-edit-insert-key (&optional arg)
   "Insert a pgp public key."
@@ -2263,8 +2243,6 @@ Optional TRANSFER-LEVEL is a number of transfer-level, 7 or 8."
        (setq mime-transfer-level 8)
       (setq mime-transfer-level 7)
       ))
-  (setq mime-edit-charset-default-encoding-alist
-       (mime-make-charset-default-encoding-alist mime-transfer-level))
   (message (format "Current transfer-level is %d bit"
                   mime-transfer-level))
   (setq mime-transfer-level-string
@@ -2286,18 +2264,18 @@ Optional TRANSFER-LEVEL is a number of transfer-level, 7 or 8."
 ;;; @ pgp
 ;;;
 
+(defvar mime-edit-pgp-processing nil)
+(make-variable-buffer-local 'mime-edit-pgp-processing)
+
 (defun mime-edit-set-sign (arg)
   (interactive
    (list
     (y-or-n-p "Do you want to sign? ")
     ))
   (if arg
-      (if mime-edit-signing-type
-         (progn
-           (setq mime-edit-pgp-processing 'sign)
-           (message "This message will be signed.")
-           )
-       (message "Please specify signing type.")
+      (progn
+       (setq mime-edit-pgp-processing 'sign)
+       (message "This message will be signed.")
        )
     (if (eq mime-edit-pgp-processing 'sign)
        (setq mime-edit-pgp-processing nil)
@@ -2311,12 +2289,9 @@ Optional TRANSFER-LEVEL is a number of transfer-level, 7 or 8."
     (y-or-n-p "Do you want to encrypt? ")
     ))
   (if arg
-      (if mime-edit-encrypting-type
-         (progn
-           (setq mime-edit-pgp-processing 'encrypt)
-           (message "This message will be encrypt.")
-           )
-       (message "Please specify encrypting type.")
+      (progn
+       (setq mime-edit-pgp-processing 'encrypt)
+       (message "This message will be encrypt.")
        )
     (if (eq mime-edit-pgp-processing 'encrypt)
        (setq mime-edit-pgp-processing nil)
@@ -2324,9 +2299,6 @@ Optional TRANSFER-LEVEL is a number of transfer-level, 7 or 8."
     (message "This message will not be encrypt.")
     ))
 
-(defvar mime-edit-pgp-processing nil)
-(make-variable-buffer-local 'mime-edit-pgp-processing)
-
 (defun mime-edit-pgp-enclose-buffer ()
   (let ((beg (save-excursion
               (goto-char (point-min))
@@ -2337,10 +2309,10 @@ Optional TRANSFER-LEVEL is a number of transfer-level, 7 or 8."
        )
     (if beg
        (cond ((eq mime-edit-pgp-processing 'sign)
-              (mime-edit-enclose-signed-region beg end)
+              (mime-edit-enclose-pgp-signed-region beg end)
               )
              ((eq mime-edit-pgp-processing 'encrypt)
-              (mime-edit-enclose-encrypted-region beg end)
+              (mime-edit-enclose-pgp-encrypted-region beg end)
               ))
       )))
 
index 78dfdae..7e5cb26 100644 (file)
@@ -25,7 +25,7 @@
 ;;; Code:
 
 (require 'mailcrypt)
-(load "mc-pgp")
+(eval-and-compile (load "mc-pgp"))
 
 (defun mime-mc-pgp-generic-parser (result)
   (let ((ret (mc-pgp-generic-parser result)))
index c240070..c8ef3ed 100644 (file)
@@ -40,7 +40,7 @@
        (error "Fatal. Unsupported mode")
        ))))
 
-(defun mime-method-to-combine-message/partial-pieces (beg end cal)
+(defun mime-method-to-combine-message/partial-pieces (entity cal)
   "Internal method for mime-view to combine message/partial messages
 automatically.  This function refers variable
 `mime-view-partial-message-method-alist' to select function to display
@@ -65,7 +65,7 @@ partial messages using mime-view."
     (if (or (file-exists-p full-file)
            (not (y-or-n-p "Merge partials?"))
            )
-       (mime-method-to-store-message/partial beg end cal)
+       (mime-method-to-store-message/partial entity cal)
       (let (the-id parameters)
        (setq subject-id (std11-field-body "Subject"))
        (if (string-match "[0-9\n]+" subject-id)
@@ -84,9 +84,7 @@ partial messages using mime-view."
              (if (string= the-id id)
                  (progn
                    (mime-method-to-store-message/partial
-                    (mime-entity-point-min mime-raw-message-info)
-                    (mime-entity-point-max mime-raw-message-info)
-                    parameters)
+                    mime-raw-message-info parameters)
                    (if (file-exists-p full-file)
                        (throw 'tag nil)
                      )
index 8aa0c40..b27c314 100644 (file)
 ;;;
 ;;; It is based on draft-kazu-pgp-mime-00.txt (PGP-kazu).
 
-(defun mime-method-for-application/pgp (start end cal)
-  (let* ((entity-number (mime-raw-point-to-entity-number start))
+(defun mime-method-for-application/pgp (entity cal)
+  (let* ((start (mime-entity-point-min entity))
+        (end (mime-entity-point-max entity))
+        (entity-number (mime-raw-point-to-entity-number start))
         (p-win (or (get-buffer-window mime-preview-buffer)
                    (get-largest-window)))
         (new-name (format "%s-%s" (buffer-name) entity-number))
 ;;;
 ;;; It is based on RFC 1847 (security-multipart).
 
-(defun mime-method-to-verify-multipart/signed (start end cal)
+(defun mime-method-to-verify-multipart/signed (entity cal)
   "Internal method to verify multipart/signed."
   (mime-raw-play-entity
-   ;; entity-info of signature
-   (mime-raw-find-entity-from-node-id
-    ;; entity-node-id of signature
-    (cons 1 (mime-raw-point-to-entity-node-id start)))
+   (nth 1 (mime-entity-children entity)) ; entity-info of signature
    (cdr (assq 'mode cal)) ; play-mode
    ))
 
@@ -161,9 +160,11 @@ It should be ISO 639 2 letter language code such as en, ja, ...")
                 (t "Bad signature")))
          ))))
 
-(defun mime-method-to-verify-application/pgp-signature (start end cal)
+(defun mime-method-to-verify-application/pgp-signature (entity cal)
   "Internal method to check PGP/MIME signature."
-  (let* ((encoding (cdr (assq 'encoding cal)))
+  (let* ((start (mime-entity-point-min entity))
+        (end (mime-entity-point-max entity))
+        (encoding (cdr (assq 'encoding cal)))
         (entity-node-id (mime-raw-point-to-entity-node-id start))
         (mother-node-id (cdr entity-node-id))
         (knum (car entity-node-id))
@@ -223,19 +224,16 @@ It should be ISO 639 2 letter language code such as en, ja, ...")
 ;;;
 ;;; It is based on RFC 2015 (PGP/MIME).
 
-(defun mime-method-to-decrypt-application/pgp-encrypted (start end cal)
-  (let* ((entity-node-id (mime-raw-point-to-entity-node-id start))
+(defun mime-method-to-decrypt-application/pgp-encrypted (entity cal)
+  (let* ((entity-node-id (mime-entity-node-id entity))
         (mother-node-id (cdr entity-node-id))
         (knum (car entity-node-id))
         (onum (if (> knum 0)
                   (1- knum)
                 (1+ knum)))
         (oinfo (mime-raw-find-entity-from-node-id
-                (cons onum mother-node-id) mime-raw-message-info))
-        (obeg (mime-entity-point-min oinfo))
-        (oend (mime-entity-point-max oinfo))
-        )
-    (mime-method-for-application/pgp obeg oend cal)
+                (cons onum mother-node-id) mime-raw-message-info)))
+    (mime-method-for-application/pgp oinfo cal)
     ))
 
 
@@ -243,8 +241,10 @@ It should be ISO 639 2 letter language code such as en, ja, ...")
 ;;;
 ;;; It is based on RFC 2015 (PGP/MIME).
 
-(defun mime-method-to-add-application/pgp-keys (start end cal)
-  (let* ((entity-number (mime-raw-point-to-entity-number start))
+(defun mime-method-to-add-application/pgp-keys (entity cal)
+  (let* ((start (mime-entity-point-min entity))
+        (end (mime-entity-point-max entity))
+        (entity-number (mime-raw-point-to-entity-number start))
         (new-name (format "%s-%s" (buffer-name) entity-number))
         (encoding (cdr (assq 'encoding cal)))
         str)
index da9d9c8..ce4d45f 100644 (file)
@@ -76,13 +76,13 @@ If MODE is specified, play as it.  Default MODE is \"play\"."
   (interactive)
   (or mode
       (setq mode "play"))
-  (let ((entity-info (get-text-property (point) 'mime-view-entity)))
-    (if entity-info
+  (let ((entity (get-text-property (point) 'mime-view-entity)))
+    (if entity
        (let ((the-buf (current-buffer))
              (raw-buffer (get-text-property (point) 'mime-view-raw-buffer)))
          (setq mime-preview-after-decoded-position (point))
          (set-buffer raw-buffer)
-         (mime-raw-play-entity entity-info mode)
+         (mime-raw-play-entity entity mode)
          (when (eq (current-buffer) raw-buffer)
            (set-buffer the-buf)
            (goto-char mime-preview-after-decoded-position)
@@ -130,21 +130,15 @@ If MODE is specified, play as it.  Default MODE is \"play\"."
       (setq situations (cdr situations)))
     dest))
 
-(defun mime-raw-play-entity (entity-info &optional mode)
-  "Play entity specified by ENTITY-INFO.
+(defun mime-raw-play-entity (entity &optional mode)
+  "Play entity specified by ENTITY.
 It decodes the entity to call internal or external method.  The method
 is selected from variable `mime-acting-condition'.  If MODE is
 specified, play as it.  Default MODE is \"play\"."
-  (let ((beg (mime-entity-point-min entity-info))
-       (end (mime-entity-point-max entity-info))
-       (content-type (mime-entity-content-type entity-info))
-       (encoding (mime-entity-encoding entity-info)))
-    (or content-type
-       (setq content-type (make-mime-content-type 'text 'plain)))
+  (let ((beg (mime-entity-point-min entity))
+       (end (mime-entity-point-max entity)))
     (let (method cal ret)
-      (setq cal (list* (cons 'major-mode major-mode)
-                      (cons 'encoding encoding)
-                      content-type))
+      (setq cal (mime-entity-situation entity))
       (if mode
          (setq cal (cons (cons 'mode mode) cal))
        )
@@ -182,7 +176,7 @@ specified, play as it.  Default MODE is \"play\"."
       (setq method (cdr (assq 'method ret)))
       (cond ((and (symbolp method)
                  (fboundp method))
-            (funcall method beg end ret)
+            (funcall method entity ret)
             )
            ((stringp method)
             (mime-activate-mailcap-method beg end ret)
@@ -191,12 +185,9 @@ specified, play as it.  Default MODE is \"play\"."
             (mime-activate-external-method beg end ret)
             )
            (t
-            (mime-show-echo-buffer
-             "No method are specified for %s\n"
-             (mime-type/subtype-string
-              (mime-content-type-primary-type content-type)
-              (mime-content-type-subtype content-type))
-             )))
+            (mime-show-echo-buffer "No method are specified for %s\n"
+                                   (mime-entity-type/subtype entity))
+            ))
       )))
 
 
@@ -387,36 +378,36 @@ window.")
 ;;; @ file extraction
 ;;;
 
-(defun mime-method-to-save (beg end cal)
-  (goto-char beg)
-  (let* ((name
-         (save-restriction
-           (narrow-to-region beg end)
-           (mime-raw-get-filename cal)
-           ))
-        (encoding (or (cdr (assq 'encoding cal)) "7bit"))
-        (filename
-          (if (and name (not (string-equal name "")))
-             (expand-file-name name
-                               (save-window-excursion
-                                 (call-interactively
-                                  (function
-                                   (lambda (dir)
-                                     (interactive "DDirectory: ")
-                                     dir)))))
-           (save-window-excursion
-             (call-interactively
-              (function
-               (lambda (file)
-                 (interactive "FFilename: ")
-                 (expand-file-name file)))))))
-        )
-    (if (file-exists-p filename)
-        (or (yes-or-no-p (format "File %s exists. Save anyway? " filename))
-            (error "")))
-    (re-search-forward "\n\n")
-    (mime-write-decoded-region (match-end 0) end filename encoding)
-    ))
+(defun mime-method-to-save (entity cal)
+  (let ((beg (mime-entity-point-min entity))
+       (end (mime-entity-point-max entity)))
+    (goto-char beg)
+    (let* ((name (save-restriction
+                  (narrow-to-region beg end)
+                  (mime-raw-get-filename cal)
+                  ))
+          (encoding (or (cdr (assq 'encoding cal)) "7bit"))
+          (filename (if (and name (not (string-equal name "")))
+                        (expand-file-name name
+                                          (save-window-excursion
+                                            (call-interactively
+                                             (function
+                                              (lambda (dir)
+                                                (interactive "DDirectory: ")
+                                                dir)))))
+                      (save-window-excursion
+                        (call-interactively
+                         (function
+                          (lambda (file)
+                            (interactive "FFilename: ")
+                            (expand-file-name file)))))))
+          )
+      (if (file-exists-p filename)
+         (or (yes-or-no-p (format "File %s exists. Save anyway? " filename))
+             (error "")))
+      (re-search-forward "\n\n")
+      (mime-write-decoded-region (match-end 0) end filename encoding)
+      )))
 
 
 ;;; @ mail/news message
@@ -434,8 +425,10 @@ It is registered to variable `mime-preview-quitting-method-alist'."
     (pop-to-buffer mother)
     ))
 
-(defun mime-method-to-display-message/rfc822 (beg end cal)
-  (let* ((cnum (mime-raw-point-to-entity-number beg))
+(defun mime-method-to-display-message/rfc822 (entity cal)
+  (let* ((beg (mime-entity-point-min entity))
+        (end (mime-entity-point-max entity))
+        (cnum (mime-raw-point-to-entity-number beg))
         (new-name (format "%s-%s" (buffer-name) cnum))
         (mother mime-preview-buffer)
         (representation-type
@@ -475,8 +468,8 @@ saved as binary.  Otherwise the region is saved by `write-region'."
       (write-region start end filename)
       )))
 
-(defun mime-method-to-store-message/partial (beg end cal)
-  (goto-char beg)
+(defun mime-method-to-store-message/partial (entity cal)
+  (goto-char (mime-entity-point-min entity))
   (let* ((root-dir
          (expand-file-name
           (concat "m-prts-" (user-login-name)) mime-temp-directory))
@@ -485,7 +478,7 @@ saved as binary.  Otherwise the region is saved by `write-region'."
         (total (cdr (assoc "total" cal)))
         file
         (mother mime-preview-buffer)
-         )
+        )
     (or (file-exists-p root-dir)
        (make-directory root-dir)
        )
@@ -516,7 +509,7 @@ saved as binary.  Otherwise the region is saved by `write-region'."
       (re-search-forward "^$")
       (goto-char (1+ (match-end 0)))
       (setq file (concat root-dir "/" number))
-      (mime-raw-write-region (point) end file)
+      (mime-raw-write-region (point) (mime-entity-point-max entity) file)
       (let ((total-file (concat root-dir "/CT")))
        (setq total
              (if total
@@ -561,8 +554,8 @@ saved as binary.  Otherwise the region is saved by `write-region'."
                    (setq i (1+ i))
                    ))
                (as-binary-output-file
-                 (write-region (point-min)(point-max)
-                               (expand-file-name "FULL" root-dir)))
+                (write-region (point-min)(point-max)
+                              (expand-file-name "FULL" root-dir)))
                (let ((i 1))
                  (while (<= i total)
                    (let ((file (format "%s/%d" root-dir i)))
@@ -607,13 +600,11 @@ saved as binary.  Otherwise the region is saved by `write-region'."
     (dired dir)
     ))
 
-(defun mime-method-to-display-message/external-ftp (beg end cal)
+(defun mime-method-to-display-message/external-ftp (entity cal)
   (let* ((site (cdr (assoc "site" cal)))
         (directory (cdr (assoc "directory" cal)))
         (name (cdr (assoc "name" cal)))
-        ;;(mode (cdr (assoc "mode" cal)))
-        (pathname (concat "/anonymous@" site ":" directory))
-        )
+        (pathname (concat "/anonymous@" site ":" directory)))
     (message (concat "Accessing " (expand-file-name name pathname) "..."))
     (funcall mime-raw-dired-function pathname)
     (goto-char (point-min))
@@ -624,10 +615,9 @@ saved as binary.  Otherwise the region is saved by `write-region'."
 ;;; @ rot13-47
 ;;;
 
-(defun mime-method-to-display-caesar (start end cal)
+(defun mime-method-to-display-caesar (entity situation)
   "Internal method for mime-view to display ROT13-47-48 message."
-  (let* ((entity (mime-raw-find-entity-from-point start))
-        (new-name (format "%s-%s" (buffer-name)
+  (let* ((new-name (format "%s-%s" (buffer-name)
                           (mime-entity-number entity)))
         (mother mime-preview-buffer))
     (let ((pwin (or (get-buffer-window mother)
index 8c7fb6d..bcd0595 100644 (file)
@@ -134,10 +134,6 @@ message/partial, it is called `mother-buffer'.")
   "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)
-
 (defvar mime-preview-original-window-configuration nil
   "Window-configuration before mime-view-mode is called.")
 (make-variable-buffer-local 'mime-preview-original-window-configuration)
@@ -189,6 +185,7 @@ If optional argument MESSAGE-INFO is not specified,
            (setq children (cdr children)))
          message-info))))
 
+
 (defsubst mime-entity-parent (entity &optional message-info)
   "Return mother entity of ENTITY.
 If optional argument MESSAGE-INFO is not specified,
@@ -200,6 +197,50 @@ If optional argument MESSAGE-INFO is not specified,
         (set-buffer (mime-entity-buffer entity))
         mime-raw-message-info))))
 
+(defsubst mime-entity-situation (entity)
+  "Return situation of ENTITY."
+  (append (or (mime-entity-content-type entity)
+             (make-mime-content-type 'text 'plain))
+         (list (cons 'encoding (mime-entity-encoding entity))
+               (cons 'major-mode
+                     (save-excursion
+                       (set-buffer (mime-entity-buffer entity))
+                       major-mode)))
+         ))
+
+
+(defvar mime-view-uuencode-encoding-name-list '("x-uue" "x-uuencode"))
+
+(defun mime-raw-get-uu-filename ()
+  (save-excursion
+    (if (re-search-forward "^begin [0-9]+ " nil t)
+       (if (looking-at ".+$")
+           (buffer-substring (match-beginning 0)(match-end 0))
+         ))))
+
+(defun mime-raw-get-subject (entity)
+  (or (std11-find-field-body '("Content-Description" "Subject"))
+      (let ((ret (mime-entity-content-disposition entity)))
+       (and ret
+            (setq ret (mime-content-disposition-filename ret))
+            (std11-strip-quoted-string ret)
+            ))
+      (let ((ret (mime-entity-content-type entity)))
+       (and ret
+            (setq ret
+                  (cdr
+                   (let ((param (mime-content-type-parameters ret)))
+                     (or (assoc "name" param)
+                         (assoc "x-name" param))
+                     )))
+            (std11-strip-quoted-string ret)
+            ))
+      (if (member (mime-entity-encoding entity)
+                 mime-view-uuencode-encoding-name-list)
+         (mime-raw-get-uu-filename))
+      ""))
+
+
 (defsubst mime-raw-point-to-entity-node-id (point &optional message-info)
   "Return entity-node-id from POINT in mime-raw-buffer.
 If optional argument MESSAGE-INFO is not specified,
@@ -510,9 +551,9 @@ Each elements are regexp of field-name.")
     (while children
       (mime-view-display-entity (car children)
                                (save-excursion
-                                 (set-buffer mime-raw-buffer)
+                                 (set-buffer (mime-entity-buffer entity))
                                  mime-raw-message-info)
-                               mime-raw-buffer (current-buffer)
+                               (current-buffer)
                                default-situation)
       (setq children (cdr children))
       )))
@@ -545,13 +586,8 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t.  t means default."
                     (let ((situation
                            (or (ctree-match-calist
                                 mime-preview-condition
-                                (append
-                                 (or (mime-entity-content-type child)
-                                     (make-mime-content-type 'text 'plain))
-                                 (list* (cons 'encoding
-                                              (mime-entity-encoding child))
-                                        (cons 'major-mode major-mode)
-                                        default-situation)))
+                                (append (mime-entity-situation child)
+                                        default-situation))
                                default-situation)))
                       (if (cdr (assq 'body-presentation-method situation))
                           (let ((score
@@ -578,12 +614,13 @@ MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t.  t means default."
                  children)))
     (setq i 0)
     (while children
-      (let ((situation (car situations)))
-       (mime-view-display-entity (car children)
+      (let ((child (car children))
+           (situation (car situations)))
+       (mime-view-display-entity child
                                  (save-excursion
-                                   (set-buffer mime-raw-buffer)
+                                   (set-buffer (mime-entity-buffer child))
                                    mime-raw-message-info)
-                                 mime-raw-buffer (current-buffer)
+                                 (current-buffer)
                                  default-situation
                                  (if (= i p)
                                      situation
@@ -782,62 +819,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
-       (get-buffer ibuf)
-       (set-buffer ibuf)
-       ))
-  (or mime-view-redisplay
-      (setq mime-raw-message-info (mime-parse-message ctl encoding))
-      )
-  (let ((message-info mime-raw-message-info)
-       (the-buf (current-buffer))
-       (mode major-mode))
-    (or obuf
-       (setq obuf (concat "*Preview-" (buffer-name the-buf) "*")))
-    (set-buffer (get-buffer-create obuf))
-    (let ((inhibit-read-only t))
-      ;;(setq buffer-read-only nil)
-      (widen)
-      (erase-buffer)
-      (setq mime-raw-buffer the-buf)
-      (setq mime-preview-original-major-mode mode)
-      (setq major-mode 'mime-view-mode)
-      (setq mode-name "MIME-View")
-      (mime-view-display-entity message-info message-info
-                               the-buf obuf
-                               '((entity-button . invisible)
-                                 (header . visible)
-                                 ))
-      (set-buffer-modified-p nil)
-      )
-    (setq buffer-read-only t)
-    (set-buffer the-buf)
-    )
-  (setq mime-preview-buffer obuf)
-  )
-
-(defun mime-view-display-entity (entity message-info ibuf obuf
+(defun mime-view-display-entity (entity message-info obuf
                                        default-situation
                                        &optional situation)
-  (let* ((start (mime-entity-point-min entity))
+  (let* ((raw-buffer (mime-entity-buffer entity))
+        (start (mime-entity-point-min entity))
         (end (mime-entity-point-max entity))
-         (content-type (mime-entity-content-type entity))
-         (encoding (mime-entity-encoding entity))
-        end-of-header e nb ne subj)
-    (set-buffer ibuf)
+        original-major-mode end-of-header e nb ne subj)
+    (set-buffer raw-buffer)
+    (setq original-major-mode major-mode)
     (goto-char start)
     (setq end-of-header (if (re-search-forward "^$" nil t)
                            (1+ (match-end 0))
@@ -852,13 +845,8 @@ The compressed face will be piped to this command.")
     (or situation
        (setq situation
              (or (ctree-match-calist mime-preview-condition
-                                     (append
-                                      (or content-type
-                                          (make-mime-content-type
-                                           'text 'plain))
-                                      (list* (cons 'encoding   encoding)
-                                             (cons 'major-mode major-mode)
-                                             default-situation)))
+                                     (append (mime-entity-situation entity)
+                                             default-situation))
                  default-situation)))
     (let ((button-is-invisible
           (eq (cdr (assq 'entity-button situation)) 'invisible))
@@ -877,8 +865,8 @@ The compressed face will be piped to this command.")
       (if header-is-visible
          (save-restriction
            (narrow-to-region (point)(point))
-           (insert-buffer-substring mime-raw-buffer start end-of-header)
-           (let ((f (cdr (assq mime-preview-original-major-mode
+           (insert-buffer-substring raw-buffer start end-of-header)
+           (let ((f (cdr (assq original-major-mode
                                mime-view-content-header-filter-alist))))
              (if (functionp f)
                  (funcall f)
@@ -890,7 +878,7 @@ The compressed face will be piped to this command.")
             (let ((body-filter (cdr (assq 'body-filter situation))))
               (save-restriction
                 (narrow-to-region (point-max)(point-max))
-                (insert-buffer-substring mime-raw-buffer end-of-header end)
+                (insert-buffer-substring raw-buffer end-of-header end)
                 (funcall body-filter situation)
                 )))
            (children)
@@ -910,7 +898,7 @@ The compressed face will be piped to this command.")
             ))
       (setq ne (point-max))
       (widen)
-      (put-text-property nb ne 'mime-view-raw-buffer ibuf)
+      (put-text-property nb ne 'mime-view-raw-buffer raw-buffer)
       (put-text-property nb ne 'mime-view-entity entity)
       (goto-char ne)
       (if children
@@ -920,35 +908,6 @@ The compressed face will be piped to this command.")
            ))
       )))
 
-(defun mime-raw-get-uu-filename ()
-  (save-excursion
-    (if (re-search-forward "^begin [0-9]+ " nil t)
-       (if (looking-at ".+$")
-           (buffer-substring (match-beginning 0)(match-end 0))
-         ))))
-
-(defun mime-raw-get-subject (entity)
-  (or (std11-find-field-body '("Content-Description" "Subject"))
-      (let ((ret (mime-entity-content-disposition entity)))
-       (and ret
-            (setq ret (mime-content-disposition-filename ret))
-            (std11-strip-quoted-string ret)
-            ))
-      (let ((ret (mime-entity-content-type entity)))
-       (and ret
-            (setq ret
-                  (cdr
-                   (let ((param (mime-content-type-parameters ret)))
-                     (or (assoc "name" param)
-                         (assoc "x-name" param))
-                     )))
-            (std11-strip-quoted-string ret)
-            ))
-      (if (member (mime-entity-encoding entity)
-                 mime-view-uuencode-encoding-name-list)
-         (mime-raw-get-uu-filename))
-      ""))
-
 
 ;;; @ MIME viewer mode
 ;;;
@@ -1086,7 +1045,61 @@ The compressed face will be piped to this command.")
          (bury-buffer buf)
          ))))
 
-(defun mime-view-mode (&optional mother ctl encoding ibuf obuf
+(defvar mime-view-redisplay nil)
+
+(defun mime-view-display-message (message &optional preview-buffer
+                                         mother default-keymap-or-function)
+  (mime-maybe-hide-echo-buffer)
+  (let ((win-conf (current-window-configuration))
+       (raw-buffer (mime-entity-buffer message)))
+    (or preview-buffer
+       (setq preview-buffer
+             (concat "*Preview-" (buffer-name raw-buffer) "*")))
+    (set-buffer raw-buffer)
+    (setq mime-raw-message-info (mime-parse-message))
+    (setq mime-preview-buffer preview-buffer)
+    (let ((inhibit-read-only t))
+      (switch-to-buffer preview-buffer)
+      (widen)
+      (erase-buffer)
+      (setq mime-raw-buffer raw-buffer)
+      (if mother
+         (setq mime-mother-buffer mother)
+       )
+      (setq mime-preview-original-window-configuration win-conf)
+      (setq major-mode 'mime-view-mode)
+      (setq mode-name "MIME-View")
+      (mime-view-display-entity message message
+                               preview-buffer
+                               '((entity-button . invisible)
+                                 (header . visible)
+                                 ))
+      (mime-view-define-keymap default-keymap-or-function)
+      (let ((point
+            (next-single-property-change (point-min) 'mime-view-entity)))
+       (if point
+           (goto-char point)
+         (goto-char (point-min))
+         (search-forward "\n\n" nil t)
+         ))
+      (run-hooks 'mime-view-mode-hook)
+      ))
+  (set-buffer-modified-p nil)
+  (setq buffer-read-only t)
+  )
+
+(defun mime-view-buffer (&optional raw-buffer preview-buffer mother
+                                  default-keymap-or-function)
+  (interactive)
+  (mime-view-display-message
+   (save-excursion
+     (if raw-buffer (set-buffer raw-buffer))
+     (mime-parse-message)
+     )
+   preview-buffer mother default-keymap-or-function))
+
+(defun mime-view-mode (&optional mother ctl encoding
+                                raw-buffer preview-buffer
                                 default-keymap-or-function)
   "Major mode for viewing MIME message.
 
@@ -1112,27 +1125,13 @@ button-2        Move to point under the mouse cursor
                and decode current content as `play mode'
 "
   (interactive)
-  (mime-maybe-hide-echo-buffer)
-  (let ((ret (mime-view-setup-buffers ctl encoding ibuf obuf))
-       (win-conf (current-window-configuration))
-       )
-    (prog1
-       (switch-to-buffer ret)
-      (setq mime-preview-original-window-configuration win-conf)
-      (if mother
-         (progn
-           (setq mime-mother-buffer mother)
-           ))
-      (mime-view-define-keymap default-keymap-or-function)
-      (let ((point
-            (next-single-property-change (point-min) 'mime-view-entity)))
-       (if point
-           (goto-char point)
-         (goto-char (point-min))
-         (search-forward "\n\n" nil t)
-         ))
-      (run-hooks 'mime-view-mode-hook)
-      )))
+  (mime-view-display-message
+   (save-excursion
+     (if raw-buffer (set-buffer raw-buffer))
+     (or mime-view-redisplay
+        (mime-parse-message ctl encoding))
+     )
+   preview-buffer mother default-keymap-or-function))
 
 
 ;;; @@ playing
@@ -1163,16 +1162,20 @@ It decodes current entity to call internal or external method as
 ;;; @@ following
 ;;;
 
-(defun mime-preview-original-major-mode ()
+(defun mime-preview-original-major-mode (&optional recursive)
   "Return major-mode of original buffer.
 If a current buffer has mime-mother-buffer, return original major-mode
 of the mother-buffer."
-  (if mime-mother-buffer
+  (if (and recursive mime-mother-buffer)
       (save-excursion
        (set-buffer mime-mother-buffer)
-       (mime-preview-original-major-mode)
+       (mime-preview-original-major-mode recursive)
        )
-    mime-preview-original-major-mode))
+    (save-excursion
+      (set-buffer
+       (mime-entity-buffer
+       (get-text-property (point-min) 'mime-view-entity)))
+      major-mode)))
 
 (defun mime-preview-follow-current-entity ()
   "Write follow message to current entity.
@@ -1230,7 +1233,7 @@ It calls following-method selected from variable
                 (setq p-end (point-max))
                 ))
             ))
-      (let* ((mode (mime-preview-original-major-mode))
+      (let* ((mode (mime-preview-original-major-mode 'recursive))
             (new-name
              (format "%s-%s" (buffer-name) (reverse entity-node-id)))
             new-buf
@@ -1356,7 +1359,7 @@ variable `mime-view-over-to-previous-method-alist'."
          (goto-char (1- point))
          (mime-preview-move-to-previous)
          )
-      (let ((f (assq mime-preview-original-major-mode
+      (let ((f (assq (mime-preview-original-major-mode)
                     mime-view-over-to-previous-method-alist)))
        (if f
            (funcall (cdr f))
@@ -1378,7 +1381,7 @@ variable `mime-view-over-to-next-method-alist'."
          (if (null (get-text-property point 'mime-view-entity))
              (mime-preview-move-to-next)
            ))
-      (let ((f (assq mime-preview-original-major-mode
+      (let ((f (assq (mime-preview-original-major-mode)
                     mime-view-over-to-next-method-alist)))
        (if f
            (funcall (cdr f))
@@ -1394,7 +1397,7 @@ If reached to (point-max), it calls function registered in variable
       (setq h (1- (window-height)))
       )
   (if (= (point) (point-max))
-      (let ((f (assq mime-preview-original-major-mode
+      (let ((f (assq (mime-preview-original-major-mode)
                      mime-view-over-to-next-method-alist)))
         (if f
             (funcall (cdr f))
@@ -1417,24 +1420,14 @@ If reached to (point-min), it calls function registered in variable
       (setq h (1- (window-height)))
       )
   (if (= (point) (point-min))
-      (let ((f (assq mime-preview-original-major-mode
-                     mime-view-over-to-previous-method-alist)))
+      (let ((f (assq (mime-preview-original-major-mode)
+                    mime-view-over-to-previous-method-alist)))
         (if f
             (funcall (cdr f))
           ))
-    (let (point)
-      (save-excursion
-       (catch 'tag
-         (while (not (bobp))
-           (if (setq point
-                     (previous-single-property-change (point)
-                                                      'mime-view-entity))
-               (throw 'tag t)
-             )
-           (backward-char)
-           )
-         (setq point (point-min))
-         ))
+    (let ((point
+          (or (previous-single-property-change (point) 'mime-view-entity)
+              (point-min))))
       (forward-line (- h))
       (if (< (point) point)
           (goto-char point)
@@ -1459,7 +1452,7 @@ If reached to (point-min), it calls function registered in variable
 It calls function registered in variable
 `mime-preview-quitting-method-alist'."
   (interactive)
-  (let ((r (assq mime-preview-original-major-mode
+  (let ((r (assq (mime-preview-original-major-mode)
                 mime-preview-quitting-method-alist)))
     (if r
        (funcall (cdr r))
@@ -1470,7 +1463,7 @@ It calls function registered in variable
 It calls function registered in variable
 `mime-view-show-summary-method'."
   (interactive)
-  (let ((r (assq mime-preview-original-major-mode
+  (let ((r (assq (mime-preview-original-major-mode)
                 mime-view-show-summary-method)))
     (if r
        (funcall (cdr r))
index b5b0e41..f17ac45 100644 (file)
                      ,keymap)
   )
 
+(defmacro mime-save-background-color (&rest body)
+  (if (featurep 'xemacs)
+      `(let ((color (color-name (face-background 'default))))
+        (prog1
+            (progn ,@body)
+          (font-set-face-background 'default color
+                                    (get-buffer gnus-article-buffer))
+          ))
+    (cons 'progn body)))
+
 (defun mime-preview-text/html (entity situation)
-  (save-restriction
-    (narrow-to-region (point-max)(point-max))
-    (mime-text-insert-decoded-body entity)
-    (let ((beg (point-min)))
-      (remove-text-properties beg (point-max) '(face nil))
-      (w3-region beg (point-max))
-      (mime-put-keymap-region beg (point-max) w3-mode-map)
-      )))
+  (mime-save-background-color
+   (save-restriction
+     (narrow-to-region (point-max)(point-max))
+     (mime-text-insert-decoded-body entity)
+     (let ((beg (point-min)))
+       (remove-text-properties beg (point-max) '(face nil))
+       (w3-region beg (point-max))
+       (mime-put-keymap-region beg (point-max) w3-mode-map)
+       ))))
 
 
 ;;; @ end
index fe52207..8373643 100644 (file)
@@ -29,7 +29,7 @@
 (eval-when-compile (require 'cl))
 
 
-(defconst mime-module-version '("SEMI" "Namerikawa" 1 5 5)
+(defconst mime-module-version '("SEMI" "Namerikawa" 1 6 0)
   "Implementation name, version name and numbers of MIME-kernel package.")
 
 (autoload 'mule-caesar-region "mule-caesar"