Sync up with SEMI 1.5.1.
authoryamaoka <yamaoka>
Fri, 5 Jun 1998 10:34:49 +0000 (10:34 +0000)
committeryamaoka <yamaoka>
Fri, 5 Jun 1998 10:34:49 +0000 (10:34 +0000)
ChangeLog
Makefile
NEWS
VERSION
mime-view.el
semi-def.el

index 20c7342..c1083bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,32 @@
 1998-06-05  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
 
+       * mime-view.el (mime-raw-message-info): Fix typo.
+       (mime-view-type-subtype-score-alist): New variable.
+       (mime-preview-multipart/alternative): New function; set up for
+       `mime-preview-condition'.
+       (mime-view-display-entity): Add optional argument `situation'.
+
+1998-06-05  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-view.el (mime-view-display-entity): Call
+       body-presentation-method to display multipart if it is function.
+
+       * NEWS: Add news about SEMI 1.5.
+
+1998-06-05  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-view.el (mime-preview-multipart/mixed): New function.
+       (mime-view-display-entity): Use `mime-preview-multipart/mixed'.
+
+1998-06-05  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * mime-view.el (mime-view-display-entity): Display entity-button
+       in body if button is invisible and body-presentation-method is not
+       found.
+
+\f
+1998-06-05  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
        * WEMI: Version 1.5.0 (Kamonomiya) released.
 
 1998-06-04  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
index 437d693..b30b0ee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 # Makefile for WEMI.
 #
 
-VERSION = 1.5.0
+VERSION = 1.5.1
 PACKAGE = wemi
 
 SHELL  = /bin/sh
diff --git a/NEWS b/NEWS
index 460a94f..8e7ba4a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,42 @@
 SEMI NEWS --- history of major-changes.
 Copyright (C) 1998 Free Software Foundation, Inc.
 
+* Changes in SEMI 1.5
+
+** text presentation
+
+  Change text presentation mechanism.  In anything older than SEMI
+1.4, text presentation mechanism is based on filter model.  However it
+has design problem about conversion between byte representation and
+text presentation.  So SEMI was changed to use
+body-presentation-method to display text entity.  In this purpose, old
+text decoding features were abolished and introduces news features
+(cf. next section).
+
+** mime-raw-representation-type and mime-raw-representation-type-alist
+
+  Abolish `mime-text-decoder' and `mime-text-decoder-alist' because of
+text presentation mechanism change (cf. previous section).  Instead of
+it, SEMI introduces variable about representation-type of
+mime-raw-buffer.  If it is `binary', mime-raw-buffer is as same as
+network representation.  If it is `cooked', mime-raw-buffer is
+code-converted.
+
+  `mime-raw-representation-type-alist' is an alist of major-mode
+vs. representation-type.  Each element looks like
+
+    (SYMBOL . REPRESENTATION-TYPE).
+
+SYMBOL is major-mode or t.  t means default.
+
+  `mime-raw-representation-type' is a buffer local variable of
+mime-raw-buffer.  If it is non-nil, it overrides
+`mime-raw-representation-type-alist'.
+
+  In addition, `mime-raw-buffer-coding-system-alist' was abolished.
+Because representation-type has enough information.
+
+\f
 * Changes in SEMI 1.4
 
 ** mailcap
