(mm-insert-part): Switch the multibyteness of data which will be inserted
authorKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 20 Jan 2005 08:42:35 +0000 (08:42 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 20 Jan 2005 08:42:35 +0000 (08:42 +0000)
 according to the multibyteness of a buffer rather than the type of contents.
 Suggested by ARISAWA Akihiro.

lisp/ChangeLog
lisp/mm-decode.el

index 26807df..2cd3008 100644 (file)
@@ -1,5 +1,10 @@
 2005-01-20  Katsumi Yamaoka  <yamaoka@jpl.org>
 
+       * mm-decode.el (mm-insert-part): Switch the multibyteness of data
+       which will be inserted according to the multibyteness of a buffer
+       rather than the type of contents.  Suggested by ARISAWA Akihiro
+       <ari@mbf.ocn.ne.jp>.
+
        * nnrss.el (nnrss-find-el): Check carefully whether there's a list
        of string which old xml.el may return rather than a string.
 
index 65b9545..3dacd31 100644 (file)
@@ -1,5 +1,5 @@
 ;;; mm-decode.el --- Functions for decoding MIME things
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -1026,27 +1026,10 @@ external if displayed external."
 
 (defun mm-insert-part (handle)
   "Insert the contents of HANDLE in the current buffer."
-  (let ((cur (current-buffer)))
-    (save-excursion
-      (if (member (mm-handle-media-supertype handle) '("text" "message"))
-         (with-temp-buffer
-           (insert-buffer-substring (mm-handle-buffer handle))
-           (prog1
-               (mm-decode-content-transfer-encoding
-                (mm-handle-encoding handle)
-                (mm-handle-media-type handle))
-             (let ((temp (current-buffer)))
-               (set-buffer cur)
-               (insert-buffer-substring temp))))
-       (mm-with-unibyte-buffer
-         (insert-buffer-substring (mm-handle-buffer handle))
-         (prog1
-             (mm-decode-content-transfer-encoding
-              (mm-handle-encoding handle)
-              (mm-handle-media-type handle))
-           (let ((temp (current-buffer)))
-             (set-buffer cur)
-             (insert-buffer-substring temp))))))))
+  (save-excursion
+    (insert (if (mm-multibyte-p)
+               (mm-string-as-multibyte (mm-get-part handle))
+             (mm-get-part handle)))))
 
 (defun mm-file-name-delete-whitespace (file-name)
   "Remove all whitespace characters from FILE-NAME."