Synch to No Gnus 200410060748.
[elisp/gnus.git-] / lisp / mm-decode.el
index 6e9ee2d..49fc7e1 100644 (file)
@@ -579,11 +579,7 @@ Postpone undisplaying of viewers for types in
 (defun mm-dissect-singlepart (ctl cte &optional force cdl description id)
   (when (or force
            (if (equal "text/plain" (car ctl))
-               ;; FIXME: This is a kludge.  Proper fix is to make
-               ;; gnus-display-mime invoke mm-uu-dissect on all
-               ;; textual MIME parts, and stop using mm-fill-flowed
-               ;; here.
-               (and mm-fill-flowed (assoc 'format ctl))
+               (assoc 'format ctl)
              t))
     (mm-make-handle
      (mm-copy-to-buffer) ctl cte nil cdl description nil id)))
@@ -620,18 +616,17 @@ Postpone undisplaying of viewers for types in
 (defun mm-copy-to-buffer ()
   "Copy the contents of the current buffer to a fresh buffer."
   (save-excursion
-    (let ((flag enable-multibyte-characters)
-         (new-buffer (generate-new-buffer " *mm*")))
+    (let ((obuf (current-buffer))
+         beg)
       (goto-char (point-min))
       (search-forward-regexp "^\n" nil t)
-      (save-restriction
-       (narrow-to-region (point) (point-max))
-       (when flag
-         (set-buffer-multibyte nil))
-       (copy-to-buffer new-buffer (point-min) (point-max))
-       (when flag
-         (set-buffer-multibyte t)))
-      new-buffer)))
+      (setq beg (point))
+      (set-buffer
+       ;; Preserve the data's unibyteness (for url-insert-file-contents).
+       (let ((default-enable-multibyte-characters (mm-multibyte-p)))
+        (generate-new-buffer " *mm*")))
+      (insert-buffer-substring obuf beg)
+      (current-buffer))))
 
 (defun mm-display-parts (handle &optional no-default)
   (if (stringp (car handle))