Update.
authoryamaoka <yamaoka>
Tue, 4 Aug 1998 08:11:04 +0000 (08:11 +0000)
committeryamaoka <yamaoka>
Tue, 4 Aug 1998 08:11:04 +0000 (08:11 +0000)
ChangeLog
NEWS
VERSION
ftp.in
mime-play.el
semi-def.el

index 58fa1d0..bc9e1aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+1998-07-21  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
+
+       * NEWS (Don't use "file" command to detect content of entity): New
+       section.
+
+       * mime-play.el (mime-magic-type-alist): New variable; abolish
+       `mime-file-content-type-alist'.
+       (mime-detect-content): New implementation (don't use "file"
+       command).
+
+\f
 1998-07-16  Katsumi Yamaoka   <yamaoka@jpl.org>
 
        * WEMI: Version 1.8.4 (Hara) released.
diff --git a/NEWS b/NEWS
index ab7b381..febedc3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,20 @@ Copyright (C) 1998 Free Software Foundation, Inc.
 
 * Changes in SEMI 1.8
 
+** Don't use "file" command to detect content of entity
+
+  Acting-method to detect content of entity was modified not to use
+"file" command.
+
+  Variable `mime-file-content-type-alist' was abolished.  Instead of
+it, new variable `mime-magic-type-alist' is available to customize.
+It is an alist of regexp about magic-number vs. corresponding
+media-types.  Each element looks like (REGEXP TYPE SUBTYPE).  REGEXP
+is a regular expression to match against the beginning of the content
+of entity.  TYPE is symbol to indicate primary type of media-type.
+SUBTYPE is symbol to indicate subtype of media-type.
+
+
 ** Abolish external X-Face viewer
 
 
diff --git a/VERSION b/VERSION
index dfe6c68..c86d2cd 100644 (file)
--- a/VERSION
+++ b/VERSION
 1.8.0  Toyama                  \e$(BIY;3\e(B             ; = JR \e$(B9b;3K\@~!"IY;39A@~\e(B
 1.8.1  Kureha                  \e$(B8b1)\e(B
 1.8.2  Kosugi                  \e$(B>.?y\e(B
-1.8.3  Ecch\e-Dþ-Daimon\e-A              \e$(B1[CfBgLg\e(B
+1.8.3  Ecch\e-Dþ-Daimon         \e$(B1[CfBgLg\e(B\e-A
 1.8.4  Takaoka                 \e$(B9b2,\e(B             ; = JR \e$(BI98+@~!">kC<@~\e(B
-:      :                       :
+1.8.5  Nishi-Takaoka           \e$(B@>9b2,\e(B
+-----  Fukuoka                 \e$(BJ!2,\e(B
+-----  Isurugi                 \e$(B@PF0\e(B
+-----  Kurikara                \e$(B6fMx2@Me\e(B
+-----  Tsubata                 \e$(BDEH(\e(B
+-----  Morimoto                \e$(B?9K\\e(B
 -------        Higashi-Kanazawa        \e$(BEl6bBt\e(B
 -------        Kanazawa                \e$(B6bBt\e(B             ; <=> \e$(BKLN&E4F;\e(B \e$(BKLE46bBt\e(B
 -------        Nishi-Kanazawa          \e$(B@>6bBt\e(B           ; <=> \e$(BKLN&E4F;\e(B \e$(B?7@>6bBt\e(B
 
 ;;-------------------------------------------------------------------------
 ;;     East Japan Railway      \e$(BElF|K\N95RE4F;\e(B   http://www.jreast.co.jp/
-;;     T\e-Dòkaidò\e-A Line              \e$(BEl3$F;K\@~\e(B
+;;     T\e-Dòkaidò Line         \e$(BEl3$F;K\@~\e(B\e-A
 ;;-------------------------------------------------------------------------
-1.2.0  T\e-Dòkyò\e-A                     \e$(BEl5~\e(B
+1.2.0  T\e-Dòkyò                        \e$(BEl5~\e(B\e-A
 1.2.1  Shinbashi               \e$(B?766\e(B     ; = JR \e$(B;3<j@~!"2#?\2l@~\e(B
 1.2.2  Shinagawa               \e$(BIJ@n\e(B     ; = JR \e$(B;3<j@~!"2#?\2l@~\e(B
 1.2.3  Kawasaki                \e$(B@n:j\e(B     ; = JR \e$(BFnIp@~\e(B
 1.2.4  Yokohama                \e$(B2#IM\e(B     ; = JR \e$(B5~IMElKL@~!&:,4_@~!"2#?\2l@~\e(B
 1.3.0  Totsuka                 \e$(B8MDM\e(B     ; = JR \e$(B2#?\2l@~\e(B
-1.3.1  \e-DÒfuna\e-A                     \e$(BBgA%\e(B     ; = JR \e$(B:,4_@~!"2#?\2l@~\e(B
+1.3.1  \e-DÒfuna                        \e$(BBgA%\e(B     ; = JR \e$(B:,4_@~!"2#?\2l@~\e(B\e-A
 1.4.0  Fujisawa                \e$(BF#Bt\e(B     ; <=> \e$(B>.ED5^EEE4\e(B \e$(B9>%NEg@~!"9>%NEgEEE4\e(B
-1.4.1  Tsujid\e-Dò\e-A                   \e$(@DT\e$(BF2\e(B ; \e$(B!J!V\e$(@DT\e$(B!W\e(B= J90@B-4454:128b\e$(B!K\e(B
+1.4.1  Tsujid\e-Dò                      \e$(@DT\e$(BF2\e(B ; \e$(B!J!V\e$(@DT\e$(B!W\e(B= J90@B-4454:128b\e$(B!K\e(B\e-A
 1.4.2  Chigasaki               \e$(B3}%v:j\e(B   ; = JR \e$(BAjLO@~\e(B
 1.4.3  Hiratsuka               \e$(BJ?DM\e(B
-1.4.4  \e-DÒiso\e-A                      \e$(BBg0k\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
-1.5.1  Odawara                 \e$B>.ED86\e(B    ; <=> \e$B>.ED5^!"H":,EP;3E4F;!"\e(B
-                                       ;     \e$B0KF&H":,E4F;\e(B
-1.5.2  Hayakawa                \e$BAa@n\e(B
-1.5.3  Nebukawa                \e$B:,I\@n\e(B
-1.5.4  Manazuru                \e$B??Da\e(B
-1.6.0  Yugawara                \e$BEr2O86\e(B
+1.4.4  \e-DÒiso                 \e$(BBg0k\e(B\e-A
+1.4.5  Ninomiya                \e$(BFs5\\e(B
+1.4.6  K\e-Dòzu                 \e$(B9qI\DE\e(B   ; = JR \e$(B8fEB>l@~\e(B\e-A
+1.5.0  Kamonomiya              \e$(B3{5\\e(B
+1.5.1  Odawara                 \e$(B>.ED86\e(B   ; <=> \e$(B>.ED5^!"H":,EP;3E4F;!"\e(B
+                                       ;     \e$(B0KF&H":,E4F;\e(B
+1.5.2  Hayakawa                \e$(BAa@n\e(B
+1.5.3  Nebukawa                \e$(B:,I\@n\e(B
+1.5.4  Manazuru                \e$(B??Da\e(B
+1.6.0  Yugawara                \e$(BEr2O86\e(B
 1.7.0  Atami                   \e$(BG.3$\e(B     ; = JR \e$(B0KEl@~\e(B
 ;;-------------------------------------------------------------------------
 ;;     Central Japan Railway   \e$(BEl3$N95RE4F;\e(B
 ;;-------------------------------------------------------------------------
 1.7.1  Kan'nami                \e$(BH!Fn\e(B
-1.8.0  Mishima                 \e$B;0Eg\e(B      ; = \e$B0KF&H":,E4F;\e(B
-1.8.1  Numazu                  \e$B>BDE\e(B      ; = JR \e$(B8fEB>l@~\e(B
-1.8.2  Katahama                \e$BJRIM\e(B
-1.8.4  Hara                    \e$B86\e(B
------  Higashi-Tagonoura       \e$BElED;R%N1:\e(B
------  Yoshiwara               \e$B5H86\e(B      ; = \e$B3YFnE4F;\e(B
------  Fuji                    \e$BIY;N\e(B      ; = JR \e$B?H1d@~\e(B
+1.8.0  Mishima                 \e$(B;0Eg\e(B     ; = \e$(B0KF&H":,E4F;\e(B
+1.8.1  Numazu                  \e$(B>BDE\e(B     ; = JR \e$(B8fEB>l@~\e(B
+1.8.2  Katahama                \e$(BJRIM\e(B
+1.8.4  Hara                    \e$(B86\e(B
+1.8.5  Higashi-Tagonoura       \e$(BElED;R%N1:\e(B
+-----  Yoshiwara               \e$(B5H86\e(B     ; = \e$(B3YFnE4F;\e(B
+-----  Fuji                    \e$(BIY;N\e(B     ; = JR \e$(B?H1d@~\e(B
 :      :                       :
 -----  Kanayama                \e$(B6b;3\e(B     ; =\e$(B!J\e(BJR \e$(BCf1{K\@~!K\e(B
------  Ot\e-Dòbashi                     \e$(BHxF,66\e(B\e-A
+-----  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
 1.5.0  Shimao                  \e$(BEgHx\e(B
 1.6.0  Amaharashi              \e$(B1+@2\e(B
 1.8.0  Ecch\e-Dþ-Kokubu         \e$(B1[Cf9qJ,\e(B\e-A
-1.8.1  Fushiki                 \e$(BIzLZ\e(B     ; <=> \e$B%&%i%8%*%9%C%H%C%/9RO)\e(B
-1.8.2  N\e-Dòmachi\e-A                   \e$(BG=D.\e(B
-1.8.3  Ecch\e-Dþ-Nakagawa\e-A            \e$(B1[CfCf@n\e(B
+1.8.1  Fushiki                 \e$(BIzLZ\e(B     ; <=> \e$(B%&%i%8%*%9%C%H%C%/9RO)\e(B
+1.8.2  N\e-Dòmachi                      \e$(BG=D.\e(B\e-A
+1.8.3  Ecch\e-Dþ-Nakagawa               \e$(B1[CfCf@n\e(B\e-A
 1.8.4  Takaoka                 \e$(B9b2,\e(B     ; = JR \e$(BKLN&K\@~!">kC<@~\e(B
 
 
diff --git a/ftp.in b/ftp.in
index 7cb4860..8408dbb 100644 (file)
--- a/ftp.in
+++ b/ftp.in
@@ -8,10 +8,10 @@
        access-type=anon-ftp;
        site="ftp.jaist.ac.jp";
        directory="/pub/GNU/elisp/semi";
-       name="semi-VERSION.tar.gz";
+       name="PACKAGE-VERSION.tar.gz";
        mode=image]]
 Content-Type: application/octet-stream;
-       name="semi-VERSION.tar.gz";
+       name="PACKAGE-VERSION.tar.gz";
        type=tar;
        conversions=gzip
 --}-<<alternative>>
index bb5870b..25610c0 100644 (file)
@@ -455,57 +455,54 @@ window.")
 ;;; @ file detection
 ;;;
 
-(defvar mime-file-content-type-alist
-  '(("JPEG"            image jpeg)
-    ("GIF"             image gif)
-    ("Standard MIDI"   audio midi)
+(defvar mime-magic-type-alist
+  '(("^\377\330\377[\340\356]..JFIF"   image jpeg)
+    ("^\211PNG"                                image png)
+    ("^GIF8[79]"                       image gif)
+    ("^II\\*\000"                      image tiff)
+    ("^MM\000\\*"                      image tiff)
+    ("^MThd"                           audio midi)
+    ("^\000\000\001\263"               video mpeg)
     )
-  "*Alist of \"file\" output patterns vs. corresponding media-types.
+  "*Alist of regexp about magic-number vs. corresponding media-types.
 Each element looks like (REGEXP TYPE SUBTYPE).
-REGEXP is pattern for \"file\" command output.
+REGEXP is a regular expression to match against the beginning of the
+content of entity.
 TYPE is symbol to indicate primary type of media-type.
 SUBTYPE is symbol to indicate subtype of media-type.")
 
 (defun mime-detect-content (entity situation)
-  (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-entity-safe-filename entity)
-                  ))
-          (encoding (or (cdr (assq 'encoding situation)) "7bit"))
-          (filename (if (and name (not (string-equal name "")))
-                        (expand-file-name name mime-temp-directory)
-                      (make-temp-name
-                       (expand-file-name "EMI" mime-temp-directory)))))
-      (mime-write-decoded-region (mime-entity-body-start entity) end
-                                filename encoding)
-      (let (type subtype)
-       (with-temp-buffer
-         (call-process "file" nil t nil filename)
-         (goto-char (point-min))
-         (if (search-forward (concat filename ": ") nil t)
-             (let ((rest mime-file-content-type-alist))
-               (while (not (let ((cell (car rest)))
-                             (if cell
-                                 (if (looking-at (car cell))
-                                     (setq type (nth 1 cell)
-                                           subtype (nth 2 cell))
-                                   )
-                               t)))
-                 (setq rest (cdr rest))))))
-       (if type
-           (mime-raw-play-entity
-            entity nil
-            (put-alist 'type type
-                       (put-alist 'subtype subtype
-                                  (del-alist 'method
-                                             (copy-alist situation))))
-            (cdr (assq 'ignore-examples situation))
-            'mime-detect-content)
-         ))
-      )))
+  (let (type subtype)
+    (let ((mdata (save-excursion
+                  ;;(set-buffer (mime-entity-buffer entity))
+                  (let* ((start (mime-entity-body-start entity))
+                         (end (progn
+                                (goto-char start)
+                                (end-of-line)
+                                (point))))
+                    (mime-decode-string (buffer-substring start end)
+                                        (mime-entity-encoding entity))
+                    )))
+         (rest mime-magic-type-alist))
+      (while (not (let ((cell (car rest)))
+                   (if cell
+                       (if (string-match (car cell) mdata)
+                           (setq type (nth 1 cell)
+                                 subtype (nth 2 cell))
+                         )
+                     t)))
+       (setq rest (cdr rest))))
+    (if type
+       (mime-raw-play-entity
+        entity nil
+        (put-alist 'type type
+                   (put-alist 'subtype subtype
+                              (del-alist 'method
+                                         (copy-alist situation))))
+        (cdr (assq 'ignore-examples situation))
+        'mime-detect-content)
+      ))
+  )
 
 
 ;;; @ mail/news message
index 35862c2..deb6ca4 100644 (file)
@@ -29,7 +29,7 @@
 (eval-when-compile (require 'cl))
 
 
-(defconst mime-user-interface-version '("WEMI" "Hara" 1 8 4)
+(defconst mime-user-interface-version '("WEMI" "Higashi-Tagonoura" 1 8 5)
   "Implementation name, version name and numbers of MIME-kernel package.")
 
 (autoload 'mule-caesar-region "mule-caesar"