diff --git a/VERSION b/VERSION
index fa006b1..2105df5 100644 (file)
--- a/VERSION
+++ b/VERSION
 0.115  Hinomiko                \e$(BF|8f;R\e(B
 0.115.1        Oyanagi                 \e$(B>.Lx\e(B
 0.115.2        Inokuchi                \e$(B0f8}\e(B
-0.116  D\e-Dòhòji\e-A                    \e$(BF;K!;{\e(B
+0.116  D\e-Dòhòji                       \e$(BF;K!;{\e(B\e-A
 0.118  Sodani                  \e$(BA>C+\e(B
 0.118.1        Shijima                 \e$(B;M==K|\e(B
 0.118.2        Otomaru                 \e$(B254]\e(B
-1.0.0  Nukaj\e-Dþtaku-mae\e-A            \e$(B3[=;BpA0\e(B
+1.0.0  Nukaj\e-Dþtaku-mae               \e$(B3[=;BpA0\e(B\e-A
 1.0.1  Magae                   \e$(BGOBX\e(B
-1.0.2  Nonoichi-K\e-Dòdaimae\e-A \e$(BLn!9;T9)BgA0\e(B
+1.0.2  Nonoichi-K\e-Dòdaimae    \e$(BLn!9;T9)BgA0\e(B\e-A
 1.1.0  Nonoichi                \e$(BLn!9;T\e(B
 1.1.1  Oshino                  \e$(B2!Ln\e(B
 1.1.2  Shin-Nishikanazawa      \e$(B?7@>6bBt\e(B ; <=> JR \e$(B@>6bBt\e(B
 1.2.4  Arimagawa               \e$(BM-4V@n\e(B
 1.3.0  Nadachi                 \e$(BL>N)\e(B
 1.3.1  Tsutsuishi              \e$(BE{@P\e(B
-1.3.2  N\e-Dò\e-A                        \e$(BG=@8\e(B
+1.3.2  N\e-Dò                   \e$(BG=@8\e(B\e-A
 1.3.3  Uramoto                 \e$(B1:K\\e(B
 1.3.4  Kajiyashiki             \e$(B3a20I_\e(B
 1.4.0  Itoigawa                \e$(B;e5{@n\e(B           ; = JR \e$(BBg;e@~\e(B
-1.4.1  \e-DÒmi\e-A                       \e$(B@D3$\e(B
+1.4.1  \e-DÒmi                  \e$(B@D3$\e(B\e-A
 1.4.2  Oyashirazu              \e$(B?FITCN\e(B
 1.4.3  Ichiburi                \e$(B;T?6\e(B
-1.4.4  Ecch\e-Dþ-Miyazaki\e-A            \e$(B1[Cf5\:j\e(B
+1.4.4  Ecch\e-Dþ-Miyazaki               \e$(B1[Cf5\:j\e(B\e-A
 1.4.5  Tomari                  \e$(BGq\e(B
-1.4.6  Ny\e-Dþzen\e-A                    \e$(BF~A1\e(B
-1.5.0  Nishi-Ny\e-Dþzen\e-A              \e$(B@>F~A1\e(B
------  Ikuji                   \e$(B@8CO\e(B
+1.4.6  Ny\e-Dþzen                       \e$(BF~A1\e(B\e-A
+1.5.0  Nishi-Ny\e-Dþzen         \e$(B@>F~A1\e(B\e-A
+1.5.1  Ikuji                   \e$(B@8CO\e(B
 -----  Kurobe                  \e$(B9uIt\e(B
 -----  Uozu                    \e$(B5{DE\e(B             ; <=> \e$(BIY;3COJ}E4F;\e(B
 :      :                       :
@@ -68,7 +68,7 @@
 :      :                       :
 -------        Tsuruga                 \e$(BFX2l\e(B             ; = JR \e$(B>.IM@~\e(B
 -------        Shin-Hikida             \e$(B?7I%ED\e(B
--------        \e-DÒmi-Shiotsu\e-A               \e$(B6a9>1vDE\e(B ; = JR \e$(B8P@>@~\e(B
+-------        \e-DÒmi-Shiotsu          \e$(B6a9>1vDE\e(B ; = JR \e$(B8P@>@~\e(B\e-A
 -------        Yogo                    \e$(BM>8b\e(B
 -------        Kinomoto                \e$(BLZ%NK\\e(B
 -------        Takatsuki               \e$(B9b7n\e(B
 1.4.5  Ninomiya        \e$BFs5\\e(B
 1.4.6  K\e-Dòzu\e-A              \e$(B9qI\DE\e(B   ; = JR \e$(B8fEB>l@~\e(B
 1.5.0  Kamonomiya      \e$B3{5\\e(B
------  Odawara         \e$(B>.ED86\e(B   ; <=> \e$(B>.ED5^!"H":,EP;3E4F;!"0KF&H":,E4F;\e(B
-:      :               :
+1.5.1  Odawara         \e$(B>.ED86\e(B   ; <=> \e$(B>.ED5^!"H":,EP;3E4F;!"0KF&H":,E4F;\e(B
+-----  Hayakawa        \e$BAa@n\e(B
+-----  Nebukawa        \e$B:,I\@n\e(B
+-----  Manazuru        \e$B??Da\e(B
+-----  Yugawara        \e$BEr2O86\e(B
 -----  Atami           \e$(BG.3$\e(B     ; = JR \e$(B0KEl@~\e(B
 ;;-------------------------------------------------------------------------
 ;;     Central Japan Railway   \e$(BEl3$N95RE4F;\e(B
 -----  Kan'nami        \e$(BH!Fn\e(B
 :      :               :
 -----  Kanayama        \e$(B6b;3\e(B     ; =\e$(B!J\e(BJR \e$(BCf1{K\@~!K\e(B
------  Ot\e-Dòbashi\e-A  \e$(BHxF,66\e(B
+-----  Ot\e-Dòbashi     \e$(BHxF,66\e(B\e-A
 -----  Nagoya          \e$(BL>8E20\e(B   ; = JR \e$(B4X@>K\@~!J!&Cf1{K\@~!K\e(B
 :      :               :
 -----  Gifu            \e$(B4tIl\e(B     ; = JR \e$(B9b;3K\@~\e(B
 -----  Kusatsu         \e$(BApDE\e(B     ; = JR \e$(BApDE@~\e(B
 :      :               :
 -----  Yamashina       \e$(B;32J\e(B     ; = JR \e$(B8P@>@~\e(B
------  Ky\e-Dòto\e-A             \e$(B5~ET\e(B     ; = JR \e$(BF`NI@~!&;31"K\@~\e(B
+-----  Ky\e-Dòto                \e$(B5~ET\e(B     ; = JR \e$(BF`NI@~!&;31"K\@~\e(B\e-A
                                ;   <=> \e$(B6aE4\e(B \e$(B5~ET@~!"5~ET;T8rDL6I\e(B \e$(B1(4]@~\e(B
 :      :               :
------  \e-DÒsaka\e-A             \e$(BBg:e\e(B     ; = JR \e$(BBg:e4D>u@~\e(B <=> JR \e$(BEl@>@~\e(B \e$(BKL?7CO\e(B
+-----  \e-DÒsaka                \e$(BBg:e\e(B     ; = JR \e$(BBg:e4D>u@~\e(B <=> JR \e$(BEl@>@~\e(B \e$(BKL?7CO\e(B\e-A
                                ;   <=> \e$(BBg:e;T8rDL6I!":e?@!":e5^\e(B \e$(BG_ED\e(B
 :      :               :
------  K\e-Dòbe\e-A              \e$(B?@8M\e(B     ; = JR \e$(B;3M[K\@~\e(B
+-----  K\e-Dòbe         \e$(B?@8M\e(B     ; = JR \e$(B;3M[K\@~\e(B\e-A
 
 
 [REMI version names]
 1.4.0  Himi                    \e$(BI98+\e(B
 1.5.0  Shimao                  \e$(BEgHx\e(B
 1.5.1  Amaharashi              \e$(B1+@2\e(B
--------        Ecch\e-Dþ-Kokubu\e-A              \e$(B1[Cf9qJ,\e(B
+-------        Ecch\e-Dþ-Kokubu         \e$(B1[Cf9qJ,\e(B\e-A
 -------        Fushiki                 \e$(BIzLZ\e(B
 -------        Noumachi                \e$(BG=D.\e(B
--------        Ecch\e-Dþ-Nakagawa\e-A            \e$(B1[CfCf@n\e(B
+-------        Ecch\e-Dþ-Nakagawa               \e$(B1[CfCf@n\e(B\e-A
        (Takaoka)               (\e$(B9b2,\e(B)           ; = JR \e$(BKLN&K\@~!">kC<@~\e(B
 
 
 ;;     West Japan Railway      \e$(B@>F|K\N95RE4F;\e(B   http://www.westjr.co.jp/
 ;;     Kosei Line              \e$(B8P@>@~\e(B
 ;;-------------------------------------------------------------------------
--------        (\e-DÒmi-Shiotsu)\e-A             (\e$(B6a9>1vDE\e(B)       ; = JR \e$(BKLN&K\@~\e(B
+-------        (\e-DÒmi-Shiotsu)                (\e$(B6a9>1vDE\e(B)       ; = JR \e$(BKLN&K\@~\e(B\e-A
 :      :                       :
--------        Nishi-\e-DÒtsu\e-A                \e$(B@>BgDE\e(B
+-------        Nishi-\e-DÒtsu           \e$(B@>BgDE\e(B\e-A
        (Yamashina)             (\e$(B;32J\e(B)           ; = JR \e$(BEl3$F;K\@~\e(B
index 637b148..c23ca8b 100644 (file)
@@ -33,6 +33,7 @@
 (require 'mime-parse)
 (require 'semi-def)
 (require 'calist)
+(require 'alist)
 (require 'mailcap)
 
 
@@ -69,7 +70,7 @@
 ;;; @@ in raw-buffer
 ;;;
 
-(defvar mime-raw-message-info
+(defvar mime-raw-message-info nil
   "Information about structure of message.
 Please use reference function `mime-entity-SLOT' to get value of SLOT.
 
@@ -94,6 +95,18 @@ message/rfc822, `mime-entity' structures of them are included in
   "MIME-preview buffer corresponding with the (raw) buffer.")
 (make-variable-buffer-local 'mime-preview-buffer)
 
+(defvar mime-raw-representation-type-alist
+  '((mime-show-message-mode     . binary)
+    (mime-temp-message-mode     . binary)
+    (t                          . cooked)
+    )
+  "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.")
+
 
 ;;; @@ in preview-buffer
 ;;;
@@ -280,21 +293,6 @@ Please redefine this function if you want to change default setting."
 ;;; @@ entity-header
 ;;;
 
-;;; @@@ predicate function
-;;;
-
-;; (defvar mime-view-childrens-header-showing-Content-Type-list
-;;   '("message/rfc822" "message/news"))
-
-;; (defun mime-view-header-visible-p (entity message-info)
-;;   "Return non-nil if header of ENTITY is visible."
-;;   (let ((entity-node-id (mime-entity-node-id entity)))
-;;     (member (mime-entity-type/subtype
-;;              (mime-raw-find-entity-from-node-id
-;;               (cdr entity-node-id) message-info))
-;;             mime-view-childrens-header-showing-Content-Type-list)
-;;     ))
-
 ;;; @@@ entity header filter
 ;;;
 
@@ -435,6 +433,12 @@ Each elements are regexp of field-name.")
    (body-presentation-method . mime-preview-text/plain)))
 
 (ctree-set-calist-strictly
+ 'mime-preview-condition
+ '((type . multipart)(subtype . alternative)
+   (body . visible)
+   (body-presentation-method . mime-preview-multipart/alternative)))
+
+(ctree-set-calist-strictly
  'mime-preview-condition '((type . message)(subtype . partial)
                           (body-presentation-method
                            . mime-preview-message/partial-button)))
@@ -452,26 +456,13 @@ Each elements are regexp of field-name.")
                                                (entity-button . invisible))))
 
 
-;;; @@@ entity filter
+;;; @@@ entity presentation
 ;;;
 
 (autoload 'mime-preview-text/plain "mime-text")
 (autoload 'mime-preview-text/enriched "mime-text")
 (autoload 'mime-preview-text/richtext "mime-text")
 
-(defvar mime-raw-representation-type-alist
-  '((mime-show-message-mode     . binary)
-    (mime-temp-message-mode     . binary)
-    (t                          . cooked)
-    )
-  "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
   (if (and (>= emacs-major-version 19) window-system)
       "\
@@ -497,6 +488,98 @@ Please press `v' key in this buffer."
                        #'mime-preview-play-current-entity)
     ))
 
+(defun mime-preview-multipart/mixed (entity situation)
+  (let ((children (mime-entity-children entity))
+       (default-situation
+         (cdr (assq 'childrens-situation situation))))
+    (while children
+      (mime-view-display-entity (car children)
+                               (save-excursion
+                                 (set-buffer mime-raw-buffer)
+                                 mime-raw-message-info)
+                               mime-raw-buffer (current-buffer)
+                               default-situation)
+      (setq children (cdr children))
+      )))
+
+(defcustom mime-view-type-subtype-score-alist
+  '(((text . enriched) . 3)
+    ((text . richtext) . 2)
+    ((text . plain)    . 1)
+    (t . 0))
+  "Alist MEDIA-TYPE vs corresponding score.
+MEDIA-TYPE must be (TYPE . SUBTYPE), TYPE or t.  t means default."
+  :group 'mime-view
+  :type '(repeat (cons (choice :tag "Media-Type"
+                              (item :tag "Type/Subtype"
+                                    (cons symbol symbol))
+                              (item :tag "Type" symbol)
+                              (item :tag "Default" t))
+                      integer)))
+
+(defun mime-preview-multipart/alternative (entity situation)
+  (let* ((children (mime-entity-children entity))
+        (default-situation
+          (cdr (assq 'childrens-situation situation)))
+        (i 0)
+        (p 0)
+        (max-score 0)
+        (situations
+         (mapcar (function
+                  (lambda (child)
+                    (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)))
+                               default-situation)))
+                      (if (cdr (assq 'body-presentation-method situation))
+                          (let ((score
+                                 (cdr
+                                  (or (assoc
+                                       (cons
+                                        (cdr (assq 'type situation))
+                                        (cdr (assq 'subtype situation)))
+                                       mime-view-type-subtype-score-alist)
+                                      (assq
+                                       (cdr (assq 'type situation))
+                                       mime-view-type-subtype-score-alist)
+                                      (assq
+                                       t
+                                       mime-view-type-subtype-score-alist)
+                                      ))))
+                            (if (> score max-score)
+                                (setq p i
+                                      max-score score)
+                              )))
+                      (setq i (1+ i))
+                      situation)
+                    ))
+                 children)))
+    (setq i 0)
+    (while children
+      (let ((situation (car situations)))
+       (mime-view-display-entity (car children)
+                                 (save-excursion
+                                   (set-buffer mime-raw-buffer)
+                                   mime-raw-message-info)
+                                 mime-raw-buffer (current-buffer)
+                                 default-situation
+                                 (if (= i p)
+                                     situation
+                                   (del-alist 'body-presentation-method
+                                              (copy-alist situation))))
+       )
+      (setq children (cdr children)
+           situation (cdr situations)
+           i (1+ i))
+      )))
+
 
 ;;; @ acting-condition
 ;;;
@@ -732,7 +815,8 @@ The compressed face will be piped to this command.")
   )
 
 (defun mime-view-display-entity (entity message-info ibuf obuf
-                                       default-situation)
+                                       default-situation
+                                       &optional situation)
   (let* ((start (mime-entity-point-min entity))
         (end (mime-entity-point-max entity))
          (content-type (mime-entity-content-type entity))
@@ -750,22 +834,24 @@ The compressed face will be piped to this command.")
       (narrow-to-region start end)
       (setq subj (eword-decode-string (mime-raw-get-subject entity)))
       )
-    (let* ((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)))
-            default-situation))
-          (button-is-invisible
-           (eq (cdr (assq 'entity-button situation)) 'invisible))
-          (header-is-visible
-           (eq (cdr (assq 'header situation)) 'visible))
-          (body-presentation-method
-           (cdr (assq 'body-presentation-method situation))))
+    (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)))
+                 default-situation)))
+    (let ((button-is-invisible
+          (eq (cdr (assq 'entity-button situation)) 'invisible))
+         (header-is-visible
+          (eq (cdr (assq 'header situation)) 'visible))
+         (body-presentation-method
+          (cdr (assq 'body-presentation-method situation)))
+         (children (mime-entity-children entity)))
       (set-buffer obuf)
       (setq nb (point))
       (narrow-to-region nb nb)
@@ -792,28 +878,32 @@ The compressed face will be piped to this command.")
                 (insert-buffer-substring mime-raw-buffer end-of-header end)
                 (funcall body-filter situation)
                 )))
+           (children)
            ((functionp body-presentation-method)
             (funcall body-presentation-method entity situation)
+            )
+           (t
+            (when button-is-invisible
+              (goto-char (point-max))
+              (mime-view-insert-entity-button entity message-info subj)
+              )
+            (or header-is-visible
+                (progn
+                  (goto-char (point-max))
+                  (insert "\n")
+                  ))
             ))
-      (or header-is-visible
-         body-presentation-method
-         (progn
-           (goto-char (point-max))
-           (insert "\n")
-           ))
       (setq ne (point-max))
       (widen)
       (put-text-property nb ne 'mime-view-raw-buffer ibuf)
       (put-text-property nb ne 'mime-view-entity entity)
       (goto-char ne)
-      (let ((children (mime-entity-children entity))
-           (default-situation
-             (cdr (assq 'childrens-situation situation))))
-       (while children
-         (mime-view-display-entity (car children) message-info ibuf obuf
-                                   default-situation)
-         (setq children (cdr children))
-         )))))
+      (if children
+         (if (functionp body-presentation-method)
+             (funcall body-presentation-method entity situation)
+           (mime-preview-multipart/mixed entity situation)
+           ))
+      )))
 
 (defun mime-raw-get-uu-filename ()
   (save-excursion
index 8e5c412..882d4b0 100644 (file)
@@ -29,7 +29,7 @@
 (eval-when-compile (require 'cl))
 
 
-(defconst mime-module-version '("WEMI" "Kamonomiya" 1 5 0)
+(defconst mime-module-version '("WEMI" "Odawara" 1 5 1)
   "Implementation name, version name and numbers of MIME-kernel package.")
 
 (autoload 'mule-caesar-region "mule-caesar"