Patch by Ed L. Cashin to make gnus-move-split-methods move to
[gnus] / lisp / mml.el
index d4a04b6..8c7b849 100644 (file)
@@ -27,7 +27,7 @@
 (require 'mm-bodies)
 (require 'mm-encode)
 (require 'mm-decode)
-(eval-when-compile 'cl)
+(eval-when-compile (require 'cl))
 
 (eval-and-compile
   (autoload 'message-make-message-id "message")
@@ -126,16 +126,13 @@ The function is called with one parameter, which is the generated part.")
                warn t))
        (setq raw (cdr (assq 'raw tag))
              point (point)
-             contents (if raw
-                          (mm-with-unibyte-current-buffer
-                            (mml-read-part (eq 'mml (car tag))))
-                        (mml-read-part (eq 'mml (car tag))))
+             contents (mml-read-part (eq 'mml (car tag)))
              charsets (if raw nil 
                         (mm-find-mime-charset-region point (point))))
        (when (and (not raw) (memq nil charsets))
          (if (or (memq 'unknown-encoding mml-confirmation-set)
                  (y-or-n-p
-                  "Warning: You message contains characters with unknown encoding. Really send?"))
+                  "Message contains characters with unknown encoding.  Really send?"))
              (if (setq use-ascii 
                        (or (memq 'use-ascii mml-confirmation-set)
                            (y-or-n-p "Use ASCII as charset?")))
@@ -352,8 +349,7 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
                  coded (buffer-string))))
        (mml-insert-mime-headers cont type charset encoding)
        (insert "\n")
-       (mm-with-unibyte-current-buffer
-         (insert coded))))
+       (insert coded)))
      ((eq (car cont) 'external)
       (insert "Content-Type: message/external-body")
       (let ((parameters (mml-parameter-string
@@ -450,12 +446,6 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
            "")
          mml-base-boundary))
 
-(defun mml-make-string (num string)
-  (let ((out ""))
-    (while (not (zerop (decf num)))
-      (setq out (concat out string)))
-    out))
-
 (defun mml-insert-mime-headers (cont type charset encoding)
   (let (parameters disposition description)
     (setq parameters
@@ -705,6 +695,7 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
     file))
 
 (defun mml-minibuffer-read-type (name &optional default)
+  (mailcap-parse-mimetypes)
   (let* ((default (or default
                      (mm-default-file-encoding name)
                      ;; Perhaps here we should check what the file
@@ -713,25 +704,7 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
                      "application/octet-stream"))
         (string (completing-read
                  (format "Content type (default %s): " default)
-                 (mapcar
-                  'list
-                  (mm-delete-duplicates
-                   (nconc
-                    (mapcar 'cdr mailcap-mime-extensions)
-                    (apply
-                     'nconc
-                     (mapcar
-                      (lambda (l)
-                        (delq nil
-                              (mapcar
-                               (lambda (m)
-                                 (let ((type (cdr (assq 'type (cdr m)))))
-                                   (if (equal (cadr (split-string type "/"))
-                                              "*")
-                                       nil
-                                     type)))
-                               (cdr l))))
-                      mailcap-mime-data))))))))
+                 (mapcar 'list (mailcap-mime-types)))))
     (if (not (equal string ""))
        string
       default)))
@@ -857,7 +830,12 @@ If RAW, don't highlight the article."
        (replace-match "\n"))
     (mml-to-mime)
     (if raw
-       (mm-disable-multibyte)
+       (when (fboundp 'set-buffer-multibyte)
+         (let ((s (buffer-string)))
+           ;; Insert the content into unibyte buffer.
+           (erase-buffer)
+           (mm-disable-multibyte)
+           (insert s)))
       (let ((gnus-newsgroup-charset (car message-posting-charset)))
        (run-hooks 'gnus-article-decode-hook)
        (let ((gnus-newsgroup-name "dummy"))