* lisp/message.el (message-clone-locals): Add "user-mail-address" and
[elisp/gnus.git-] / lisp / mm-view.el
index 10ab086..706a2a2 100644 (file)
@@ -26,6 +26,7 @@
 (require 'mail-parse)
 (require 'mailcap)
 (require 'mm-bodies)
+(require 'mm-decode)
 
 ;;;
 ;;; Functions for displaying various formats inline
        buffer-read-only image)
     (mm-with-unibyte-buffer
       (insert-buffer-substring (mm-handle-buffer handle))
-      (mm-decode-content-transfer-encoding (mm-handle-encoding handle))
+      (mm-decode-content-transfer-encoding
+       (mm-handle-encoding handle)
+       (car (mm-handle-type handle)))
       (setq image (make-image-specifier
                   (vector (intern type) :data (buffer-string)))))
     (let ((annot (make-annotation image nil 'text)))
       (set-extent-property annot 'mm t)
       (set-extent-property annot 'duplicable t)
-      (mm-handle-set-undisplayer handle annot))
-    (insert " ")))
+      (mm-insert-inline handle " \n"))))
 
 (defun mm-inline-text (handle)
   (let ((type (cadr (split-string (car (mm-handle-type handle)) "/")))
@@ -52,7 +54,9 @@
      ((equal type "plain")
       (with-temp-buffer
        (insert-buffer-substring (mm-handle-buffer handle))
-       (mm-decode-content-transfer-encoding (mm-handle-encoding handle))
+       (mm-decode-content-transfer-encoding
+        (mm-handle-encoding handle)
+        (car (mm-handle-type handle)))
        (setq text (buffer-string)))
       (let ((b (point)))
        (insert text)
                 ,(set-marker (make-marker) (point-min))
                 ,(set-marker (make-marker) (point-max)))))))))
      ((equal type "html")
-      (save-excursion
-       (w3-do-setup)
-       (mm-with-unibyte-buffer
-         (insert-buffer-substring (mm-handle-buffer handle))
-         (mm-decode-content-transfer-encoding (mm-handle-encoding handle))
-         (require 'url)
-         (save-window-excursion
-           (w3-region (point-min) (point-max))
-           (setq text (buffer-string))))
-       (mm-insert-inline handle text)))
+      (let ((width (window-width)))
+       (save-excursion
+         (w3-do-setup)
+         (mm-with-unibyte-buffer
+           (insert-buffer-substring (mm-handle-buffer handle))
+           (mm-decode-content-transfer-encoding
+            (mm-handle-encoding handle)
+            (car (mm-handle-type handle)))
+           (require 'url)
+           (save-window-excursion
+             (let ((w3-strict-width width))
+               (w3-region (point-min) (point-max)))
+             (setq text (buffer-string))))))
+      (mm-insert-inline handle text))
      ((or (equal type "enriched")
          (equal type "richtext"))
       (save-excursion
        (mm-with-unibyte-buffer
          (insert-buffer-substring (mm-handle-buffer handle))
-         (mm-decode-content-transfer-encoding (mm-handle-encoding handle))
+         (mm-decode-content-transfer-encoding
+          (mm-handle-encoding handle)
+          (car (mm-handle-type handle)))
          (save-window-excursion
            (enriched-decode (point-min) (point-max))
-           (setq text (buffer-string))))
-       (mm-insert-inline handle text)))
-     )))
+           (setq text (buffer-string)))))
+      (mm-insert-inline handle text))
+     (t
+      (save-excursion
+       (mm-with-unibyte-buffer
+         (insert-buffer-substring (mm-handle-buffer handle))
+         (mm-decode-content-transfer-encoding
+          (mm-handle-encoding handle)
+          (car (mm-handle-type handle)))
+         (setq text (buffer-string))))
+      (mm-insert-inline handle text)))))
 
 (defun mm-insert-inline (handle text)
   "Insert TEXT inline from HANDLE."