Synch to No Gnus 200402270146.
[elisp/gnus.git-] / lisp / mm-view.el
index d3eb051..add8fab 100644 (file)
@@ -1,5 +1,6 @@
 ;;; mm-view.el --- functions for viewing MIME objects
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
+;; 2004 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; This file is part of GNU Emacs.
     (html2text  html2text))
   "The attributes of washer types for text/html.")
 
+(defcustom mm-fill-flowed t
+  "If non-nil a format=flowed article will be displayed flowed."
+  :type 'boolean
+  :group 'mime-display)
+
 ;;; Internal variables.
 
 ;;;
@@ -74,7 +80,6 @@
   (let ((b (point-marker))
        buffer-read-only)
     (put-image (mm-get-image handle) b)
-    (insert "\n\n")
     (mm-handle-set-undisplayer
      handle
      `(lambda ()
   (setq w3m-display-inline-images mm-inline-text-html-with-images))
 
 (defun mm-w3m-cid-retrieve-1 (url handle)
-  (dolist (elem handle)
-    (when (and (listp elem)
-              (equal url (mm-handle-id elem)))
-      (mm-insert-part elem)
-      (throw 'found-handle (mm-handle-media-type elem)))))
+  (if (mm-multiple-handles handle)
+      (dolist (elem handle)
+       (mm-w3m-cid-retrieve-1 url elem))
+    (when (and (listp handle)
+              (equal url (mm-handle-id handle)))
+      (mm-insert-part handle)
+      (throw 'found-handle (mm-handle-media-type handle)))))
 
 (defun mm-w3m-cid-retrieve (url &rest args)
   "Insert a content pointed by URL if it has the cid: scheme."
   (when (string-match "\\`cid:" url)
-    (setq url (concat "<" (substring url (match-end 0)) ">"))
     (catch 'found-handle
-      (let ((handles (with-current-buffer w3m-current-buffer
-                      gnus-article-mime-handles)))
-       (if (mm-multiple-handles handles)
-           (dolist (handle handles)
-             (mm-w3m-cid-retrieve-1 url handle))
-         (mm-w3m-cid-retrieve-1 url handles))))))
+      (mm-w3m-cid-retrieve-1 (concat "<" (substring url (match-end 0)) ">")
+                            (with-current-buffer w3m-current-buffer
+                              gnus-article-mime-handles)))))
 
 (defun mm-inline-text-html-render-with-w3m (handle)
   "Render a text/html part using emacs-w3m."
          (mm-insert-part handle)
          (goto-char (point-max)))
       (insert (mm-decode-string (mm-get-part handle) charset)))
-    (when (and (equal type "plain")
+    (when (and mm-fill-flowed
+              (equal type "plain")
               (equal (cdr (assoc 'format (mm-handle-type handle)))
                      "flowed"))
       (save-restriction