(mime-view-filter-for-image): Refer 'image-format of preview-situation
authormorioka <morioka>
Sun, 22 Mar 1998 10:26:03 +0000 (10:26 +0000)
committermorioka <morioka>
Sun, 22 Mar 1998 10:26:03 +0000 (10:26 +0000)
instead of 'mime-view-image-converter-alist; abolish variable
'mime-view-image-converter-alist.

mime-image.el

index 37c8ca6..05bbd92 100644 (file)
          ))
     )
 
-(defvar mime-view-image-converter-alist nil)
-
 (mapcar (function
         (lambda (rule)
           (let ((type    (car rule))
                 (subtype (nth 1 rule))
                 (format  (nth 2 rule)))
             (if (image-inline-p format)
-                (let ((type/subtype (mime-type/subtype-string type subtype)))
-                   ;; (set-alist 'mime-view-content-filter-alist
-                   ;;            type/subtype #'mime-view-filter-for-image)
-                  (set-alist 'mime-view-image-converter-alist
-                             type/subtype format)
-                   ;; (add-to-list
-                   ;;  'mime-view-visible-media-type-list
-                   ;;  ctype)
-                  (ctree-set-calist-strictly
-                   'mime-preview-condition
-                   (list (cons 'type type)(cons 'subtype subtype)
-                         '(body . visible)
-                         '(body-presentation-method . with-filter)
-                         (cons 'body-filter
-                               #'mime-view-filter-for-image)))
-                  )
-              ))))
+                (ctree-set-calist-strictly
+                 'mime-preview-condition
+                 (list (cons 'type type)(cons 'subtype subtype)
+                       '(body . visible)
+                       '(body-presentation-method . with-filter)
+                       (cons 'body-filter
+                             #'mime-view-filter-for-image)
+                       (cons 'image-format format))
+                 )))))
        '((image jpeg           jpeg)
          (image gif            gif)
          (image tiff           tiff)
          (image png            png)
          ))
 
-;; (defvar mime-view-ps-to-gif-command "pstogif")
-
 
 ;;; @ content filter for images
 ;;;
     (remove-text-properties beg end '(face nil))
     (message "Decoding image...")
     (mime-decode-region beg end (cdr (assq 'encoding situation)))
-    (let* ((minor (cdr (assoc (mime-type/subtype-string
-                              (cdr (assq 'type situation))
-                              (cdr (assq 'subtype situation)))
-                             mime-view-image-converter-alist)))
-          (gl (image-normalize minor (buffer-string)))
-          e)
+    (let ((gl (image-normalize (cdr (assq 'image-format situation))
+                              (buffer-string))))
       (delete-region (point-min)(point-max))
       (cond ((image-invalid-glyph-p gl)
             (setq gl nil)
             )
            (t
             (setq gl (make-glyph gl))
-            (setq e (make-extent (point) (point)))
-            (set-extent-end-glyph e gl)
+            (let ((e (make-extent (point) (point))))
+              (set-extent-end-glyph e gl)
+              )
             (message "Decoding image... done")
             ))
       )
 ;;;
 ;;    (for XEmacs 19.14 or later)
 
+;; (defvar mime-view-ps-to-gif-command "pstogif")
+
 ;; (defun mime-view-filter-for-application/postscript (ctype params encoding)
 ;;   (let* ((beg (point-min)) (end (point-max))
 ;;          (file-base